הרשם שאלות ותשובות רשימת חברים לוח שנה הודעות מהיום

חזור   הוסטס - פורום אחסון האתרים הגדול בישראל > עיצוב גראפי, תכנות על כל שפותיו וקידום ושיווק אתרים > פורום תיכנות

   
|!|

השב
 
כלים לאשכול תצורת הצגה
ישן 07-07-08, 18:06   # 1
lior19901
חבר בקהילה
 
lior19901's Avatar
 
מיני פרופיל
תאריך הצטרפות: Oct 2005
גיל: 33
הודעות: 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
ישן 07-07-08, 18:31   # 2
Daniel
אחראי פורום
 
מיני פרופיל
תאריך הצטרפות: Mar 2007
הודעות: 2,875

Daniel לא מחובר  

מהההההההההה לאאאאאאאאאאא עובד..

מה לא עובד.

למה כשאני שותה תה זה לא עובד לי? למה?

-----------------------------------------------------------

השגיאה היא בדיוק, ללא עוררין, בשורה הזאת
[php] if ($agree == CHECKED) { [/php

והיא לא זה:

PHP קוד:
                if ($agree == 
והיא לא זה:

PHP קוד:
) { 
...

Last edited by Daniel; 07-07-08 at 19:06..
  Reply With Quote
ישן 07-07-08, 19:20   # 3
lior19901
חבר בקהילה
 
lior19901's Avatar
 
מיני פרופיל
תאריך הצטרפות: Oct 2005
גיל: 33
הודעות: 257

lior19901 לא מחובר  

זה מעביר אותי לדף
index.php?profile=edit_profile
אז זה לא הבעיה
עם זה לא היה טוב לא היה מעביר אותי לדף הזה
__________________
  Reply With Quote
ישן 07-07-08, 19:22   # 4
BlueNosE
אין כמו ב127.0.0.1
 
BlueNosE's Avatar
 
מיני פרופיל
תאריך הצטרפות: Oct 2005
מיקום: כפ"ס
גיל: 31
הודעות: 4,086

BlueNosE לא מחובר  

מה שדניאל מנסה לומר, זה שאתה מנסה להשוות את $agreed לSTRING, וזו לא הדרך לבדוק.

ד"א, אם היית שם ERROR_REPORTING, היית רואה שגיאה שאומרת שאתה צריך לשים גרשיים ושהשפה מתעלמת.
__________________
עומר,
admin [@] rely.co.il

בניית אתרים Rely

סלנג מילון סלנג utter
  Reply With Quote
ישן 07-07-08, 19:44   # 5
lior19901
חבר בקהילה
 
lior19901's Avatar
 
מיני פרופיל
תאריך הצטרפות: Oct 2005
גיל: 33
הודעות: 257

lior19901 לא מחובר  

אז מה לעשות כדי שיוצר לי תעוגיה?
__________________

Last edited by lior19901; 07-07-08 at 19:50..
  Reply With Quote
ישן 07-07-08, 21:09   # 6
AlmogBaku
חבר וותיק
 
AlmogBaku's Avatar
 
מיני פרופיל
תאריך הצטרפות: Nov 2007
מיקום: מודיעין
הודעות: 1,022

AlmogBaku לא מחובר  

לא צריך להיות גאון
PHP קוד:
if($_POST['remember'] == "on"
  Reply With Quote
ישן 07-07-08, 21:17   # 7
lior19901
חבר בקהילה
 
lior19901's Avatar
 
מיני פרופיל
תאריך הצטרפות: Oct 2005
גיל: 33
הודעות: 257

lior19901 לא מחובר  

כן עשיתי אבל זה לא עוזר לי זה לא יוצר לי את ה cookie
__________________
  Reply With Quote
ישן 07-07-08, 21:18   # 8
AlmogBaku
חבר וותיק
 
AlmogBaku's Avatar
 
מיני פרופיל
תאריך הצטרפות: Nov 2007
מיקום: מודיעין
הודעות: 1,022

AlmogBaku לא מחובר  

אז תן לנו את הקוד אחרי השינויים..
  Reply With Quote
ישן 07-07-08, 21:23   # 9
lior19901
חבר בקהילה
 
lior19901's Avatar
 
מיני פרופיל
תאריך הצטרפות: Oct 2005
גיל: 33
הודעות: 257

lior19901 לא מחובר  

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
__________________

Last edited by lior19901; 07-07-08 at 22:04..
  Reply With Quote
ישן 07-07-08, 22:55   # 10
BlueNosE
אין כמו ב127.0.0.1
 
BlueNosE's Avatar
 
מיני פרופיל
תאריך הצטרפות: Oct 2005
מיקום: כפ"ס
גיל: 31
הודעות: 4,086

BlueNosE לא מחובר  

שים אחרי הPHP
ob_start();

אפילו אין לי כוח להסביר לך למה.
__________________
עומר,
admin [@] rely.co.il

בניית אתרים Rely

סלנג מילון סלנג utter
  Reply With Quote
השב

חברים פעילים הצופים באשכול זה: 1 (0 חברים ו- 1 אורחים)
 


חוקי פירסום
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is מופעל
סמיילים הם מופעל
[IMG] קוד מופעל
קוד HTML מכובה

קפיצה לפורום


כל הזמנים הם GMT +2. הזמן כעת הוא 09:41.

מופעל באמצעות VBulletin גרסה 3.8.6
כל הזכויות שמורות ©
כל הזכויות שמורות לסולל יבוא ורשתות (1997) בע"מ