View Single Post
Old 03-19-2008, 06:05 PM   #8 (permalink)
hasansahip
Recruit
 
Join Date: Mar 2008
Posts: 4
hasansahip is on a distinguished road
.

Quote:
Originally Posted by Belisarius View Post
POST data is sent when you submit a form (usually by pressing on a button labelled "Submit" or "Login" or somesuch) with the "action=POST" property. If you simply load up a PHP page, the $_POST array will be empty because no form has been submitted.

So, if you go to your "TMPh1hlhxx6mm.php" file in your browser, you haven't actually submitted any POST data, and $_POST is empty. However, your script assumes it isn't. For instance, look at the following statement you have on line 11:

$_POST["username"] does not exist - the $_POST array is empty. PHP gives you an error and the "if" statement fails.

Likewise, if this is the first time you have accessed this page, no session variables have been set. So the following elseif:

will likewise fail, because $_SESSION is empty. And if both clauses fail, $username and $password are never set.
honestly, i liked your explanation but do you know the solution? i have to use the login script with session. thanks.
hasansahip is offline   Reply With Quote