SirChick Posted January 6, 2008 Share Posted January 6, 2008 If you use the $_SERVER['PHP_SELF'] which checks what page the user is viewing.... What would it say if you had that in an include? Example... <?php// this include contains the $_SERVER['PHP_SELF'] that checks what page the user is viewing Include("includetest.php"); //the actual page the user is viewing etc ?> Edited : i didn't mean seessions lol Now if i echo'd it ... would it say "includetest.php" because that is where the session is scripted to or would it say the actual page the user is viewing? Quote Link to comment https://forums.phpfreaks.com/topic/84788-question-about-_serverphp_self/ Share on other sites More sharing options...
Ken2k7 Posted January 6, 2008 Share Posted January 6, 2008 You tell me. How are you creating the session? Quote Link to comment https://forums.phpfreaks.com/topic/84788-question-about-_serverphp_self/#findComment-432157 Share on other sites More sharing options...
redarrow Posted January 6, 2008 Share Posted January 6, 2008 if you stick session_start() at the top your get the ansaw you need......... Quote Link to comment https://forums.phpfreaks.com/topic/84788-question-about-_serverphp_self/#findComment-432158 Share on other sites More sharing options...
SirChick Posted January 6, 2008 Author Share Posted January 6, 2008 You tell me. How are you creating the session? Edit: I meant $_SERVER my bad! Quote Link to comment https://forums.phpfreaks.com/topic/84788-question-about-_serverphp_self/#findComment-432162 Share on other sites More sharing options...
Ken2k7 Posted January 6, 2008 Share Posted January 6, 2008 Thats in a global include.. im just referring to how does the built in function work when it comes to displaying what url the user views. Will it show the file of the include where the session is or will it show the file name of the script the user is viewing... Wait, what built-in function? I only know that you create sessions yourself. ??? Quote Link to comment https://forums.phpfreaks.com/topic/84788-question-about-_serverphp_self/#findComment-432173 Share on other sites More sharing options...
SirChick Posted January 6, 2008 Author Share Posted January 6, 2008 oh balls i think session was the wrong word lol i was meant to say $SERVER !!! $_SERVER['PHP_SELF'] was referring to this.. no idea why i was saying sessions.. guess i been dealing with them alot this week. Quote Link to comment https://forums.phpfreaks.com/topic/84788-question-about-_serverphp_self/#findComment-432176 Share on other sites More sharing options...
Ken2k7 Posted January 6, 2008 Share Posted January 6, 2008 If you included it, then it will be the current page. Quote Link to comment https://forums.phpfreaks.com/topic/84788-question-about-_serverphp_self/#findComment-432180 Share on other sites More sharing options...
redarrow Posted January 6, 2008 Share Posted January 6, 2008 $_SERVER['PHP_SELF'] function get the current url and page your on....... 'PHP_SELF' The filename of the currently executing script, relative to the document root. For instance, $_SERVER['PHP_SELF'] in a script at the address http://example.com/test.php/foo.bar would be /test.php/foo.bar. The __FILE__ constant contains the full path and filename of the current (i.e. included) file. If PHP is running as a command-line processor this variable contains the script name since PHP 4.3.0. Previously it was not available. link to more predifind varables http://uk2.php.net/reserved.variables Quote Link to comment https://forums.phpfreaks.com/topic/84788-question-about-_serverphp_self/#findComment-432182 Share on other sites More sharing options...
trq Posted January 6, 2008 Share Posted January 6, 2008 I'm not sure why people ask these questions. You typed more code and text in your post then you would have needed to type to make a simple example and test it yourself. Just seems a slow method of getting answers. Quote Link to comment https://forums.phpfreaks.com/topic/84788-question-about-_serverphp_self/#findComment-432227 Share on other sites More sharing options...
Ken2k7 Posted January 7, 2008 Share Posted January 7, 2008 I'm not sure why people ask these questions. You typed more code and text in your post then you would have needed to type to make a simple example and test it yourself. Just seems a slow method of getting answers. Well no, it was slow because (s)he asked the wrong question to start out with. Quote Link to comment https://forums.phpfreaks.com/topic/84788-question-about-_serverphp_self/#findComment-432230 Share on other sites More sharing options...
trq Posted January 7, 2008 Share Posted January 7, 2008 I'm sure writting and running a small test script is still alot more productive. Quote Link to comment https://forums.phpfreaks.com/topic/84788-question-about-_serverphp_self/#findComment-432233 Share on other sites More sharing options...
Barand Posted January 7, 2008 Share Posted January 7, 2008 I agree. I'm sure the Greeks had a word for "fear of experimenting" (some sort of phobia). There certainly seems to be an epidemic. edit: according to BabelFish it's "πειραματισμόςφόβος" http://www.phpfreaks.com/forums/index.php/topic,174628.msg772619.html#msg772619 Quote Link to comment https://forums.phpfreaks.com/topic/84788-question-about-_serverphp_self/#findComment-432247 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.