Simple coding help?
Posted: Sun Feb 12, 2012 4:39 pm
Hey guys X) another PHP noob is looking for a bit of help!
The concept: I want to set up a website that is a series of riddles. From the start page, you have to enter a set password to get to the next page, which will have a different riddle, and a different password.
a couple of the pages:
The above is just a quick excerpt, but the rest of the page is text and formatting.
answer.php is:
Functionally, it's really simple. But the problem i'm facing is in keeping the passwords for each page out of the source. I've been able to make the site behave as expected, but I can't seem to keep the passwords away from the watchful eyes of Google chrome's 'inspect element' function, even if I Include() the form code instead. Maybe i didn't use it right?
In actuality, it isn't a huge matter of security, but I would really appreciate if I could make it so that you couldn't just right-click the page and find out the answers! XP
The concept: I want to set up a website that is a series of riddles. From the start page, you have to enter a set password to get to the next page, which will have a different riddle, and a different password.
a couple of the pages:
Code: Select all
<p> To continue, you must know. </p>
<form action="/answer.php" method="post">
<input type="text" maxlength="22" name="key" />
<input type="hidden" name="correctkey" value="ANSWER HERE" />
<input type="hidden" name="page" value="NAME OF CURRENT PAGE.PHP" />
<input type="hidden" name="nextpage" value="NAME OF NEXT PAGE.PHP" />
<input type="submit" value="GO" />
</form>
answer.php is:
Code: Select all
<html>
<?php
$key = $_POST['key'];
$correctkey = $_POST['correctkey'];
$page = $_POST['page'];
$nextpage = $_POST['nextpage'];
if ($key==$correctkey)
header ("Location: $nextpage");
else
header ("Location: $page");
?>
</html>In actuality, it isn't a huge matter of security, but I would really appreciate if I could make it so that you couldn't just right-click the page and find out the answers! XP