Way to detect the domain through PHP
I'm using SimpleCMS to allow the client to make simple textual changes to their website; however, I'm having some issues here as part of the website is password protected through setting a PHP $_SESSION
variable. From this secure page, an if(!isset)
is run on this $_SESSION
variable to allow or disallow viewing.
Simple CMS works by logging in to www.contenteditor.net and it loads the pages into some sort of frame (I use the word frame loosely). What I w开发者_Python百科ant to know is, in addition to my if(!isset)
test, is there a way to see if the current domain is contenteditor.net and allow them access?
Any Help is appreciated,
Dan
$_SERVER['SERVER_NAME'] and parse?
Use $_SERVER['HTTP_HOST'] to check your host address and $_SERVER['SERVER_NAME'] could also be used.
If it's in a frame, then no, there's no secure way to do this based on the domain name.
What you could do is, in your authorization code, also allow some kind of URL authorization in addition to the sessions.
When your code editing site opens the page to edit it, append that identifying information to the URL (?auth_token=abcde). You might use a database to generate these tokens from the editor application and read them from the website application, for example. Then the page can be displayed without going through a login form on the website.
精彩评论