Syntax error when using Password function in php and mysql

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sharmilah
    New Member
    • Jun 2007
    • 20

    Syntax error when using Password function in php and mysql

    I have the following code in my script and it's giving a syntax error at line *** when using the password function. My password in the mysql database is encrypted using the password function itself and I want to verify the input password against my database password. PLEASE HELP

    [code=php]
    if (isset($_POST["password"])) $password = @$_POST["password"];


    if (($login != "") && ($password != "")) {
    $conn = mysql_connect(" localhost", "root", "root");
    mysql_select_db ("bnk_guarantee ");
    $sql = "select `Usr_Passwd` from `user` where `Usr_Login` = '" .$login ."' and `Usr_Status` = 'Active' ";
    $res = mysql_query($sq l, $conn) or die(mysql_error ());
    $row = mysql_fetch_ass oc($res) or $row = array(0 => "");;
    if (isset($row)) reset($row);
    *** $pass =password($pass word);
    if (isset($passwor d) && ($pass == trim(current($r ow)))) {
    $_SESSION["logged_in"] = true;
    [/code]

    [Please use CODE tags when posting source code. Thanks! --pbmods]
  • epots9
    Recognized Expert Top Contributor
    • May 2007
    • 1352

    #2
    where is your password function?

    Comment

    • pbmods
      Recognized Expert Expert
      • Apr 2007
      • 5821

      #3
      There is no PHP password function. Try using sha1 or md5 instead.

      [EDIT: Similar functions also exist in MySQL: http://dev.mysql.com/doc/refman/5.0/...functions.html]

      Comment

      Working...