diff options
author | z0rglub <z0rglub@piwigo.org> | 2003-05-13 10:02:06 +0000 |
---|---|---|
committer | z0rglub <z0rglub@piwigo.org> | 2003-05-13 10:02:06 +0000 |
commit | b7b705f2685da04caa0be91debc2c66d279fddf5 (patch) | |
tree | e85fda5916493496acc30c396352507671d40632 /include/functions_session.inc.php | |
parent | 0cc55ec468a8535c7bde3505a6449f07df7de654 (diff) |
2003.05.13 user_add and user_modify added
git-svn-id: http://piwigo.org/svn/trunk@9 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r-- | include/functions_session.inc.php | 50 |
1 files changed, 14 insertions, 36 deletions
diff --git a/include/functions_session.inc.php b/include/functions_session.inc.php index e85447221..722627dc7 100644 --- a/include/functions_session.inc.php +++ b/include/functions_session.inc.php @@ -48,10 +48,10 @@ function generate_key() return $key; } -function session_create( $pseudo ) +function session_create( $username ) { global $conf,$prefixeTable,$REMOTE_ADDR; - // 1. trouver une clé de session inexistante + // 1. searching an unused sesison key $id_found = false; while ( !$id_found ) { @@ -65,14 +65,13 @@ function session_create( $pseudo ) $id_found = true; } } - // 2. récupération de l'id de l'utilisateur dont le pseudo - // est passé en paramètre + // 2. retrieving id of the username given in parameter $query = 'select id'; $query.= ' from '.$prefixeTable.'users'; - $query.= " where pseudo = '".$pseudo."';"; + $query.= " where username = '".$username."';"; $row = mysql_fetch_array( mysql_query( $query ) ); $user_id = $row['id']; - // 3. insertion de la session dans la base de donnée + // 3. inserting session in database $expiration = $conf['session_time']*60+time(); $query = 'insert into '.$prefixeTable.'sessions'; $query.= ' (id,user_id,expiration,ip) values'; @@ -82,49 +81,28 @@ function session_create( $pseudo ) return $generated_id; } - -function add_session_id_to_url( $url, $redirect = false ) -{ - global $page, $user; - $amp = "&"; - if ( $redirect ) - { - $amp = "&"; - } - if ( !$user['is_the_guest'] ) - { - if ( ereg( "\.php\?",$url ) ) - { - return $url.$amp."id=".$page['session_id']; - } - else - { - return $url."?id=".$page['session_id']; - } - } - else - { - return $url; - } -} +// add_session_id adds the id of the session to the string given in +// parameter as $url. If the session id is the first parameter to the url, +// it is preceded by a '?', else it is preceded by a '&'. If the +// parameter $redirect is set to true, '&' is used instead of '&'. function add_session_id( $url, $redirect = false ) { global $page, $user; - $amp = "&"; + $amp = '&'; if ( $redirect ) { - $amp = "&"; + $amp = '&'; } if ( !$user['is_the_guest'] ) { - if ( ereg( "\.php\?",$url ) ) + if ( preg_match( '/\.php\?/',$url ) ) { - return $url.$amp."id=".$page['session_id']; + return $url.$amp.'id='.$page['session_id']; } else { - return $url."?id=".$page['session_id']; + return $url.'?id='.$page['session_id']; } } else |