Error? [SOLVED]

C++, C#, Java, PHP, ect...
Post Reply
User avatar
OoZI
Posts: 109
Joined: Mon Jan 02, 2012 4:22 pm

Error? [SOLVED]

Post by OoZI »

Here is the error I am getting for the code: Fatal error: Function name must be a string in /home/a7754873/public_html/reguser.php on line 6

Here is the code:

Code: Select all

<?php
include 'connect.php';
?>

<?php
$player=$_POST('uname');
$password=$_POST('password');
$pass2=$_POST('password2');
$player=strip_tags($player);
$email=$_POST('email');
$email=strip_tags($email);

if ($email == "")
{
echo "You did not Enter an Email!";
echo "<a href='register.php'>Go Back</a><br />";
exit;
}
if ($password==$password2)
{

$isplayer="SELECT * FROM Players WHERE name='$player'";
$isplayer2=mysql_query($isplayer) or die("Error, Unable to query Database");
$isplayer3=mysql_fetch_array($isplayer2);
if(!$_POST['password'] || !$_POST['password2'])
{
echo "You did not enter / incorrectly entered your password";
echo "<a href='register.php'>Go Back</a>";
exit;
}
else if($isplayer3 || strlen($player)>21 || strlen($player) <1)
{
echo "There is already a user with that name, please go back and try again.";
echo "<a href='register.php'>Go Back</a><br>";
exit;
}
else
{
$isaddress="SELECT * FROM players where email='$email'";
$isaddress2=mysql_query($isaddress) or die ("Unable to acces Password Database");
$isaddress3=mysql_fetch_array($isaddress2);
if ($isaddress3)
{
echo "There is already a player with that e-mail assress";
echo "<a href='register.php'>Go Back</a><br>";
exit;
}
else
{
$password=md5($password);

$SQL = "INSERT INTO players(name, password, email, level, exper) VALUES ('$player','$password','$email','1','0')";
mysql_query($SQL) or die ("Unable to register to databases");

echo "Thank you For Registering";

}
}
}

else
{
echo "Your Password didn't Match, or you did not enter a password";
echo "<a href='register.php'>Go Back</a><br>";
exit;
}
echo "<a href='login.php'>Login Now!</a><br>";
?>



Any Help Here would be great!
Last edited by OoZI on Thu Jan 12, 2012 3:47 pm, edited 1 time in total.
-OoZI

My Blog
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Error?

Post by hallsofvallhalla »

Code: Select all

$player=$_POST('uname');
$password=$_POST('password');
$pass2=$_POST('password2');
$player=strip_tags($player);
$email=$_POST('email');
$email=strip_tags($email);
you are using (), should be []
should be

Code: Select all

$player=$_POST['uname'];
and so on
User avatar
OoZI
Posts: 109
Joined: Mon Jan 02, 2012 4:22 pm

Re: Error?

Post by OoZI »

Oh...
-OoZI

My Blog
User avatar
OoZI
Posts: 109
Joined: Mon Jan 02, 2012 4:22 pm

Re: Error?

Post by OoZI »

Here are the changes, now I get this: Parse error: syntax error, unexpected '[' in /home/a7754873/public_html/reguser.php on line 9

Code: Select all

<?php
include 'connect.php';
?>

<?php

$player=$_POST['uname'];
$password=$_POST['password'];
$pass2=$_POST['password2'];
$player=strip_tags[$player];         *This is where the error is*
$email=$_POST['email'];
$email=strip_tags[$email];
-OoZI

My Blog
User avatar
Ark
Posts: 427
Joined: Wed Jun 01, 2011 10:25 pm

Re: Error?

Post by Ark »

In that case you use "( )", All php functions use it.
Orgullo Catracho
User avatar
OoZI
Posts: 109
Joined: Mon Jan 02, 2012 4:22 pm

Re: Error?

Post by OoZI »

Ok... :evil: :evil:
-OoZI

My Blog
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Error?

Post by hallsofvallhalla »

$player=strip_tags[$player];

yes Strip tags is a function, so it should be

Code: Select all

$player=strip_tags($player);
the rest should stay the same
User avatar
OoZI
Posts: 109
Joined: Mon Jan 02, 2012 4:22 pm

Re: Error?

Post by OoZI »

Ok, One more error: Parse error: syntax error, unexpected T_ELSE in /home/a7754873/public_html/reguser.php on line 32



Code: Select all

<?php
include 'connect.php';
?>

<?php
$player=$_POST['uname'];
$password=$_POST['password'];
$pass2=$_POST['password2'];
$player=strip_tags($player);
$email=$_POST['email'];
$email=strip_tags($email);

if ($email == "")
{
echo "You did not Enter an Email!";
echo "<a href='register.php'>Go Back</a><br />";
exit;
}
if ($password==$password2)
{

$isplayer="SELECT * FROM Players WHERE name='$player'";
$isplayer2=mysql_query($isplayer) or die("Error, Unable to query Database");
$isplayer3=mysql_fetch_array($isplayer2);
}
if(!$_POST['password'] || !$_POST['password2'])
{
echo "You did not enter / incorrectly entered your password";
echo "<a href='register.php'>Go Back</a>";
exit;

else if($isplayer3 || strlen($player)>21 || strlen($player) <1)
{
echo "There is already a user with that name, please go back and try again.";
echo "<a href='register.php'>Go Back</a><br>";
exit;
}
else
{
$isaddress="SELECT * FROM players where email='$email'";
$isaddress2=mysql_query($isaddress) or die ("Unable to acces Password Database");
$isaddress3=mysql_fetch_array($isaddress2);
if ($isaddress3)
{
echo "There is already a player with that e-mail assress";
echo "<a href='register.php'>Go Back</a><br>";
exit;
}
else
{
$password=md5($password);

$SQL = "INSERT INTO players(name, password, email, level, exper) VALUES ('$player','$password','$email','1','0')";
mysql_query($SQL) or die ("Unable to register to databases");

echo "Thank you For Registering";

}
}
}

else
{
echo "Your Password didn't Match, or you did not enter a password<br />";
echo "<a href='register.php'>Go Back</a><br>";
exit;
}
echo "<a href='login.php'>Login Now!</a><br>";
?>
-OoZI

My Blog
User avatar
Chris
Posts: 1581
Joined: Wed Sep 30, 2009 7:22 pm

Re: Error?

Post by Chris »

you forgot a } on line 31. This is why people indent their code, it keeps it easier to see where compile statements begin and end.
Fighting for peace is declaring war on war. If you want peace be peaceful.
User avatar
OoZI
Posts: 109
Joined: Mon Jan 02, 2012 4:22 pm

Re: Error?

Post by OoZI »

When I added that I get this error: Parse error: syntax error, unexpected T_ELSE in /home/a7754873/public_html/reguser.php on line 60
-OoZI

My Blog
Post Reply

Return to “Coding”