diff options
author | z0rglub <z0rglub@piwigo.org> | 2003-05-17 11:42:03 +0000 |
---|---|---|
committer | z0rglub <z0rglub@piwigo.org> | 2003-05-17 11:42:03 +0000 |
commit | 2c2af65b6a95e20ba9ca49139683d2d150edb1b6 (patch) | |
tree | 89dfe5da914ab688e598666cbd0e2d0d0079688a /include/functions_session.inc.php | |
parent | f96563b9e8ffbc67af2ee5826b8f0c9b33dbb87e (diff) |
*** empty log message ***
git-svn-id: http://piwigo.org/svn/trunk@13 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | include/functions_session.inc.php | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/include/functions_session.inc.php b/include/functions_session.inc.php index 722627dc7..352e7cd7d 100644 --- a/include/functions_session.inc.php +++ b/include/functions_session.inc.php @@ -36,10 +36,10 @@ function generate_key() { $key .= chr( mt_rand( 65, 90 ) ); } - elseif ( $c == 1 ) - { - $key .= chr( mt_rand( 97, 122 ) ); - } + else if ( $c == 1 ) + { + $key .= chr( mt_rand( 97, 122 ) ); + } else { $key .= mt_rand( 0, 9 ); @@ -50,14 +50,14 @@ function generate_key() function session_create( $username ) { - global $conf,$prefixeTable,$REMOTE_ADDR; + global $conf; // 1. searching an unused sesison key $id_found = false; while ( !$id_found ) { $generated_id = generate_key(); $query = 'select id'; - $query.= ' from '.$prefixeTable.'sessions'; + $query.= ' from '.PREFIX_TABLE.'sessions'; $query.= " where id = '".$generated_id."';"; $result = mysql_query( $query ); if ( mysql_num_rows( $result ) == 0 ) @@ -67,16 +67,16 @@ function session_create( $username ) } // 2. retrieving id of the username given in parameter $query = 'select id'; - $query.= ' from '.$prefixeTable.'users'; + $query.= ' from '.PREFIX_TABLE.'users'; $query.= " where username = '".$username."';"; $row = mysql_fetch_array( mysql_query( $query ) ); $user_id = $row['id']; // 3. inserting session in database - $expiration = $conf['session_time']*60+time(); - $query = 'insert into '.$prefixeTable.'sessions'; + $expiration = $conf['session_time'] * 60 + time(); + $query = 'insert into '.PREFIX_TABLE.'sessions'; $query.= ' (id,user_id,expiration,ip) values'; $query.= "('".$generated_id."','".$user_id; - $query.= "','".$expiration."','".$REMOTE_ADDR."');"; + $query.= "','".$expiration."','".$_SERVER['REMOTE_ADDR']."');"; mysql_query( $query ); return $generated_id; |