PakiGangsta Posted August 3, 2006 Share Posted August 3, 2006 I am wondering on how to make it show like random letters and random numbers to show battle session Quote Link to comment Share on other sites More sharing options...
Orio Posted August 3, 2006 Share Posted August 3, 2006 What do you mean? Generate a random string of letters and numbers? And how's that connected with sessions? Quote Link to comment Share on other sites More sharing options...
tomfmason Posted August 3, 2006 Share Posted August 3, 2006 you can use a function like this [code=php:0]<?phpsession_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] Quote Link to comment Share on other sites More sharing options...
PakiGangsta Posted August 3, 2006 Author Share Posted August 3, 2006 there but can anyone help me with this checking if the same session was the last session f5 stuff Quote Link to comment Share on other sites More sharing options...
tomfmason Posted August 3, 2006 Share Posted August 3, 2006 You need to explain your questions better. I have no idea what that meant Quote Link to comment Share on other sites More sharing options...
PakiGangsta Posted August 3, 2006 Author Share Posted August 3, 2006 like thisok if my bid is 123 and i refresh it will be 123 but i cant seem to figure it out Quote Link to comment Share on other sites More sharing options...
tomfmason Posted August 3, 2006 Share Posted August 3, 2006 if you use that function that I posted it should not be returning the same session at all Quote Link to comment Share on other sites More sharing options...
PakiGangsta Posted August 3, 2006 Author Share Posted August 3, 2006 but this is what i used $sessionid=md5(uniqid(rand(1000000,9999999), true)); Quote Link to comment Share on other sites More sharing options...
PakiGangsta Posted August 3, 2006 Author Share Posted August 3, 2006 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 Quote Link to comment Share on other sites More sharing options...
tomfmason Posted August 3, 2006 Share Posted August 3, 2006 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] Quote Link to comment Share on other sites More sharing options...
tomfmason Posted August 3, 2006 Share Posted August 3, 2006 you are passing the session through the url. That is why it is not changeing Quote Link to comment Share on other sites More sharing options...
tomfmason Posted August 3, 2006 Share Posted August 3, 2006 here is the code that i used for that url that I posted[code=php:0]<?phpsession_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] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.