ציטוט:
נכתב במקור על ידי WebProject
קודם כל - תאבטח את הנתונים שאתה מקבל מהגולשים.
ובדקת בshow cookies בFF שהעוגיות לא קיימות?
|
אכן.
הקוד המאובטח:
PHP קוד:
<?
ob_start();
include "global/global.php";
echo '<center><meta http-equiv="Content-Type" content="text/html; charset=windows-1255">';
$submit = $_POST['submit'];
$username = $_POST['username'];
$password = $_POST['password'];
$username = htmlspecialchars($username, ENT_QUOTES);
$password = htmlspecialchars($password, ENT_QUOTES);
if($submit) {
$sql = " SELECT * FROM members WHERE username = '$username' AND password = '$password' ";
$result = mysql_query($sql) or die("בעייה : " . mysql_error());
if(!mysql_num_rows($result)) {
echo "אחד מהשדות שהזנת שגויים, נא חזור ובדוק שנית";
exit();
}
setcookie("user", $username,time() + 3600);
setcookie("pw", $password, time() + 3600);
setcookie("access", $access, time() + 3600);
echo "<meta http-equiv='refresh' content='0; url=index.php'>";
}
ob_end_flush();
?>