Getusers current page


/ Published in: PHP
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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();

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.