[PHP] Re: Sessions session_start() my problem
that was a bit confusing, but it looks like you call session_start() more than once in a script. You only need to call it once, and you need to call it before any headers get sent, at the top of the script is a good place. If you're scripts are already setup like that just ignore me. Oh, also, if you include a file that has session_start() in it you'll get that warning too. -- -- Jasper Howard :: Database Administration Velocity7 1.530.470.9292 http://www.Velocity7.com/ -- Pahlevanzadeh Mohsen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Dears,I have 3 files. k.php : ? session_start(); $S_userk=$HTTP_POST_VARS['u']; $S_pass=$HTTP_POST_VARS['p']; //echo $S_pass; session_register('S_userk'); session_register('S_passk'); include 'http://1.1.1.1/membership/login.php?g=0'; ? login.php: define(HOST,localhost); define(USER,root); define(PASS, ); define(DB,mem); /// session_start(); if ($HTTP_GET_VARS['g']==1) { $username=$S_username; $password=$S_password; //print $username; } else if ($HTTP_GET_VARS['g']==0) { $password=$S_passk; $username=$S_userk; } $S_username=$username; $S_password=$password; if(empty($S_username) empty($S_password) ) { mysql_connect(HOST,USER) or die(connect); mysql_select_db(DB) or die(db); $result=mysql_query(SELECT count(*) as numfound FROM usernames where user='$username' and pass='$password') or die(jjjgar); $result_ar=mysql_fetch_array($result); if($result_ar['numfound'] 1 ) { //echo ffdsfsfsdvfdsfdssc; //curl_exec(curl_init('http://1.1.1.1/membership/index.html')); header('Location: index.html'); exit; } session_register('S_username'); session_register('S_password'); echo Logged in successfully!; But when i loggin in my site,I recv following warnings: Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /var/www/html/membership/k.php:2) in /var/www/html/membership/k.php on line 3 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /var/www/html/membership/k.php:2) in /var/www/html/membership/k.php on line 3 Please explaine me on my warnings. Yours,Mohsen. = -DIGITAL SIGNATURE--- ///Mohsen Pahlevanzadeh Network administrator programmer My work phone is : +98216054096-7 My home phone is: +98213810146 My emails is [EMAIL PROTECTED] My website is: http://webnegar.net __ Do you Yahoo!? New and Improved Yahoo! Mail - 100MB free storage! http://promotions.yahoo.com/new_mail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Sessions session_start() my problem
I have deleted session_start() at login.php Thus i have 1 session_start() But i receive them yet. Yours,Mohsen --- Jasper Howard [EMAIL PROTECTED] wrote: that was a bit confusing, but it looks like you call session_start() more than once in a script. You only need to call it once, and you need to call it before any headers get sent, at the top of the script is a good place. If you're scripts are already setup like that just ignore me. Oh, also, if you include a file that has session_start() in it you'll get that warning too. -- -- Jasper Howard :: Database Administration Velocity7 1.530.470.9292 http://www.Velocity7.com/ -- Pahlevanzadeh Mohsen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Dears,I have 3 files. k.php : ? session_start(); $S_userk=$HTTP_POST_VARS['u']; $S_pass=$HTTP_POST_VARS['p']; //echo $S_pass; session_register('S_userk'); session_register('S_passk'); include 'http://1.1.1.1/membership/login.php?g=0'; ? login.php: define(HOST,localhost); define(USER,root); define(PASS, ); define(DB,mem); /// session_start(); if ($HTTP_GET_VARS['g']==1) { $username=$S_username; $password=$S_password; //print $username; } else if ($HTTP_GET_VARS['g']==0) { $password=$S_passk; $username=$S_userk; } $S_username=$username; $S_password=$password; if(empty($S_username) empty($S_password) ) { mysql_connect(HOST,USER) or die(connect); mysql_select_db(DB) or die(db); $result=mysql_query(SELECT count(*) as numfound FROM usernames where user='$username' and pass='$password') or die(jjjgar); $result_ar=mysql_fetch_array($result); if($result_ar['numfound'] 1 ) { //echo ffdsfsfsdvfdsfdssc; //curl_exec(curl_init('http://1.1.1.1/membership/index.html')); header('Location: index.html'); exit; } session_register('S_username'); session_register('S_password'); echo Logged in successfully!; But when i loggin in my site,I recv following warnings: Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /var/www/html/membership/k.php:2) in /var/www/html/membership/k.php on line 3 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /var/www/html/membership/k.php:2) in /var/www/html/membership/k.php on line 3 Please explaine me on my warnings. Yours,Mohsen. = -DIGITAL SIGNATURE--- ///Mohsen Pahlevanzadeh Network administrator programmer My work phone is : +98216054096-7 My home phone is: +98213810146 My emails is [EMAIL PROTECTED] My website is: http://webnegar.net __ Do you Yahoo!? New and Improved Yahoo! Mail - 100MB free storage! http://promotions.yahoo.com/new_mail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = -DIGITAL SIGNATURE--- ///Mohsen Pahlevanzadeh Network administrator programmer My home phone is: +98213810146 My email address is m_pahlevanzadeh at yahoo dot com My website is: http://webnegar.net __ Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! http://promotions.yahoo.com/new_mail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Sessions session_start() my problem
is this php script at the top of the page, there is nothing before it? -- -- Jasper Howard :: Database Administration Velocity7 1.530.470.9292 http://www.Velocity7.com/ -- Pahlevanzadeh Mohsen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have deleted session_start() at login.php Thus i have 1 session_start() But i receive them yet. Yours,Mohsen --- Jasper Howard [EMAIL PROTECTED] wrote: that was a bit confusing, but it looks like you call session_start() more than once in a script. You only need to call it once, and you need to call it before any headers get sent, at the top of the script is a good place. If you're scripts are already setup like that just ignore me. Oh, also, if you include a file that has session_start() in it you'll get that warning too. -- -- Jasper Howard :: Database Administration Velocity7 1.530.470.9292 http://www.Velocity7.com/ -- Pahlevanzadeh Mohsen [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Dears,I have 3 files. k.php : ? session_start(); $S_userk=$HTTP_POST_VARS['u']; $S_pass=$HTTP_POST_VARS['p']; //echo $S_pass; session_register('S_userk'); session_register('S_passk'); include 'http://1.1.1.1/membership/login.php?g=0'; ? login.php: define(HOST,localhost); define(USER,root); define(PASS, ); define(DB,mem); /// session_start(); if ($HTTP_GET_VARS['g']==1) { $username=$S_username; $password=$S_password; //print $username; } else if ($HTTP_GET_VARS['g']==0) { $password=$S_passk; $username=$S_userk; } $S_username=$username; $S_password=$password; if(empty($S_username) empty($S_password) ) { mysql_connect(HOST,USER) or die(connect); mysql_select_db(DB) or die(db); $result=mysql_query(SELECT count(*) as numfound FROM usernames where user='$username' and pass='$password') or die(jjjgar); $result_ar=mysql_fetch_array($result); if($result_ar['numfound'] 1 ) { //echo ffdsfsfsdvfdsfdssc; //curl_exec(curl_init('http://1.1.1.1/membership/index.html')); header('Location: index.html'); exit; } session_register('S_username'); session_register('S_password'); echo Logged in successfully!; But when i loggin in my site,I recv following warnings: Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /var/www/html/membership/k.php:2) in /var/www/html/membership/k.php on line 3 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /var/www/html/membership/k.php:2) in /var/www/html/membership/k.php on line 3 Please explaine me on my warnings. Yours,Mohsen. = -DIGITAL SIGNATURE--- ///Mohsen Pahlevanzadeh Network administrator programmer My work phone is : +98216054096-7 My home phone is: +98213810146 My emails is [EMAIL PROTECTED] My website is: http://webnegar.net __ Do you Yahoo!? New and Improved Yahoo! Mail - 100MB free storage! http://promotions.yahoo.com/new_mail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php = -DIGITAL SIGNATURE--- ///Mohsen Pahlevanzadeh Network administrator programmer My home phone is: +98213810146 My email address is m_pahlevanzadeh at yahoo dot com My website is: http://webnegar.net __ Do you Yahoo!? New and Improved Yahoo! Mail - Send 10MB messages! http://promotions.yahoo.com/new_mail -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php