acctman Posted February 12, 2008 Share Posted February 12, 2008 Hi I have a php coded page (upload.php) setup that I only want users to access it, if they're coming from page start.php. How would I code that in? Quote Link to comment Share on other sites More sharing options...
revraz Posted February 12, 2008 Share Posted February 12, 2008 You can use REFERER or set a session in start.php and read it on upload.php. Quote Link to comment Share on other sites More sharing options...
marcus Posted February 12, 2008 Share Posted February 12, 2008 if($_SERVER['HTTP_REFERRER'] == "/start.php"){ echo "HELLO"; } Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted February 12, 2008 Share Posted February 12, 2008 Use the session suggestion. All of the common web proxy scripts set 'HTTP_REFERER' to be the same as the url being requested, so any request to your page through a proxy will look like it is from someone already on your site. There is no guarantee that 'HTTP_REFERER' will contain anything or that it will accurately show that someone reached one of your pages from another one. Quote Link to comment Share on other sites More sharing options...
acctman Posted February 12, 2008 Author Share Posted February 12, 2008 Use the session suggestion. All of the common web proxy scripts set 'HTTP_REFERER' to be the same as the url being requested, so any request to your page through a proxy will look like it is from someone already on your site. There is no guarantee that 'HTTP_REFERER' will contain anything or that it will accurately show that someone reached one of your pages from another one. is there an example of how the set session method should be coded. Quote Link to comment Share on other sites More sharing options...
revraz Posted February 12, 2008 Share Posted February 12, 2008 In start.php set a session, in upload.php read if that session is set, if not, redirect them away. Quote Link to comment Share on other sites More sharing options...
acctman Posted February 13, 2008 Author Share Posted February 13, 2008 In start.php set a session, in upload.php read if that session is set, if not, redirect them away. uhh that didnt help much... i know that much. was asking for an example code. Quote Link to comment Share on other sites More sharing options...
aschk Posted February 13, 2008 Share Posted February 13, 2008 <?php session_start(); $_SESSION['location'] = __FILE__; ?> then <?php session_start(); if($_SESSION['location']){ echo $_SESSION['location']; } ?> Quote Link to comment Share on other sites More sharing options...
revraz Posted February 13, 2008 Share Posted February 13, 2008 If you knew that much, it wouldn't take but a search on Sessions to see how to use it. In start.php set a session, in upload.php read if that session is set, if not, redirect them away. uhh that didnt help much... i know that much. was asking for an example code. Quote Link to comment Share on other sites More sharing options...
acctman Posted February 14, 2008 Author Share Posted February 14, 2008 hmm i put the following below in the reg_gender.php page (1st page) <?php session_start(); $_SESSION['location'] = __FILE__; ?> and then in the image imgupload.php page (2nd page) i put the following below. <?php session_start(); if($_SESSION['location']){ echo $_SESSION['location']; } ?> but i was still able to access the imgupload.php page but typing in the URL and not having to go to the reg_gender.php page first. Quote Link to comment 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.