View Single Post
ישן 07-07-08, 18:06   # 1
lior19901
חבר בקהילה
 
lior19901's Avatar
 
מיני פרופיל
תאריך הצטרפות: Oct 2005
גיל: 34
הודעות: 257

lior19901 לא מחובר  

בעיה בעוגיה (cookie)

למה זה לא יוצר לי את ה cookie ברגע שמסמנים את ה checkbox הוא צריך ליוצר לי את ה cookie
הוא מעביר אותי לדף שהגדרתי לו ברגע שמסמנים את checkbox אבל זה לא יוצר לי cookie

PHP קוד:
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;
    
$agree mysql_real_escape_string($_POST['agree']);
                if (
$agree == CHECKED) {
                
setcookie("cookie","Lior:123456",time()+3600*24*7);
    print 
"<script>location.href='index.php?profile=edit_profile';</script>";
    }
    print 
"<script>location.href='index.php';</script>";
    }

מה הבעיה?
__________________

Last edited by lior19901; 07-07-08 at 18:48..
  Reply With Quote