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

PHP Tutorials: 'Remember me' style Login System using Cookies and Sessions (Part 3)

Loading...

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

Uploaded by on Aug 8, 2009

Visit the forum for help!
http://phpacademy.info/forum

Follow on Twitter!
http://twitter.com/phpacademy

Create a cookie/session based login system with a 'remember me' checkbox to keep your user logged in for next time they visit.

  • likes, 4 dislikes

Link to this comment:

Share to:

Uploader Comments (phpacademy)

  • Nice tut Alex!

    many thanks!

  • You're 100% welcome!

see all

All Comments (21)

Sign In or Sign Up now to post a comment!
  • Lol you did way too much work. Just take away the while loop and when you make the $password variable at the very top, encrypt it to md5 there and then check the passwords in the MySQL query.

  • the way you check the password is very dangerous anyway. if you use sqlinjection on the username so you get all the table as result, you could try the password with every table's tuples!. username is unique, so why why the "while loop" and not just an if statement?

  • can someone help me with this coding? it gives me an Parse error: syntax error, unexpected T_ELSE on line 40 the coding is if ($loggedin == TRUE) { if ($rememberme=="on") setcookie("username", $username, time()+7200); else if ($rememberme == "") $_SESSION['username']='$userna­me'; { header("Location:welcome.php")­; exit() else header("Location incorrect.php") } }

  • why did you not use mysql_num_rows instead of while then loop the data then execute a statement???hehhe just asking :)

  • php academy thanks for all that you do for us , i think that you should team up with phpclass , many thanks

    From Brazil

    (P.S. I Think You Should Really Consider It)

  • HI mate , thank you , I am a novice php programmer , and this trick of sql injection I didn't know ,

    A lot of webpage that I've seen , shows the script '$username' AND '$password' , witch is vulnerable. So , I think we must take care about the examples of codes over the internet , many of them can be vulnerable.

    Many thanks from Brazil

  • @Jagatia i do all right but still there is inocorrect password combination error :@

  • @phpacademy please help me buddy

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