- Timestamp:
- Sep 7, 2009, 10:52:49 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
extensions/NBC_UserAdvManager/trunk/include/functions_UserAdvManager.inc.php
r3826 r3836 187 187 188 188 $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array(); 189 $conf_nbc_UserAdvManager_ConfirmMail = isset($conf['nbc_UserAdvManager_ConfirmMail']) ? explode(";" , $conf['nbc_UserAdvManager_ConfirmMail']) : array(); 189 190 190 191 $query = " … … 203 204 ;"; 204 205 $data = mysql_fetch_array(pwg_query($query)); 205 206 206 207 207 if (!empty($data) and isset($data['user_id']) and !isset($data['date_check'])) 208 208 { … … 213 213 ;"; 214 214 list($registration_date) = mysql_fetch_row(pwg_query($query)); 215 215 216 /* Time limit process */ 217 /* ****************** begin ******************* */ 216 218 if (!empty($registration_date)) 217 219 { 218 // Time limit process 220 // Verify Confirmmail with time limit ON 221 if (isset ($conf_nbc_UserAdvManager_ConfirmMail[1])) 222 { 223 // dates formating and compare 224 $today = date("d-m-Y"); // Get today's date 225 list($day, $month, $year) = explode('-', $today); // explode date of today 226 $daytimestamp = mktime(0, 0, 0, $month, $day, $year);// Generate UNIX timestamp 227 228 list($regdate, $regtime) = explode(' ', $registration_date); // Explode date and time from registration date 229 list($regyear, $regmonth, $regday) = explode('-', $regdate); // Explode date from registration date 230 $regtimestamp = mktime(0, 0, 0, $regmonth, $regday, $regyear);// Generate UNIX timestamp 231 232 $deltasecs = $daytimestamp - $regtimestamp;// Compare the 2 UNIX timestamps 233 $deltadays = floor($deltasecs / 86400);// Convert result from seconds to days 234 235 // Condition with the value set for time limit 236 if ($deltadays <= $conf_nbc_UserAdvManager_ConfirmMail[1]) // If Nb of days is less than the set limit 237 { 238 list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();')); 239 240 $query = ' 241 UPDATE '.USER_CONFIRM_MAIL_TABLE.' 242 SET date_check="'.$dbnow.'" 243 WHERE id = "'.$id.'" 244 ;'; 245 pwg_query($query); 246 247 if ( $conf_nbc_UserAdvManager[3] <> -1 ) 248 { 249 $query = " 250 DELETE FROM ".USER_GROUP_TABLE." 251 WHERE user_id = '".$data['user_id']."' 252 AND group_id = '".$conf_nbc_UserAdvManager[3]."' 253 ;"; 254 pwg_query($query); 255 } 256 257 if ( $conf_nbc_UserAdvManager[4] <> -1 ) // Change user's group 258 { 259 $query = " 260 DELETE FROM ".USER_GROUP_TABLE." 261 WHERE user_id = '".$data['user_id']."' 262 AND group_id = '".$conf_nbc_UserAdvManager[4]."' 263 ;"; 264 pwg_query($query); 265 266 $query = " 267 INSERT INTO ".USER_GROUP_TABLE." 268 (user_id, group_id) 269 VALUES 270 ('".$data['user_id']."', '".$conf_nbc_UserAdvManager[4]."') 271 ;"; 272 pwg_query($query); 273 } 274 275 if (($conf_nbc_UserAdvManager[5] <> -1 or isset($data['status']))) // Change user's status 276 { 277 $query = " 278 UPDATE ".USER_INFOS_TABLE." 279 SET status = '".(isset($data['status']) ? $data['status'] : $conf_nbc_UserAdvManager[5])."' 280 WHERE user_id = '".$data['user_id']."' 281 ;"; 282 pwg_query($query); 283 } 284 // Refresh user's category cache 285 invalidate_user_cache(); 286 287 return true; 288 } 289 elseif ($deltadays > $conf_nbc_UserAdvManager_ConfirmMail[1]) // If timelimit exeeds 290 { 291 return false; 292 } 293 } 294 // Verify Confirmmail with time limit OFF 295 else 296 { 297 list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();')); 298 299 $query = ' 300 UPDATE '.USER_CONFIRM_MAIL_TABLE.' 301 SET date_check="'.$dbnow.'" 302 WHERE id = "'.$id.'" 303 ;'; 304 pwg_query($query); 305 306 if ( $conf_nbc_UserAdvManager[3] <> -1 ) 307 { 308 $query = " 309 DELETE FROM ".USER_GROUP_TABLE." 310 WHERE user_id = '".$data['user_id']."' 311 AND group_id = '".$conf_nbc_UserAdvManager[3]."' 312 ;"; 313 pwg_query($query); 314 } 315 316 if ( $conf_nbc_UserAdvManager[4] <> -1 ) 317 { 318 $query = " 319 DELETE FROM ".USER_GROUP_TABLE." 320 WHERE user_id = '".$data['user_id']."' 321 AND group_id = '".$conf_nbc_UserAdvManager[4]."' 322 ;"; 323 pwg_query($query); 324 325 $query = " 326 INSERT INTO ".USER_GROUP_TABLE." 327 (user_id, group_id) 328 VALUES 329 ('".$data['user_id']."', '".$conf_nbc_UserAdvManager[4]."') 330 ;"; 331 pwg_query($query); 332 } 333 334 if ( ( $conf_nbc_UserAdvManager[5] <> -1 or isset($data['status']) ) ) 335 { 336 $query = " 337 UPDATE ".USER_INFOS_TABLE." 338 SET status = '".(isset($data['status']) ? $data['status'] : $conf_nbc_UserAdvManager[5])."' 339 WHERE user_id = '".$data['user_id']."' 340 ;"; 341 pwg_query($query); 342 } 343 // Refresh user's category cache 344 invalidate_user_cache(); 345 346 return true; 347 } 219 348 } 220 221 list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();')); 222 349 /* ****************** end ******************* */ 350 // Original code without time limit 351 /* list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();')); 352 223 353 $query = ' 224 354 UPDATE '.USER_CONFIRM_MAIL_TABLE.' … … 268 398 invalidate_user_cache(); 269 399 270 return true; 400 return true;*/ 271 401 } 272 402 } 273 403 else 274 404 return false; 275 276 405 } 277 406
Note: See TracChangeset
for help on using the changeset viewer.