הוסטס - פורום אחסון האתרים הגדול בישראל

הוסטס - פורום אחסון האתרים הגדול בישראל (https://hosts.co.il/forums/index.php)
-   פורום תיכנות (https://hosts.co.il/forums/forumdisplay.php?f=14)
-   -   בעיה | לא מצליח ליצור עוגייה (https://hosts.co.il/forums/showthread.php?t=70928)

bilopay 07-01-09 20:08

בעיה | לא מצליח ליצור עוגייה
 
בטופס הרשמה זה מצליח ליצור לי עוגייה אבל בעמוד התחברות זה שאני מנסה להיתחבר זה נותן לי שגיעה

קוד php:
PHP קוד:

<?
if (!isset($_POST['login_submit']))
{}
else
{
$username htmlspecialchars$_POST['username'] ) ;
$password htmlspecialchars$_POST['password'] ) ;
if (!empty(
$_POST['username']) && !empty($_POST['password']))
{
$link mysql_connect('localhost' 'root' '') or die('Mysql Error: ' mysql_error());  
mysql_select_db('funni' $link) or die('Mysql Error: ' mysql_error());  
  
$query  "SELECT * FROM user WHERE username='$username' && password='$password'" 
$Result mysql_query($query) or die('Mysql Error: ' mysql_error()); 
$N mysql_num_rows($Result);
if(
$N === false
die(
'Mysql Error: ' mysql_error()); 
if (
$N 1
    {
$erorlogin='שם משתמש או סיסמה לא נכונים';
}
else
{

setcookie("funniuser","$username",time()+31536000); 
setcookie("funnipassword","$password",time()+31536000); 
}
}
else
{
$erorlogin='שם משתמש או סיסמה לא נכונים';
}}
?>

השגיעה:
PHP קוד:

WarningCannot modify header information headers already sent by (output started at c:wampwwwfunniindex.php:2in c:wampwwwfunniindex.php on line 25

Warning
Cannot modify header information headers already sent by (output started at c:wampwwwfunniindex.php:2in c:wampwwwfunniindex.php on line 26 


Speed 07-01-09 21:04

תשתמש באלה:
ob_start
ob_end_flush

ob_start(); בתחילת הקוד וob_end_flush(); בסופו.

SniR-S 07-01-09 21:56

PHP קוד:

setcookie("funniuser","$username",time()+31536000);  
setcookie("funnipassword","$password",time()+31536000); 

צריך להיות לפני headers (נסה, אולי בגלל זה)


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

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