Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- const salt = "such_salt";
- const timeframe = 10;
- function gen()
- {
- return strtoupper(substr(md5(salt.time()),0,12));
- }
- function auth()
- {
- $valid = false;
- if (timeframe<1)
- {
- $len_t = 1;
- }
- else
- {
- $len_t = round(timeframe);
- }
- if (isset($_GET['pass']))
- {
- $t = time();
- for ($i=0; $i<$len_t; $i++)
- {
- if (strtoupper(substr(md5(salt.($t-$i)),0,12)) == $_GET['pass'] )
- {
- $valid = true;
- break;
- }
- }
- }
- return $valid;
- }
- echo "<pre>";
- echo "<a href=\"?pass=".gen()."\">auth</a><p>";
- var_dump(auth());
- echo "</pre>";
- ?>
Advertisement
Add Comment
Please, Sign In to add comment