Page 1 of 1

Can't keep session continuous between all pages using php

Posted: Sun Jun 22, 2014 10:59 am
by rammohan518
I have created a session in php where users log in and their data is transferred in all the pages.it looks like this

Code: Select all

<?php ob_start();
session_start();
error_reporting(0);
$_SESSION['url'] = $_SERVER['REQUEST_URI'];
include 'cw-config.php';
if($_SESSION[userid]!='')
{
$details=mysql_fetch_array(mysql_query("select * from register where guid='$_SESSION[userid]'"));
}
?>
It works on all pages except on this one even though i wrote the code in same manner as above one.it looks like this

Code: Select all

<?php ob_start();
session_start();
error_reporting(0);
include 'cw-config.php';
extract($_POST);
extract($_GET);
$_SESSION['url'] = $_SERVER['REQUEST_URI'];

if($_SESSION[userid]!=''){ 
$details=mysql_fetch_array(mysql_query("select * from register where guid='".$_SESSION["userid"]."'"));
}
$shopdata=mysql_fetch_array(mysql_query("select * from shop where guid='$shopid'"));
?>
Kindly visit:http://rewardsinn.com the problem is with categories/stores when selected from dropdown menu the session isn't getting transferred I am new to this coding and had redo everything as we were cheated by a designer.it was working fine till yesterday.Kindly help me in this.Once sign in and check to know the problem.

Re: Can't keep session continuous between all pages using ph

Posted: Sun Jun 22, 2014 11:15 am
by Celauran
What's the problem? Anything in your error logs?

Re: Can't keep session continuous between all pages using ph

Posted: Sun Jun 22, 2014 11:20 am
by rammohan518
Kindly visit rewardsinn.com
sign in with fb,a session is created with ur user name and select any item from categories or stores it shows no session.whereas if u click on all the other menu items it shows session even though i am using the same code as above

Re: Can't keep session continuous between all pages using ph

Posted: Sun Jun 22, 2014 11:31 am
by Celauran
rammohan518 wrote:Kindly visit rewardsinn.com
sign in with fb
Not going to happen.
rammohan518 wrote:a session is created with ur user name and select any item from categories or stores it shows no session.whereas if u click on all the other menu items it shows session even though i am using the same code as above
I'd recommend turning error reporting back on, at least in a development environment, and see what errors are being displayed/logged. That should give you some indication as to what's going wrong and where. Sessions need to be initiated before headers are sent, so before any output is sent to the browser, and just whitespace has been known to cause problems.

Re: Can't keep session continuous between all pages using ph

Posted: Sun Jun 22, 2014 11:35 am
by rammohan518
u can also register with any fake id and check..i am new to development so help me..just give any false email...no verification is present is website..requesting so that u will understand my problem..
and regarding what u said should put session start before everything(ob report)