PHP קוד:
<?php
require('db.php');
echo "
<html>
<head>
<title>שלום</title>
<style type='text/css'>
<!--
body { background-color: #000000; }
body,td,th {
font-family: Tahoma, Helvetica, sans-serif;
font-size: 14px; color:#FFFFFF;
border: 1px;
}
-->
</style>
</head>
<body dir='rtl'>
<table align='right' border='0' dir='rtl'>";
function die_form($err) {
print "<caption align=\"center\">התחברות למערכת</caption>";
if(!empty($err)) {
print " <tr>
<td align=\"right\" width=\"100%\" colspan=\"2\">".$err."</td></tr>";
}
$agree = mysql_real_escape_string($_POST['agree']);
print "<form action=\"".$PHP_SELF."\" method=\"POST\">
<tr>
<td align=\"right\" width=\"30%\" height=\"40%\"><span class=\"text007\">שם משתמש:</span></td>
<td align=\"right\" width=\"70%\" height=\"40%\"><input type=\"text\" name=\"username\" witdh=\"100%\" height=\"100%\""; if(isset($_COOKIE["username"])) { print " value=\"".$_COOKIE["username"]."\""; } print ">
<label for=\"checkbox\">
<input type=\"checkbox\" id=\"checkbox\" name=\"agree\" value=\"CHECKED\" $agree>
התחבר אוטומטית בכניסה הבאה?
</label>
</td>
</tr>
<tr>
<td align=\"right\" width=\"30%\" height=\"40%\" class=\"text007\">סיסמא:</td>
<td align=\"right\" width=\"70%\" height=\"40%\"><input type=\"password\" name=\"password\" witdh=\"100%\" height=\"100%\"></td>
</tr>
<tr>
<td align=\"center\" width=\"100%\" height=\"25%\" colspan=\"2\"><input type=\"submit\" name=\"submit\" value=\"התחבר\" style=\"border:1px solid; background-color:#ffffff;\"><input type=\"reset\" value=\"נקה\" style=\"border:1px solid; background-color:#ffffff;\"></td>
</tr>
</form>";
}
if(isset($_POST['submit'])) {
$con_pass = md5($_POST['password']);
$result = mysql_query("Select * from `users` WHERE `username`='".$_POST['username']."' AND `password`='".$con_pass."'",$link);
$rows = mysql_num_rows($result);
if($rows == 0) {
die_form("שם משתמש או סיסמא שגויים");
}
else {
$a_row = mysql_fetch_object($result);
$_SESSION["username"] = $a_row->username;
$_SESSION["password"] = $a_row->password;
if($_POST['agree'] == "CHECKED") {
setcookie("user","Lior:123",time()+3600*24*7);
echo "מחובר אוטומטית";
}
echo "<br>מחובר רגיל";
}
}
else {
die_form("");
}
echo "
</table>
</body>
</html>";
?>
שגיאה שאני מקבל שאני מסמן את ה-checkbox:
קוד:
Warning: Cannot modify header information - headers already sent by (output started at /home/lior19901/domains/djelmix.www3.co.il/public_html/site/11.php:22) in /home/lior19901/domains/djelmix.www3.co.il/public_html/site/11.php on line 64