אשכול: בעיה ב-md5
View Single Post
ישן 17-06-09, 00:12   # 1
Jonathan Zeierman
חבר וותיק
 
מיני פרופיל
תאריך הצטרפות: Jun 2007
הודעות: 1,003

Jonathan Zeierman לא מחובר  

בעיה ב-md5

שלום לכולם.
אני מנסה לעשות התחברות עם סיסמא מוצפנת ב-md5.
אך משום מה הקוד בעיקרון לא עובד אין שגיאות אין כלום רק כשאני עושה התחבר הוא מרענן לי את דף ההתחברות.
מה הבעיה בקוד שלי?
PHP קוד:
    if (isset($_POST["send"]))
   {
      
//////////////////////////////////////////////////////////////////
      // If user & pass are right, create session and login. ///////////
      //////////////////////////////////////////////////////////////////
         
$query "SELECT * FROM users WHERE user = '{$user}' AND password =  '{$pass}'";
         
$result mysql_query($query)
         or die(
"SQL Getting The Next Error:" mysql_error());
         
         
$user $_POST["user"];
         
$pass md5($_POST["pass"]);
         
         while (
$row mysql_fetch_assoc($result))
         {
         
            if (
$row["user"] == $user && $row["password"] == $pass)
            {
               
               
$_SESSION["user"] = $user;
               
$_SESSION["pass"] = $pass;
               
header("Location: manage.php?act=Admin");
            }
         
               
///////////////////////////////////////////////////////////////////
               // If user & pass worng, show us an erroe msseage.  ///////////////
               ///////////////////////////////////////////////////////////////////
               
if ($row["user"] != $user && $row["password"] != $pass)
               {
                  echo 
'<html dir="rtl">
                  <head>
                  <link rel="stylesheet" type="text/css" href="includes/css/style.css" media="screen"/>
                  <meta http-equiv="Content-Language" content="he">
                  <meta http-equiv="Content-Type" content="text/html; charset=windows-1255">
                  <title>שגיאה</title>
                  </head>
                  <body>
                  <center>
                     <div class="error" style="width:350px" align="right">
                  <table cellpadding="6" cellspacing="2" width="100%">
                  <tr>
                  <td>
                  <img src="images/error.gif" /> <b>שגיאה:</b> שם משתמש ו/או סיסמה שגויים.</td>
                  </tr>
                  </table>
                  </div><div class="space"></div>
                  </center>
                  </body>
                  </html>'
;
               }
         }
    }
//////////////////////////////////////////////////////////////////
?> 
המסד נתונים שלי נראה ככה:
http://www.mup.co.il/img.php?f=84a14aa975ed.jpg
הסיסמא היא 2 אם תלכו ל- hashfinder תגלו שהסיסמא היא 2.
תודה לעוזרים.
__________________
יונתן.
אימייל: jonathan@zeierman.net
  Reply With Quote