Em sửa đi sửa lại và giờ nó bị dính 1 lỗi lúc login được lúc lại không, chưa hiểu lý do như thế nào cả, em đưa lên diễn đàn các anh chị cùng bạn bè lập trình xem giúp nhé
Hoặc tải file đính kèmPHP Code:
<?phpif (isset($_POST['Submit'])){ if (isset($_POST['txtUsername'])) $admin_user=$_POST['txtUsername']; else $admin_user=''; if (isset($_POST['txtPassword'])) $admin_pass=$_POST['txtPassword']; else $admin_pass=''; $admin_user = str_replace("\'","",$admin_user); $admin_pass = md5(str_replace("\'","",$admin_pass)); { $result = $DB -> query("SELECT * FROM `shoppc_admin` WHERE `admin_user` = '$admin_user' AND `admin_password` = '$admin_pass'"); if ($DB -> num_rows($result) != 0) { $_SESSION['id'] = $admin_sec; $_SESSION['lock'] = TRUE; $ok = true; @header("Location: ?a=welcome"); echo "<br>Logining... !!! <META http-equiv=refresh content=\"1; URL=?a=welcome\">"; } else echo "Press back pls"; }} // Neu logoutif ($_GET['a'] =='logout') { session_unregister("lock"); $_SESSION['user_id'] = ""; session_destroy(); @header("Location: ?a=out"); echo "<br>Logouting... !!! <META http-equiv=refresh content=\"1; URL=?a=out\">";}
if (!$ok) {?><form action="" method="post"><table width="250" height="150" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td colspan="2" align="center"><font color="red"> </font></td> </tr> <tr> <td width="40%" align="right">Username : </td> <td width="60%" align="left"><input name="txtUsername" type="text" id="txtUsername" size="25" maxlength="50"></td> </tr> <tr> <td align="right">Password : </td> <td align="left"><input name="txtPassword" type="password" id="txtPassword" size="25" maxlength="100"></td> </tr> <tr> <td colspan="2"><div align="center"> <input type="submit" name="Submit" value="Login"> <input type="reset" name="Submit2"> </div></td> </tr></table></form> <?php } ?>
Cám ơn mọi người!!!!!!!!!!!!!!
Bookmarks