Page 20 of 35

Re: Video#5

Posted: Wed Jun 23, 2010 5:17 pm
by Jackolantern
You need to change the ( ) to { } like in the last script. In it's current state, there is no telling what the script may do.

Re: Video#5

Posted: Wed Jun 23, 2010 5:31 pm
by Dizuki
Yah i noticed that and fixed it but it still doesn't work. There hast to be something wrong with authenticate.php but i can't tell what, i don't have HD so i have a hard time reading the video but nothing really stands out wrong with my script anymore. White space isn't counted right?

Re: Video#5

Posted: Wed Jun 23, 2010 5:53 pm
by hallsofvallhalla
$_post should be $_POST

Re: Video#5

Posted: Wed Jun 23, 2010 6:13 pm
by Jackolantern
hallsofvallhalla wrote:$_post should be $_POST
Still not sure why that would cause a blank screen. That should be a parse error, unknown function name, or an undefined variable. I think there is something else that is being missed here.

@Dizuki:

Can you tell us exactly what happens when you reach the blank screen. What page you were on, what you clicked, and what the address bar says you are on when the page is blank.

Re: Video#5

Posted: Wed Jun 23, 2010 7:06 pm
by hallsofvallhalla
the reason why is because it is treating $_post as a array variable. If that variable is empty, the submit, then there is no error and the the page does not have a if player does not hit submit.

change the bottom of your page to look like this

Code: Select all

else
{
echo "<big>Wrong username or password. <a href='login.php'>Try Again</a></big>";
}
}
else
{
echo "no submit post variable set";
}
?>
and you will get that error because no submit is happening. Let me also see your login page.

Re: Video#5

Posted: Wed Jun 23, 2010 7:30 pm
by Jackolantern
Oops! Missed that one, and then I was looking at the second posted script.

Re: Video#5

Posted: Wed Jun 23, 2010 7:46 pm
by Dizuki
Ok now it says "no submit post variable set" like halls said it would.
Here is login.php :

Code: Select all

<form method="post" action="authenticate.php">
User Name <input type="text" name="player" size="21"> 
Password <input type="password" name="password" size="21" mask="x"> 
<br>
<input type="submit" value="Login" name="Submit">
<br>

Re: Video#5

Posted: Wed Jun 23, 2010 8:01 pm
by Jackolantern
Did you capitalize the $_POST and remove the space after it? It should be:

Code: Select all

$_POST['submit']

Re: Video#5

Posted: Wed Jun 23, 2010 8:04 pm
by Dizuki
Ok its becoming pretty obvious that i suck at this. LOL Ok so what else do i capitalize?

Re: Video#5

Posted: Wed Jun 23, 2010 10:49 pm
by Jackolantern
Anytime you store variables with $_POST, $_GET, $_SESSION, or $_COOKIE you need to capitalize them because PHP is case-sensitive. That means that even your own variables are case sensitive.

If you are feeling lost, you will get much more out of the tutorials if you read a book on PHP beforehand. Then you are only using the techniques in the tutorial, rather than just typing it verbatim without knowing how it works. Here is a good and free online book you can check out. Read as much as you like, but you should seriously consider reading chapters 1 - 10, 17, 18 and 19. After that you should have a full understanding of the PHP being used to make web games.