اجرا نشدن تابع header

[FONT=&quot]من يك اسكريپت براي ثبت نام نوشتم وتوي اون چند تا كوكي تنظيم كردم توي هاست مجازي برنامه درست كار مي كنه ولي وقتي تو هاست واقعي آپلود مي كنم به تابع [/FONT]HEADER[FONT=&quot]وهمه كوكيها ايراد مي گيره واين خط اسكريپت كه تابع[/FONT]HEADER [FONT=&quot]وكوكي داره اجرا نميشه[/FONT]
کد:
[B]Warning[/B]: Cannot modify header information - headers already sent by (output started at /home/ecair/public_html/partshop/partshop/save.php:4) in [B]/home/ecair/public_html/partshop/partshop/save.php[/B] on line [B]102[/B]
 

EMIRATES

Active Member
با سلام

شاید شما قبلش از Header با جاوا استفاده کرده باشید.

اگه میشه سورسشو بذارید تا بهتر راهنمایی کنم.

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

امینویا - اسپم نده لطفا

با تشکر.
 

aminoia

Member
ببخشید !!!
باور کنید نه من بچه ی بدی هستم و نه قصد اذیت داشتم
فقط :sad:...
 
اينم يه صفحه اين هدر توش كار نمي كنه
PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<body >
<?php
//================================
$user_name=trim($_POST[user_name]);
$pass2=trim($_POST[pass]);
//==============================
$host_name="localhost";$user="************";$password="************";
$db_name="************";
$table_name="member";
//==============================
$mycon = mysql_connect($host_name ,$user ,$password);  
if($mycon){
        $sb=mysql_select_db($db_name,$mycon);    
            $sql="SELECT * FROM $table_name WHERE user_name='$user_name'AND pass='$pass2'";
             //print "$sql<br>";    
            $result=@mysql_query($sql,$mycon) or die(mysql_error());
            $num=@mysql_num_rows($result);
            //print "$num<br>";
            if($num != 0){  
           session_start();
          $_SESSION[user]=$user_name;
  $_SESSION[pass]=$pass;                             
                    header("location:sell.php");
                 exit;
   
            }
            else{
                    
                     header("location:sabt.php");
                    exit;
            }

}
else{    
    print("Connection Failed! ");
    }

?>
</body>
</html>
 

ziXet

مدیر انجمن PHP/MYSQL
اينم يه صفحه اين هدر توش كار نمي كنه
PHP:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<body >
<?php
//================================
$user_name=trim($_POST[user_name]);
$pass2=trim($_POST[pass]);
//==============================
$host_name="localhost";$user="************";$password="************";
$db_name="************";
$table_name="member";
//==============================
$mycon = mysql_connect($host_name ,$user ,$password);  
if($mycon){
        $sb=mysql_select_db($db_name,$mycon);    
            $sql="SELECT * FROM $table_name WHERE user_name='$user_name'AND pass='$pass2'";
             //print "$sql<br>";    
            $result=@mysql_query($sql,$mycon) or die(mysql_error());
            $num=@mysql_num_rows($result);
            //print "$num<br>";
            if($num != 0){  
           session_start();
          $_SESSION[user]=$user_name;
  $_SESSION[pass]=$pass;                             
                    header("location:sell.php");
                 exit;
   
            }
            else{
                    
                     header("location:sabt.php");
                    exit;
            }

}
else{    
    print("Connection Failed! ");
    }

?>
</body>
</html>
سلام

همانطور که بچه ها گفتن شما نباید قبل از header چیزی به مرورگر بفرستی!
شما باید اینا رو بعد از header به مرورگر بفرستی:
کد:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<body >
 
آخرین ویرایش:

جدیدترین ارسال ها

بالا