Kung fu for a healthy you - Debt Help - Credit Cards - Credit Card - RC51

PDA

View Full Version : Have a question about a new index page


iowadawg
Jun 28th 2006, 8:55 pm
Right now, I have an index.php that naturally comes up when people visit the site.
But I want to have them go to a new index page where if they agree to the terms, then they go to the index.php page.

How can I do this?

Here is the site in case it helps:
http://www.freeadultdir.com

Thank you.

aaron_nimocks
Jun 28th 2006, 8:58 pm
Easiest way is change index.php to home.php and make index.php the page where they land and agree to the terms then go to home.php

iowadawg
Jun 28th 2006, 9:10 pm
Sounds simple, but I know not where to go from there.

How do I set up the new page?
Any special code I need?

brian394
Jul 1st 2006, 3:47 am
You could also do it simply by checking the request method of the page. If it's POST, you can assume that a person has submitted a form to arrive there (pressed an "I Agree" button for example), if it's GET then the person probably just typed the address in (or came from a search engine). Your code might look something like this...


<?php

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
// deliver normal page content here

}
else {
// deliver warning message here...
echo '<form name="form1" action="" method="POST">' . "\r\n";
echo 'Do you agree to the terms?' . '<br>' . "\r\n";
echo '<input type="submit" value="I Agree">' . '<br>' . "\r\n";
echo '</form>';

}

?>

You could also improve it further by adding a checkbox which the user must check, or having the user type in a series of letters (such as "I AGREE") to enter.

TechnoGeek
Jul 1st 2006, 2:59 pm
Hello, iowadawg.
Normally, a server recognizes as the home page of your site one that has the name "index.html", or "index.php", or something similar. When someone types in his browser "http://www.yourbeautifulsite.com", then the server returns that page. You must make so that the page you want the user to see first has that magic name. From that page you may link to whatever other page you want. You can, for example, insert in your home page your conditions for the use of the site, and at bottom include a link saying something like "Click here if you agree." The target page will be the one that was formerly the home page.