Re: insert md5 password

From: Date: Fri, 29 Sep 2006 11:48:24 +0000
Subject: Re: insert md5 password
Groups: php.windows 
Request: Send a blank email to php-windows+get-27191@lists.php.net to get a copy of this message
The relevant PHP code looks like :-
    $Surname = strip_tags($_POST['Surname']);
    $FirstName = strip_tags($_POST['FirstName']);
    $uname = strip_tags($_POST['uname']);
    $passwd = strip_tags($_POST['passwd']);
    $accesslevel = strip_tags($_POST['accesslevel']);
    $passwd = md5($passwd);
// echo "<br>get_magic_quotes";
    if (!get_magic_quotes_gpc())
        {
        $_POST['passwd'] = addslashes($_POST['passwd']);
        }
    $regdate = date('Y/m/d H:i:s');
// echo "<br>Prepare";
    $insert = sprintf("INSERT INTO Users (FirstName, LastName, Usrname, Passwrd, AccessLevel, last_login, UserID)
                        VALUES ('%s', '%s', '%s', \"0x%s\", '%d', '%s', '%d')",
                            $FirstName, $Surname, $uname, $passwd, $accesslevel, $regdate, $_SESSION['UID']);
    $Reply = mssql_query($insert, $link);
echo "<br>".$insert;
    if ($Reply == FALSE)
        {
echo "<br> Error in Insert"; echo "<br>".get_sql_error($link)."<br>";
        $Message = sprintf("%s %d <br>Record not inserted. Please refer problem to Admin.", __FILE__, __LINE__);
        trigger_error($Message, E_USER_ERROR, $link);
        exit;
        }
    DBDisConnect();
    header("location: index.shtml");
    exit;
?>

« previous php.windows (#27191) next »