Created
March 10, 2012 04:31
-
-
Save alejandrolechuga/2010143 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
if ($_GET['key'] == $_SESSION['hash_key']) { | |
//has key validation passed | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//Generate hash | |
$hash_key = md5($time); | |
//Store hash in the SESSION | |
$_SESSION['hash_key'] = $hash_key; | |
?> | |
<form id="myform"> | |
<input type="text" name="my_name" /> | |
<input type="button" value="submit" onclick="frmSubmit()" /> | |
<script type="text/javascript> | |
function frmSubmit() { | |
document.forms["myform"].action="process.php?key=<?echo $hash_key;?>"; | |
document.forms["myform"].submit(); | |
} | |
</script> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment