Jump to content

Archived

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

PakiGangsta

Session help

Recommended Posts

What do you mean? Generate a random string of letters and numbers? And how's that connected with sessions?

Share this post


Link to post
Share on other sites
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]

Share this post


Link to post
Share on other sites
You need to explain your questions better. I have no idea what that meant

Share this post


Link to post
Share on other sites
if you use that function that I posted it should not be returning the same session at all

Share this post


Link to post
Share on other sites
Ok i used your method and even if you refresh it stays the same.
like this http://www.pkrpg.info/battle.php?pid=1&session=pv6t56x5&old= after 10 refreshs

Share this post


Link to post
Share on other sites
no it shouldn't check this one out refresh it as many times as you want [url=http://www.owpt.biz/test/tes.php]http://www.owpt.biz/test/tes.php[/url]

Share this post


Link to post
Share on other sites
you are passing the session through the url. That is why it is not changeing

Share this post


Link to post
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]

Share this post


Link to post
Share on other sites

×

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.