Changeset 630 for trunk/profile.php
- Timestamp:
- Dec 2, 2004, 4:42:57 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/profile.php
r593 r630 68 68 array_push( $errors, $lang['periods_error'] ); 69 69 } 70 $mail_error = validate_mail_address( $_POST['mail_address'] ); 71 if ( $mail_error != '' ) array_push( $errors, $mail_error ); 70 71 if ( $_POST['mail_address']!= $user['mail_address']) 72 { 73 if (!empty($_POST['password'])) 74 array_push( $errors, $lang['reg_err_pass'] ); 75 else 76 { 77 // retrieving the encrypted password of the login submitted 78 $query = 'SELECT password FROM '.USERS_TABLE.' 79 WHERE username = \''.$user['username'].'\';'; 80 $row = mysql_fetch_array(pwg_query($query)); 81 if ($row['password'] == md5($_POST['password'])) 82 { 83 $mail_error = validate_mail_address( $_POST['mail_address'] ); 84 if ( !empty($mail_error)) array_push( $errors, $mail_error ); 85 } 86 else 87 array_push( $errors, $lang['reg_err_pass'] ); 88 } 89 } 90 72 91 // password must be the same as its confirmation 73 92 if ( isset( $_POST['use_new_pwd'] ) 74 and $_POST[' password'] != $_POST['passwordConf'] )93 and $_POST['use_new_pwd'] != $_POST['passwordConf'] ) 75 94 array_push( $errors, $lang['reg_err_pass'] ); 76 95 … … 93 112 { 94 113 $query = 'UPDATE '.USERS_TABLE; 95 $query.= " SET password = '".md5( $_POST[' password'] )."'";114 $query.= " SET password = '".md5( $_POST['use_new_pwd'] )."'"; 96 115 $query.= ' WHERE id = '.$user['id']; 97 116 $query.= ';'; 98 117 pwg_query( $query ); 99 118 } 100 if ( isset( $_POST['create_cookie'] ) ) 101 { 102 setcookie( 'id',$page['session_id'],$_POST['cookie_expiration'], 103 cookie_path() ); 104 // update the expiration date of the session 105 $query = 'UPDATE '.SESSIONS_TABLE; 106 $query.= ' SET expiration = '.$_POST['cookie_expiration']; 107 $query.= " WHERE id = '".$page['session_id']."'"; 108 $query.= ';'; 109 pwg_query( $query ); 110 } 119 111 120 // redirection 112 $url = 'category.php'; 113 if ( !isset($_POST['create_cookie']) ) $url = add_session_id( $url,true ); 114 redirect( $url ); 121 redirect(add_session_id(PHPWG_ROOT_PATH.'category.php?'.$_SERVER['QUERY_STRING'])); 115 122 } 116 123 } … … 125 132 126 133 $template->assign_vars(array( 134 'USERNAME'=>$user['username'], 135 'EMAIL'=>$user['mail_address'], 127 136 'LANG_SELECT'=>language_select($user['language'], 'language'), 128 137 'NB_IMAGE_LINE'=>$user['nb_image_line'], … … 130 139 'STYLE_SELECT'=>style_select($user['template'], 'template'), 131 140 'RECENT_PERIOD'=>$user['recent_period'], 141 'MAXWIDTH'=>$user['maxwidth'], 142 'MAXHEIGHT'=>$user['maxheight'], 132 143 133 144 $expand=>'checked="checked"', … … 135 146 136 147 'L_TITLE' => $lang['customize_title'], 137 'L_PASSWORD' => $lang['password'], 138 'L_NEW' => $lang['new'], 139 'L_CONFIRM' => $lang['reg_confirm'], 140 'L_COOKIE' => $lang['create_cookie'], 148 'L_REGISTRATION_INFO' => $lang['register_title'], 149 'L_PREFERENCES' => $lang['preferences'], 150 'L_USERNAME' => $lang['login'], 151 'L_EMAIL' => $lang['mail_address'], 152 'L_CURRENT_PASSWORD' => $lang['password'], 153 'L_CURRENT_PASSWORD_HINT' => $lang['password_hint'], 154 'L_NEW_PASSWORD' => $lang['new_password'], 155 'L_NEW_PASSWORD_HINT' => $lang['new_password_hint'], 156 'L_CONFIRM_PASSWORD' => $lang['reg_confirm'], 157 'L_CONFIRM_PASSWORD_HINT' => $lang['confirm_password_hint'], 141 158 'L_LANG_SELECT'=>$lang['language'], 142 159 'L_NB_IMAGE_LINE'=>$lang['nb_image_per_row'], … … 146 163 'L_EXPAND_TREE'=>$lang['auto_expand'], 147 164 'L_NB_COMMENTS'=>$lang['show_nb_comments'], 165 'L_MAXWIDTH'=>$lang['maxwidth'], 166 'L_MAXHEIGHT'=>$lang['maxheight'], 148 167 'L_YES'=>$lang['yes'], 149 168 'L_NO'=>$lang['no'], 150 169 'L_SUBMIT'=>$lang['submit'], 170 'L_RETURN' => $lang['home'], 171 'L_RETURN_HINT' => $lang['home_hint'], 151 172 152 173 'F_ACTION'=>add_session_id(PHPWG_ROOT_PATH.'profile.php'), … … 154 175 'U_RETURN' => add_session_id(PHPWG_ROOT_PATH.'category.php?'.$_SERVER['QUERY_STRING']) 155 176 )); 156 177 157 178 //-------------------------------------------------------------- errors display 158 179 if ( sizeof( $errors ) != 0 ) … … 164 185 } 165 186 } 166 167 $template->assign_block_vars('text',array(168 'F_LABEL'=>$lang['maxwidth'],169 'F_NAME'=>'maxwidth',170 'F_VALUE'=>$user['maxwidth']171 ));172 173 $template->assign_block_vars('text',array(174 'F_LABEL'=>$lang['maxheight'],175 'F_NAME'=>'maxheight',176 'F_VALUE'=>$user['maxheight']177 ));178 179 $template->assign_block_vars('text',array(180 'F_LABEL'=>$lang['mail_address'],181 'F_NAME'=>'mail_address',182 'F_VALUE'=>$user['mail_address']183 ));184 185 187 //----------------------------------------------------------- html code display 186 188 $template->pparse('profile');
Note: See TracChangeset
for help on using the changeset viewer.