Page 1 of 1

Error? [SOLVED]

Posted: Sat Jan 07, 2012 2:14 am
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!

Re: Error?

Posted: Sat Jan 07, 2012 2:49 am
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

Re: Error?

Posted: Sat Jan 07, 2012 2:56 am
by OoZI
Oh...

Re: Error?

Posted: Sat Jan 07, 2012 3:00 am
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];

Re: Error?

Posted: Sat Jan 07, 2012 3:24 am
by Ark
In that case you use "( )", All php functions use it.

Re: Error?

Posted: Sat Jan 07, 2012 3:45 am
by OoZI
Ok... :evil: :evil:

Re: Error?

Posted: Sat Jan 07, 2012 2:51 pm
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

Re: Error?

Posted: Sat Jan 07, 2012 3:51 pm
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>";
?>

Re: Error?

Posted: Sat Jan 07, 2012 4:35 pm
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.

Re: Error?

Posted: Sat Jan 07, 2012 5:03 pm
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