Skip to content

Instantly share code, notes, and snippets.

@alejandrolechuga
Created March 10, 2012 04:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alejandrolechuga/2010143 to your computer and use it in GitHub Desktop.
Save alejandrolechuga/2010143 to your computer and use it in GitHub Desktop.
<?php
if ($_GET['key'] == $_SESSION['hash_key']) {
//has key validation passed
}
?>
<?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