SitePoint Sponsor

User Tag List

Results 1 to 6 of 6

Thread: Passwords

  1. #1
    SitePoint Zealot
    Join Date
    Dec 2004
    Location
    Telford, UK.
    Posts
    149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Passwords

    I'm currently writing a login script which works... great. But I'm going to postnuke and tailor my website around that, however, does anyone know what is the password encryption postnuke uses? Also, how easy/difficult is it to use the login from postnuke site for a session in my web pages?!?! Does that make sense?

  2. #2
    SitePoint Enthusiast
    Join Date
    Nov 2004
    Location
    London
    Posts
    42
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    postnuke uses md5($password)

    Dunno about sharing sessions but it shoudl be pretty easy if you look at the code for any of the pages that currently use the postnuke session

  3. #3
    SitePoint Zealot
    Join Date
    Dec 2004
    Location
    Telford, UK.
    Posts
    149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Nice one thanks.

    How do I use this MD5($password) then? In the same context that I'm using $password ????

  4. #4
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    MD5 is one way encryption. once yo uencrypted the password you cannot decrypt it.
    so, when you store MD5(ed) password in database then next time when user comes in and enters password then you have to MD5 that password and compare it with the password in database. MD5 always generates the same encrypted string for the same string. i mean if

    $string = 'passsword';
    echo MD5($string);//and say it is 123bandasd

    then in future if you again do
    $string = 'passsword';
    echo MD5($string);//then it'll be same as 123bandasd

    so for your passwords you do
    PHP Code:
    $username 'username';
    $password 'enterd by user';
    $md4password=  md5($password);

    //connect to database
    $result mysql_query("select password from table where username='$username'") or die;

    $row mysql_fetch_array($result);
    if(
    $row['password']==$md5password)
    {
      echo 
    'you are authorized';
    }
    else
    {
      echo 
    'you are NOT authorized';

    Hope this might help

  5. #5
    SitePoint Zealot
    Join Date
    Dec 2004
    Location
    Telford, UK.
    Posts
    149
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Brill. Cheers!!

  6. #6
    SitePoint Addict loadx's Avatar
    Join Date
    Jul 2004
    Location
    Melbourne, VIC, Australia
    Posts
    221
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    $md4password=  md5($password); 
    just a small typo..for those copy and paste lovers

    PHP Code:
    $md5password=  md5($password); 


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •