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 Link to comment https://forums.phpfreaks.com/topic/61725-question-about-unsetsession/ 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>'; } ?> Link to comment https://forums.phpfreaks.com/topic/61725-question-about-unsetsession/#findComment-307297 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. Link to comment https://forums.phpfreaks.com/topic/61725-question-about-unsetsession/#findComment-307313 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'].' Link to comment https://forums.phpfreaks.com/topic/61725-question-about-unsetsession/#findComment-307341 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. Link to comment https://forums.phpfreaks.com/topic/61725-question-about-unsetsession/#findComment-307348 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? Link to comment https://forums.phpfreaks.com/topic/61725-question-about-unsetsession/#findComment-307352 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? Link to comment https://forums.phpfreaks.com/topic/61725-question-about-unsetsession/#findComment-307353 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. Link to comment https://forums.phpfreaks.com/topic/61725-question-about-unsetsession/#findComment-307359 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.