xxxphp3 Posted November 11, 2007 Share Posted November 11, 2007 I have a main page with 75% constant contents. I want to change the other 25% depending on what page calls the main page. Example www.mysie.com/a.html www.mysite.com/b.html www.mysite.com/c.html www.mysite/x/y/z/mainpage.php Pages a, b, and c are redirect pages to mainpage.php How can I how can I open storya.txt in the mainpage.php when someone clicks on ~.com/a or storyb.txt if they click on ~ .com/b ? Quote Link to comment Share on other sites More sharing options...
trq Posted November 11, 2007 Share Posted November 11, 2007 Check $_SERVER['HTTP_REFERER']. Quote Link to comment Share on other sites More sharing options...
yzerman Posted November 11, 2007 Share Posted November 11, 2007 Check $_SERVER['HTTP_REFERER']. Actually, thats a bad way to do that. The best way to do it is to use hidden inputs. HTTP_REFERER will fail 70% of the time and is not usually cross browser compatible. Quote Link to comment Share on other sites More sharing options...
trq Posted November 11, 2007 Share Posted November 11, 2007 Hidden inputs can be tampered with just as easily or even easier than the referer. The only real safe option would be to use session, but I'm not sure it warrants it for such a simple task. Quote Link to comment Share on other sites More sharing options...
yzerman Posted November 11, 2007 Share Posted November 11, 2007 Hidden inputs can be tampered with just as easily or even easier than the referer. The only real safe option would be to use session, but I'm not sure it warrants it for such a simple task. I wasn't referring to changing the inputs, I was referring to how unreliable HTTP_REFERER is. Firewalls, Spyware blockers, Virus scanners, Browsers, Browser extensions, and other client side factors that number in the hundreds could make this variable fail. Quote Link to comment Share on other sites More sharing options...
xxxphp3 Posted November 12, 2007 Author Share Posted November 12, 2007 If it is a simple task, what is the easiest and safest way to do it? Quote Link to comment Share on other sites More sharing options...
centerwork Posted November 12, 2007 Share Posted November 12, 2007 Why not just store the different content in a mysql table and call it out by an id. www.mysie.com?a=1 www.mysite.com?b=2 www.mysite.com?c=3 Then us $_GET[a] to retrieve the id. Run your query with that id to pull the information from the database for that mainpage. Then just echo it out in the appropriate info its location on the page. Quote Link to comment Share on other sites More sharing options...
xxxphp3 Posted November 12, 2007 Author Share Posted November 12, 2007 Thanks centerwork. I don't quite understand how that will solve the problem, but I well study it. I am new at PHP. Quote Link to comment Share on other sites More sharing options...
centerwork Posted November 12, 2007 Share Posted November 12, 2007 This site has a great FREE Php & Mysql Video trainning, Just create a login and download it. http://www.3dbuzz.com/vbforum/sv_dl_tr.php It will teach you alot of the basics. 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.