[SOLVED] how to tell if user has went to root site?
Moderator: General Moderators
-
stevestark5000
- Forum Commoner
- Posts: 61
- Joined: Thu Jan 27, 2011 12:08 am
[SOLVED] how to tell if user has went to root site?
i got a cms that i am working on. i need to tell is a user has went to the root of a website, where a website can be any website. if example.com will not be good enought as i need to tell if the script is at any site. the code need to be in an if statement. for example. if (site at root) { }
Last edited by stevestark5000 on Sat Mar 12, 2011 1:25 am, edited 1 time in total.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
Re: how to tell if user has went to root site?
Use phpinfo() to look at the $_SERVER superglobal array. There are many values there that will be useful to you.
(#10850)
-
stevestark5000
- Forum Commoner
- Posts: 61
- Joined: Thu Jan 27, 2011 12:08 am
Re: how to tell if user has went to root site?
can i have an example please?
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: how to tell if user has went to root site?
Another way to look at what the $_SERVER superglobal has available would be to
which essentially gives you the same info as phpinfo() would.
Code: Select all
echo '<pre>'. print_r($_SERVER, true) .'</pre>';-
stevestark5000
- Forum Commoner
- Posts: 61
- Joined: Thu Jan 27, 2011 12:08 am
Re: how to tell if user has went to root site?
solved. thank you.