~joshli/coalgames/trunk

« back to all changes in this revision

Viewing changes to cg-includes/sessions.php

  • Committer: Joshua Li
  • Date: 2010-02-19 04:27:55 UTC
  • Revision ID: joshli@joshtime.com-20100219042755-ezg72431th2vu7t7
A finally working reset password.
A mail is sent out with a link to the reset password page. It is a very secure page.
Many items have been changed here and there so that this page fits.
Many new comments added.
Forgot to add some stuff a while ago
Added a new item to cg-settings called on.mail. If false, then no mail will be sent.

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
 */
39
39
require INC_PATH . 'session-functions.php';
40
40
 
41
 
if ( isset ( $cg_cookie[$cg_settings['cookie.session']] ) && strlen ( $cg_cookie[$cg_settings['cookie.session']] ) === 40 && preg_match ( '/^[a-z0-9]{40}$/i', $cg_cookie[$cg_settings['cookie.session']] ) && !defined('NO_SESSION') ) {
 
41
if ( isset ( $cg_cookie[$cg_settings['cookie.session']] ) && strlen ( $cg_cookie[$cg_settings['cookie.session']] ) === 40 && preg_match ( '/^[a-f0-9]{40}$/i', $cg_cookie[$cg_settings['cookie.session']] ) && !defined('NO_SESSION') ) {
42
42
        echo '<pre>';
43
43
        print_r($cg_cookie);
44
44
        echo '</pre>';
107
107
                                if ( $cg_max_active > CG_TIME && $cg_session['recent_active']) {
108
108
                                        $cg_session['total_active'] = $cg_session['total_active'] + $cg_session['recent_active'];
109
109
                                        $cg_update_active_query = 'UPDATE `' . USERDATA_TABLE . '` SET `last_active`=\'' . CG_TIME . '\', `total_active`=`total_active`+' . $cg_session['recent_active'] . ' WHERE `user_id`=\'' . $cg_session['user_id'] . '\' LIMIT 1';
110
 
                                        if ( $cgsql->affected_rows ( $cgsql->simple_query ( $cg_update_active_query ) ) != 1 ) {
 
110
                                        /*if ( $cgsql->affected_rows ( $cgsql->simple_query ( $cg_update_active_query ) ) != 1 ) {
111
111
                                                echo 'Error Code # 5';
112
112
                                        }
 
113
                                        No need to check if we had an error
 
114
                                        */
113
115
                                } else {
114
116
                                                $cg_last_active_query = 'UPDATE `' . USERDATA_TABLE . '` SET `last_active`=\'' . CG_TIME . '\' WHERE `user_id`=\'' . $cg_session['user_id'] . '\' LIMIT 1';
115
117
                                                $cgsql->simple_query($cg_last_active_query);