Re: Sessions & session_start() & my problem
| From: | Jasper Howard | Date: | Fri, 27 Aug 2004 21:38:29 +0000 |
| Subject: | Re: Sessions & session_start() & my problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-194966@lists.php.net to get a copy of this message | ||
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" <m_pahlevanzadeh@yahoo.com> wrote in message
news:20040827212012.67593.qmail@web21424.mail.yahoo.com...
> 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("jjjjjjjgar");
>
>
> $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
> m_pahlevanzadeh@yahoo.com
> My website is: http://webnegar.net
> ----------------------------------------------------------------
>
>
>
>
> __________________________________
> Do you Yahoo!?
> New and Improved Yahoo! Mail - 100MB free storage!
> http://promotions.yahoo.com/new_mail
>