![ישן](https://static.fresh.co.il/images/vBulletin/statusicon/post_old.gif)
10-09-2007, 19:01
|
|
|
חבר מתאריך: 21.01.06
הודעות: 813
|
|
בעיה בעשיית התחברות
זה מה שעשיתי:
קוד PHP:
<html dir=rtl> <style> <!-- A:hover { color:#000000;text-decoration; bold;} --> </style> <style type="text/css"> input { font-family: arial, tahoma; font-size: 9pt; color: black; font-weight: bold; } </style> <style type="text/css"> a { text-decoration: none; font-family: arial, tahoma; font-size: 9pt; font-weight: bold; } </style> <meta http-equiv="Content-Type" content="text/html; charset=windows-1255"> <body link="#959595" vlink="#959595" alink="#959595" bgproperties=fixed> <center> <br><br><br> <br><br> <table width="250" height="140" border="1"> <p dir="center"> <tr><td bgcolor=#575c69><p align="center"><b><font face="Arial" size="2" color="White">שלום אורח, אנא התחבר.</font></p></b> </tr></td><tr><td bgcolor=#eeeeef> <form method="POST"> <center><font face="Arial" size="2"><b>שם משתמש:</font></b> <input type="text" size="12" name="username" onfocus="this.value=''" value="שם משתמש"><Br></center> <center><font face="Arial" size="2"><b>סיסמא:</font></b> <input type='password' size='12' name='userpass' onfocus="this.value=''" value='password'></center> <center><input type='submit' name='submit' value='התחבר'> <a href="register.php">הרשם עכשיו!</a></center> <?php require ("config.php"); echo "<font face=Arial size=2 color=Red>"; $user = $_POST['username']; $pass = $_POST['userpass']; $query = mysql_query ("SELECT * FROM uses WHERE `user_name`='$user' && `user_pass`='$pass' "); $qpass = mysql_query ("SELECT * FROM uses WHERE `user_name`='$user' && `user_pass`!='$pass' "); $quser = mysql_query ("SELECT * FROM uses WHERE `user_name` != '$user' && `user_pass`='$pass' "); $qreg = mysql_query ("SELECT * FROM uses WHERE `user_name` != '$user' && `user_pass`!='$pass' "); $num = mysql_num_rows ($query); $xnum = mysql_num_rows ($qpass); $ynum = mysql_num_rows ($quser); $znum = mysql_num_rows ($qreg); if ( isset ($_POST ['submit'] )) { if ($xnum > 0) echo "סיסמא שגוייה, אנא נסה סיסמא אחרת"; elseif ($ynum > 0) echo "שם משתמש אינו קיים"; elseif ($znum > 0) echo "שם משתמש וסיסמא אינם נכונים"; elseif ($num > 0) { echo "התחברת בהצלחה,"; echo "<b>$user</b>"; } } echo "</font>"; ?> </table></tr></td></p> </center></html>
ובמקום להתחבר נורמלי, ולהגיד "התחברת בהצלחה" זה כותב לי מידי פעם
"שם משתמש לא קיים" ו"שם וסיסמא לא נכונים".
מה עשיתי לא טוב בקוד שהוא לא מתחבר כראוי?
כמובן שבconfig.php יש את ההתחברות למסד, וההרשמה עובדת והכל..
_____________________________________
--- ! Area Close ! ---
|