PHP: Creating a simple PHP login (Part 2)
Uploader Comments (abell12)
All Comments (33)
-
Parse error: syntax error, unexpected T_STRING in /Applications/XAMPP/xamppfiles
/htdocs/login.php on line 3--------why -
hye ;)
when i click log in..this appear
Click here to enter the members area"; $_SESSION['username']=$dbusern
ame; } else echo "Incorrect password"; } else echo ("That username doesnt exist"); } else die ("Please enter a username and password"); ?> can u help me???
thanks
-
namae
-
this can be attacked with sql injection. by that i mean, i could add a user by writing some magic into the username field.
also you dun need select *
you could just do select `users`.`password` because you know the username already and dont need the id in your case anyways.
php.net/manual/en/function.mys
ql-real-escape-string.php -
should it no be
mysql_connect("localhost", "username", "password") or die(mysql_error()); mysql_select_db("Database_Name
") or die(mysql_error()); and also $query=mysql_query("SELECT * FROM users WHERE username='$username' ");
-
What are the steps to do this?
Once I put in the username and password and hit login, it just brings up a blank page leading to login.php witch doesn't have anything on it. Please help, thanks!
BudgieBlu 2 weeks ago
@BudgieBlu on login.php in do you have any echo's or a header in this if statement:
if($username==$db_username&&$enc_password==$db_password)
abell12 2 weeks ago
@abell12 yes i have the echo for the successful login and incorrect password
BudgieBlu 2 weeks ago
@BudgieBlu Can you send me your code in a private message?
abell12 2 weeks ago
Hello i notice that the register page encripts the password but the login form dose not login with out it bening encripted help me
EwizedTech 4 weeks ago
@EwizedTech It's because when i created the register form i encypted the password and the encryted password was stored in the database but the login for when i did the tutorial i didnt use an encypted password so you just need to add in on the login for the MD5 encrytion function to encypt the users password before checking the current password in the database
abell12 4 weeks ago