tutorial on dynamic SID generation

D

DJ Stunks

Nospam said:
Is there a tutorial on dynamic SID generation?

I don't know of one, but how about something like this:

#!/usr/bin/perl

use strict;
use warnings;

my $number_of_sids = 10;
my $max_sid_size = 10;

my @sids = sort {$a <=> $b}
map {int rand( '1' . 0 x rand $max_sid_size )}
(1..rand $number_of_sids);

for my $i (0..$#sids) {
printf "SID %d: %d\n", $i+1, $sids[$i];
}

__END__

HTH,
-jp
 
L

lorento

Nospam said:
Is there a tutorial on dynamic SID generation?

What do you mean with SID? Is it session ID?

You can try this code if you want to generate dynamic session ID:

<?php

$randomNumber = rand(10000, 20000) . microtime();
$randomValue = md5($randomNumber);
$randomValue = substr($randomValue, 16);

$SID = md5($randomValue);

?>

regards,

Lorento
 
B

Brian Wakem

Nospam said:
Is there a tutorial on dynamic SID generation?


#!/usr/bin/perl

use strict;
use warnings;
use String::Random;

my $str = new String::Random;


print $str->randregex('\w{24}'), "\n" foreach 1..10;

########

Output:

FdvbJ3izP7EIRWaDdc5zp7HS
cbzQ5EOuRopqZeaVFPF_WZS3
Up3Dl84Un0jKMqVWl7QFY2sL
0A0G5NySsbx_WIA0UXewLZXV
R7EEj7wS5L0aLnpWhvBTKFrw
m3gwaEDqTmqzDecTh8KwHihB
e13WljcHp1yZAeeBXhWYtWkU
P3xZM2YbjyQx3ssAsnXjb47o
f2Y7Y2KiyGN_3bSZgKXtlcG6
oveuUqFXHzx6jaoO9CNbRhwQ
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top