Commit c2f7394d authored by Laurence Sebastian Bowes's avatar Laurence Sebastian Bowes
Browse files

Minor fixes. Happy with this code now.

parent 080478fe
Pipeline #87 failed with stage
......@@ -41,14 +41,14 @@ function generateUid()
while ($ok == false) {
//generate random number between 00000 and 99999
$uid = sprintf("%06d", mt_rand(0, 99999));
$uid = sprintf("%05d", mt_rand(0, 99999));
// id return 1 for error (safe to take). 0 for sucess (taken) not safe
shell_exec("id ".$prefix.$uid, $output, $returnVal);
//id return 1 for error (safe to take). 0 for success (taken) not safe
exec("id ".$prefix.$uid, $output, $returnVal);
//check the result of id
if ($returnVal == 1) {
// We have a unused one!
// We have an unused one!
$ok = true;
$safeuid = $prefix.$uid;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment