Posted By

scopefragger on 09/01/09


Tagged

page user broweser vew cliant


Versions (?)

Who likes this?

4 people have marked this snippet as a favorite

NyX
umang_nine
scopefragger
Priestd09


Getusers current page


 / Published in: PHP
 

URL: http://www.scopesden.co.uk/code_snipit.php?id=

Ever needed to get the page your user is currently viewing? This can be done quickly in php all thanks to $_server.

  1. //////////////////////////////////////////////
  2. // 1. | Get Page user is currently on
  3. //////////////////////////////////////////////
  4. // 1.1 Code
  5. //////////////////////////////////////////////
  6. function curPageName() {
  7. return substr($_SERVER["SCRIPT_NAME"],strrpos($_SERVER["SCRIPT_NAME"],"/")+1);
  8. }
  9.  
  10. //////////////////////////////////////////////
  11. // 1.2 Set Value as varable
  12. //////////////////////////////////////////////
  13.  
  14. $Current_page=curPageName();

Report this snippet  

You need to login to post a comment.