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 Link to comment https://forums.phpfreaks.com/topic/16424-session-help/ 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? Link to comment https://forums.phpfreaks.com/topic/16424-session-help/#findComment-68382 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] Link to comment https://forums.phpfreaks.com/topic/16424-session-help/#findComment-68385 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 Link to comment https://forums.phpfreaks.com/topic/16424-session-help/#findComment-68399 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 Link to comment https://forums.phpfreaks.com/topic/16424-session-help/#findComment-68402 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 Link to comment https://forums.phpfreaks.com/topic/16424-session-help/#findComment-68403 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 Link to comment https://forums.phpfreaks.com/topic/16424-session-help/#findComment-68407 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)); Link to comment https://forums.phpfreaks.com/topic/16424-session-help/#findComment-68409 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 Link to comment https://forums.phpfreaks.com/topic/16424-session-help/#findComment-68410 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] Link to comment https://forums.phpfreaks.com/topic/16424-session-help/#findComment-68416 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 Link to comment https://forums.phpfreaks.com/topic/16424-session-help/#findComment-68417 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] Link to comment https://forums.phpfreaks.com/topic/16424-session-help/#findComment-68418 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.