Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

BigJoe's scratchpad

by BigJoe (Curate)
on Jun 02, 2004 at 23:00 UTC ( [id://359808] : scratchpad . print w/replies, xml ) Need Help??

sub CREATE_NEW_SESSION_ID { ######################################### # Joseph Harnish # # 1/29/2002 # # This creates a session ID # ######################################### ########################################### # I am getting a random length of the # # sessin id to make it harder to crack # ########################################### my $session_id_length = int( rand(14)) + 6; my $session_id = ""; for (my $i = 0; $i <= $session_id_length; $i++){ my $temp = int( rand(36)); if($temp > 9){ $temp = chr($temp + 55); my $upper_or_lower_rand = int( rand (2)); $temp = lc($temp) if($upper_or_lower_rand == 1); } $session_id .= $temp; } $sth= $dbh->prepare("select count(*) from WEB3_Session where sessi +on_id='$session_id'"); $sth->execute; my $num_of_sessions = $sth->fetchrow_array; $sth->finish; $session_id = CREATE_NEW_SESSION_ID () if ( $num_of_sessions > 0); return $session_id; }