jim.davidson Posted July 25, 2007 Share Posted July 25, 2007 This might be the stupidist question asked on this forum, but here goes. I am teaching myself php. The book I'm reading says that if you issue the command unset($session) it clears the present session and prevents further sessions from being stored. Like I said I'm self taught, but does that mean that if on the server that my hosting company assigned me to, someone else issued unset($session) then I wouldn't be able to store info to a session on that server? The reason I ask this is that I'm trying to pass session variable to another page and it works on my localhost testing but not on the live server. Thanks Quote Link to comment Share on other sites More sharing options...
Caesar Posted July 25, 2007 Share Posted July 25, 2007 Sessions on other sites on the same server will not affect yours...no. And as long as you're learning, there are no stupid questions. Here's a simple session test I wrote. Try it on your server and see if sessions are working....save it as 'test.php' or something and run it <?php //Checks to see if session information is being saved/set correctly// if(isset($_GET['checksess']) && $_GET['checksess'] == 1) { session_start(); $current_time = date("h:i:s A", time()); echo' <div>This sessions started at: '.$_SESSION['start'].'...It is now '.$current_time.'</div><br /> <div><a href="'.$_SERVER['REQUEST_URI'].'" target="_parent">Refresh!</a></div>'; } else { session_start(); $_SESSION['start'] = date("h:i:s A", time()); echo'Click here to check the session -> <a href="'.$_SERVER['PHP_SELF'].'?checksess=1" target="_parent">Click Me</a>'; } ?> Quote Link to comment Share on other sites More sharing options...
jim.davidson Posted July 25, 2007 Author Share Posted July 25, 2007 Thank you very much, I did'nt think so, wouldn't have made a sense to share if it did. I tried the test program and is it suppose to go to my home page when you click refresh? That's where it went. Quote Link to comment Share on other sites More sharing options...
Caesar Posted July 25, 2007 Share Posted July 25, 2007 Thank you very much, I did'nt think so, wouldn't have made a sense to share if it did. I tried the test program and is it suppose to go to my home page when you click refresh? That's where it went. INteresting. It shouldn't, no. Try changing..... '.$_SERVER['REQUEST_URI'].' To.... ?'.$_SERVER['QUERY_STRING'].' Quote Link to comment Share on other sites More sharing options...
jim.davidson Posted July 25, 2007 Author Share Posted July 25, 2007 Nope, get page not found when I do that. I should say that the run before the suggested change works on my local host, but when I upload to the on-line server, that's where it sends me back to the home page. Quote Link to comment Share on other sites More sharing options...
Caesar Posted July 25, 2007 Share Posted July 25, 2007 Can you PM me the url to the script on your server? Quote Link to comment Share on other sites More sharing options...
jim.davidson Posted July 25, 2007 Author Share Posted July 25, 2007 remember I new at this, what's PM mean? Quote Link to comment Share on other sites More sharing options...
Caesar Posted July 25, 2007 Share Posted July 25, 2007 Private message. :-) And don't worry. Everyone here was new to programming at one point. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.