I'm generating a random string, which after some searches on here I have sorted.
But I'm trying to include a form where a length is set for the length of the string, now, when I try that (replace 30 with $len) it just gives a blank white screen, presumably due to the fact that the variable from the form isn't accessible inside the table.
If anyone can give me pointers I'd be most grateful.
<form action="$PHP_SELF" method=post>
<table border="0" cellspacing="0" cellborder="0">
<tr>
<td>String Length</td><td><input type="text" name="len" size="20" maxlength="30"></td>
</tr>
</table>
<input type=submit name="submit" value="Generate Random String">
</form>
<?php
if ($submit) {
function SessionID($lengthstring=30)
{
$Pool = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$Pool .= "abcdefghijklmnopqrstuvwxyz";
$Pool .= "0123456789";
for($index = 0; $index < $lengthstring; $index++)
{
$sid .= substr($Pool,
(rand()%(strlen($Pool))), 1);
}
return($sid);
}
srand(time());
$session = SessionID(30);
echo "$session";
}
?>