php - how to generate unique session Id without the use of session_id()? -


i want generate session id.this unique sessionid represents different data every different user.

my code till now:--

 1. onclick , onload of page call function create_session_id();  2. function create_session_id(){     //this function sends string php page using ajax post }  3. on php page,i receive data , insert it--:      session_start();      $a = session_id();      $object->insert_sessionid($a); 

myquestion--: possible use session_start()(no session_id()) , store unique session id value can use later when fetch data , throw data web page.i dont want clicks register sessionid.it should happen on page load , without function create_session_id!!!

i thinking bring cookie in picture.

note-:no login in webpages

use function

function createrandomval($val){       $chars="abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789,-";       srand((double)microtime()*1000000);       $i = 0;       $pass = '' ;       while ($i<=$val)      {         $num  = rand() % 33;         $tmp  = substr($chars, $num, 1);         $pass = $pass . $tmp;         $i++;       }     return $pass;     } 

and pass return value in session id


Comments