It looks like you're new here. If you want to get involved, click one of these buttons!
<?php
//Note: this is NOT 100% unique. It's reasonably unique.
//Whilst creating 100,000 random numbers, i got 4 duplicates.
//For unique file names
session_start();
if(!isset($_SESSION['rng'])) //RandomNumberGenerator
{
$_SESSION['rng'] = rand(100,9999999999);
}
//It will be used like this $fn = $_SESSION['rng'].\".txt\";
//End
if(isset($_GET['ds'])) //Destroy session
{
session_destroy();
}
echo \"Your temp ID: \". $_SESSION['rng'];
echo '<center>';
$random_number = rand(100,9999999999);
$counter = 0;
echo '<form action=\"counter.php?save\" method=\"post\">';
echo '<textarea rows=20 cols=100 name=\"output\" style=\"text-align:center;\">';
while($counter !=50 && $random_number !=9999999999)
{
$random_number = md5($random_number);
//echo \"Counter: \".$counter.\" \";
echo $random_number.\"\n\"; //\"Random number: \".
$counter ++;
$random_number = rand(100,9999999999);
}
echo '</textarea><br/>';
echo '<input type=\"submit\" value=\"Save\"/></form>';
echo '<br/><a href=\"counter.php\">Refresh</a>';
echo '<br/>';
if(isset($_GET['save']))
{
//Be careful when using large counter because POST size has limits.
//So if you want to use large counter, save manually.
$fn = $_SESSION['rng'].\".txt\";
$fh = fopen($fn,'w');
$data = $_POST['output'].\"\n\";
fwrite($fh,$data);
fclose($fh);
echo '<br/>Saved successfully! <small>To update the file, click save again.</small></center>';
}
?>