Re: Session problems [SOLVED]

From: Date: Wed, 13 Jul 2005 12:42:28 +0000
Subject: Re: Session problems [SOLVED]
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-218613@lists.php.net to get a copy of this message
Well after a bit of tweaking of my script I realized it was not the code that was causing the problem. It was a php.ini setting, I run a few virtual hosts on my webserver and it turned out to be the session.referer_check was set to 0, modify this to equal session.referer_check = and it worked fine after a restart of the webserver. Hope this helps someone else. Jason wrote: > I am having a problem with sessions. For some reason it keeps creating > a new session for every page link you click and not using the original > session created when session_start() gets called. Below is the code I > am testing with. > > [one.php] > <?php > > $SessionID = md5( uniqid( rand () ) ); > > session_start(); > > if( ( !session_is_registered( 'hash' ) ) || ( $_SESSION['hash'] != > $_SESSION['chkhash'] ) ) { > session_name( 'prostarinventory' ); > session_register( 'hash' ); > session_register( 'chkhash' ); > session_register( 'count' ); > $_SESSION['hash'] = $SessionID; > $_SESSION['chkhash'] = $SessionID; > $_SESSION['count'] = 1; > } else { > $_SESSION['count']++; > } > > print_r( $_SESSION ); > > ?> > [/one.php] > [test1.php] > <?PHP > include 'one.php'; > print_r( $_SESSION ); > ?> > <form action="test.php" method="post"><input name="test" > type="text"><input name="" type="submit"></form> > [/test1.php] > > [test.php] > <?php > include 'one.php'; > echo "SESSIONS: "; > print_r( $_SESSION ); > echo "<BR>POSTS: "; > print_r( $_POST ); > echo "<BR>GETS: "; > print_r( $_GET ); > ?> > [/test.php] > > Any help is appreciated, so far I have found that if I use the > include_once 'one.php'; and simply refresh the page sessions work fine, > but if you call the test1.php then submit the form the session variables > aren't found in the old session and a new one is being created on the > server. > -- Jason Gerfen Student Computing Marriott Library 801.585.9810 jason.gerfen@scl.utah.edu "In my opinion anyone interested in improving themselves should not rule out becoming pure energy." ~Jack Handley, The New Mexican, 1988.

« previous php.general (#218613) next »