Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

Problem using sessions

session

  • Please log in to reply
5 replies to this topic

#1 Alhazred

Alhazred

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 133 posts

Posted 19 March 2009 - 07:04 AM

I'm trying to write an application and I need to have some variables available on several pages, so I've thought to put them into the session.
Well, I couldn't do that so I've tried a simple script like this
<?php
$started = session_start();

if($started)
   print "session started";
else
   print "session not started";
?>
the result is always "session not started".
I'm using a XAMPP platform, may that be caused because of register_globals set to off or because of any other reason?
  • 0

#2 amrosama

amrosama

    CC Mentor

  • VIP Member
  • PipPipPipPipPipPipPipPip
  • 2765 posts

Posted 19 March 2009 - 07:10 AM

make sure your phpinfo() looks like thin in the session section
if not, enable the session from the php.ini

http://forum.codecal...=1&d=1237475361

alsoe try destroying the session first by

Attached Thumbnails

  • session.JPG

  • 0
yo homie i heard you like one-line codes so i put a one line code that evals a decrypted one line code that prints "i love one line codes"
eval(base64_decode("cHJpbnQgJ2kgbG92ZSBvbmUtbGluZSBjb2Rlcyc7"));
www.amrosama.com | the unholy methods of javascript

#3 John

John

    CC Mentor

  • Moderator
  • 4450 posts
  • Location:New York, NY

Posted 19 March 2009 - 07:29 AM

What does
var_dump(isset($_SESSION));
return?
  • 0

#4 Alhazred

Alhazred

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 133 posts

Posted 19 March 2009 - 07:44 AM

It returns: bool(true)
as I've seen that, I've tried changing my scripts in this way

first.php
<?php
session_start();
$_SESSION['test'] = "something";

?>
<a href="second.php">link</a>

second.php
<?php
	session_start();
	$var = $_SESSION['test'];
	print $var;
?>

Inside second.php I have the correct output.
Well, I don't know what to say.
  • 0

#5 John

John

    CC Mentor

  • Moderator
  • 4450 posts
  • Location:New York, NY

Posted 19 March 2009 - 08:30 PM

So is your problem solved?
  • 0

#6 Alhazred

Alhazred

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 133 posts

Posted 20 March 2009 - 12:45 AM

Yes, it is, I just don't know what was wrong when I was trying before.
  • 0





Also tagged with one or more of these keywords: session

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download