Jump to content

Session help


PakiGangsta

Recommended Posts

you can use a function like this

[code=php:0]
<?php
session_start();

function random_session() {
 $salt = "abchefghjkmnpqrstuvwxyz0123456789";
 srand((double)microtime()*1000000);  
     $i = 0;
     while ($i <= 7) {
           $num = rand() % 33;
           $tmp = substr($salt, $num, 1);
           $sess = $sess . $tmp;
           $i++;
     }
     return $sess;
}

$_SESSION['random'] = random_session();

?>
[/code]
Link to comment
https://forums.phpfreaks.com/topic/16424-session-help/#findComment-68385
Share on other sites

here is the code that i used for that url that I posted

[code=php:0]
<?php
session_start();

function random_session() {
  $salt = "abchefghjkmnpqrstuvwxyz0123456789";
  srand((double)microtime()*1000000); 
      $i = 0;
      while ($i <= 10) {
            $num = rand() % 33;
            $tmp = substr($salt, $num, 1);
            $pass = $pass . $tmp;
            $i++;
      }
      return $pass;
}

$_SESSION['random'] = random_session();

echo 'The random session is <b>' .$_SESSION['random'] . '</b> and this test worked';

?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/16424-session-help/#findComment-68418
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.