I need help with tutorial 3, please help me :-(

Location of the Videos
Post Reply
dakar
Posts: 7
Joined: Fri Jan 02, 2015 11:28 am

I need help with tutorial 3, please help me :-(

Post by dakar »

Hi.
I have error in reguser.php : Fatal error: Function name must be a string in C:\wamp\www\reguser.php on line 6
Could you please check my reguser.php, Thanks !
REGUSER

Code: Select all

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

<?php
$player=$_POST('player');
$password=$_POST('password');
$pass2=$_POST('pass2');
$player=strip_tags($player);
$email=$_POST('email');
$email-strip_tags($emaila);

if ($email == "")
{
echo "You didn't enter a email address!<br>";
echo " <A href='register.php'>Go back</a>";
exit;
}
if ($password==$pass2)
{

$isplayer="SELECT * from players where name='$player'";
$isplayer2=mysql_query($isplayer) or die("Could not query players table");
$isplayer3=mysql_fetch_array(isplayer2);

if (!$_post['password'] || !$_POST['pass2'])
{
print "You did not enter a password<br>";
echo " <A href='register.php'>Go back</a>";
exit;
}
else if ($isplayer3 || strlen($player)>21 || strlen($player)<1)
{
print "There is already a player of that name of the name you specified is over 16 letters or less thnak 1 letter";
echo " <A href='register.php'>Go back</a><br>";
exit;
}
else
{
$isaddress="SELECT * from players where email='$email'";
$isaddress2=mysql_query($isaddress) or die("not able to query for password");
$isaddress3=mysql_fetch_array($isaddress2);
if ($isaddress3)
{
print "There is already player with that email address";
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("could not register");

print "Thank you for registering!";

}
}
}

else
{
print "Your password didn't match or you did not enter a password";
echo " <A href='register.php'>Go back</a><br>";
exit;
}

?>
echo " <A hred='login.php'>Login Page</a><br>";
User avatar
KyleMassacre
Posts: 573
Joined: Wed Nov 27, 2013 12:42 pm

Re: I need help with tutorial 3, please help me :-(

Post by KyleMassacre »

Can you please use code tags please to help make the code a bit more readable next time?

But to help you with your question, $_POST super globals are used for arrays and not functions so it wouldn't be used as $_POST("something"); it would be used as $_POST["something"]; Notice the square brackets and not parentheses? A few lines down is a function "strip_tags" so for that you would use parentheses wrapped around your string in your case is $emaila but $emaila is actually an undefined variable which will pose another error, it should just be $email. It should look similar to this:

Code: Select all

$player=$_POST['player'];
$password=$_POST['password'];
$pass2=$_POST['pass2'];
$player=strip_tags($player);
$email=$_POST['email'];
$email=strip_tags($email);
Also when defining a variable you must use the "=" and not "-" like you did for your last email variable that you used strip tags on
dakar
Posts: 7
Joined: Fri Jan 02, 2015 11:28 am

Re: I need help with tutorial 3, please help me :-(

Post by dakar »

It works, thanks a lot!
But I have next problem.
The attack can not see the names of monster.
Attack goes, but I do not see their names.
Error is in PHP or MySQL?
Very Thanks!
User avatar
Jackolantern
Posts: 10893
Joined: Wed Jul 01, 2009 11:00 pm

Re: I need help with tutorial 3, please help me :-(

Post by Jackolantern »

Could you start a new thread, and post the code that is causing the problem? :)
The indelible lord of tl;dr
dakar
Posts: 7
Joined: Fri Jan 02, 2015 11:28 am

Re: I need help with tutorial 3, please help me :-(

Post by dakar »

Sorry, I did not want to unnecessarily create new topic.
Okay, i create new topic.
User avatar
Jackolantern
Posts: 10893
Joined: Wed Jul 01, 2009 11:00 pm

Re: I need help with tutorial 3, please help me :-(

Post by Jackolantern »

Its ok! It is just easy to miss problems posted in a thread that has already been resolved.
The indelible lord of tl;dr
Post Reply

Return to “Older Browser MMO Videos”