Alert icon
We're changing our privacy policy. This stuff matters.  Learn more  Dismiss

PHP: Creating a simple PHP login (Part 2)

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
5,097
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Link to this comment:

Share to:

Uploader Comments (abell12)

  • 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 on login.php in do you have any echo's or a header in this if statement:

    if($username==$db_username&&$e­nc_password==$db_password)

  • @abell12 yes i have the echo for the successful login and incorrect password

  • @BudgieBlu Can you send me your code in a private message?

  • 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 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

see all

All Comments (33)

Sign In or Sign Up now to post a comment!
  • 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?

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more