SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Nov 2005
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Phakt login with md5

    Hi I am trying to build a login with dreamweaver amd phakt using the tables in phpbb where the password is in md5 can anybody help here is my code

    // *** Start the session
    session_start();
    // *** Validate request to log in to this site.
    $KT_LoginAction = $_SERVER["REQUEST_URI"];
    if (isset($_POST["textfield"])) {
    $KT_valUsername = $_POST['textfield'];
    $KT_fldUserAuthorization = "";
    $KT_redirectLoginSuccess = "index.php";
    $KT_redirectLoginFailed = "test.php";
    $KT_rsUser_Source = "SELECT username, user_password ";
    if ($KT_fldUserAuthorization != "") $KT_rsUser_Source .= "," . $KT_fldUserAuthorization;
    $KT_rsUser_Source .= " FROM phpbb_users WHERE username='" . $KT_valUsername . "' AND user_password='" . $_POST['textfield'] . "'";
    $KT_rsUser=$wgt->Execute($KT_rsUser_Source) or DIE($wgt->ErrorMsg());
    if (!$KT_rsUser->EOF) {
    // username and password match - this is a valid user
    $KT_Username=$KT_valUsername;

    KT_session_register("KT_Username");
    if ($KT_fldUserAuthorization != "") {
    $KT_userAuth=$KT_rsUser->Fields($KT_fldUserAuthorization);
    } else {
    $KT_userAuth="";
    }

    KT_session_register("KT_userAuth");
    if (isset($_GET['accessdenied']) && false) {
    $KT_redirectLoginSuccess = $_GET['accessdenied'];
    }
    $KT_rsUser->Close();

    KT_session_register("kt_login_failed");
    $kt_login_failed = false;
    // Add code here if you want to do something if login succeded

    KT_redir($KT_redirectLoginSuccess);
    }
    $KT_rsUser->Close();
    $kt_login_failed = true;

    KT_session_register("kt_login_failed");
    // Add code here if you want to do something if login fails

    KT_redir($KT_redirectLoginFailed);
    }
    //PHP ADODB document - made with PHAkt 3.5.1?>



    Thanks

    Peter

  2. #2
    Sell crazy someplace else markl999's Avatar
    Join Date
    Aug 2003
    Location
    Manchester, UK
    Posts
    4,007
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If the passwords are MD5 in the db then you should just need to change:
    user_password='" . $_POST['textfield'] . "'";
    to:
    user_password='" . md5($_POST['textfield']) . "'";

  3. #3
    SitePoint Member
    Join Date
    Nov 2005
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks it works i tried that before but dreamweaver says it lose the connection but it works


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
  •