~azzar1/unity/add-show-desktop-key

« back to all changes in this revision

Viewing changes to www/php/phpBB3/includes/session.php

  • Committer: dcoles
  • Date: 2008-02-13 04:10:55 UTC
  • Revision ID: svn-v3-trunk0:2b9c9e99-6f39-0410-b283-7f802c844ae2:trunk:443
Added Forum application along with unmodifed version of phpBB3 "Olympus" 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
356
356
                {
357
357
                        $this->session_gc();
358
358
                }*/
359
 
                
360
 
                // Shared secret between IVLE and the Forum
361
 
                $ivle_secret = 'VERYSECRET';
362
 
 
363
 
                // Shared Cookie
364
 
                $ivle_cookie = $_COOKIE['ivlecookie'];
365
 
    
366
 
                // Decode and unescape the Cookie contents
367
 
                $cookie = explode(':',$ivle_cookie);
368
 
                $ivle_uid = preg_replace('/\\\(.)/','$1',$cookie[0]);
369
 
                $ivle_nick = preg_replace('/\\\(.)/','$1',$cookie[1]);
370
 
                $ivle_email = preg_replace('/\\\(.)/','$1',$cookie[2]);
371
 
                $ivle_hash = preg_replace('/\\\(.)/','$1',$cookie[3]);
372
 
    
373
 
                // Check if uid + nick + email + secret is the same as the hash
374
 
                $ivle_auth = False; // Flag just incase anything else need to know
375
 
                if (md5($ivle_uid.$ivle_nick.$ivle_email.$ivle_secret) == $ivle_hash) {
376
 
                        $ivle_auth = True;
377
 
    
378
 
                        // Check if the user exists in the database
379
 
                        $sql = 'SELECT user_id
380
 
                                        FROM ' . USERS_TABLE . '
381
 
                                        WHERE username = "' . $db->sql_escape($ivle_uid) . '";';
382
 
                        $result = $db->sql_query($sql);
383
 
                        $row = $db->sql_fetchrow($result);
384
 
                        $user_id = $row['user_id'];
385
 
                        $db->sql_freeresult($result);
386
 
 
387
 
                        // If no user_id is found for the username, create a new user
388
 
                        if(!$user_id) {
389
 
                    // Needed for IVLE auth overide
390
 
                    include_once($phpbb_root_path . 'includes/functions_user.' . $phpEx);
391
 
          
392
 
                                // Get the default group
393
 
                                $sql = 'SELECT group_id
394
 
                                                FROM ' . GROUPS_TABLE . "
395
 
                                                WHERE group_name = '" . $db->sql_escape('REGISTERED') . "'
396
 
                                                AND group_type = " . GROUP_SPECIAL;
397
 
                                $result = $db->sql_query($sql);
398
 
                                $row = $db->sql_fetchrow($result);
399
 
                                $db->sql_freeresult($result);
400
 
 
401
 
                                if (!$row) {
402
 
                                        trigger_error('NO_GROUP');
403
 
                                }
404
 
 
405
 
                                $group_id = $row['group_id'];
406
 
 
407
 
                                // Get the Time and Timezone
408
 
                                $timezone = date('Z') / 3600;
409
 
                                $is_dst = date('I');
410
 
                                $timezone = ($is_dst) ? $timezone - 1 : $timezone;
411
 
 
412
 
                                $user_row = array(
413
 
                                        'username'                              => $ivle_uid,
414
 
                                        'user_password'                 => '', # Not a valid hash
415
 
                                        'user_email'                    => $ivle_email,
416
 
                                        'group_id'                              => (int) $group_id,
417
 
                                        'user_timezone'                 => (float) $timezone,
418
 
                                        'user_dst'                              => $is_dst,
419
 
                                        'user_lang'                             => 'en',
420
 
                                        'user_type'                             => USER_NORMAL,
421
 
                                        'user_actkey'                   => '',
422
 
                                        'user_ip'                               => $this->ip,
423
 
                                        'user_regdate'                  => time(),
424
 
                                        'user_inactive_reason'  => 0,
425
 
                                        'user_inactive_time'    => 0,
426
 
                                );
427
 
         
428
 
                                // Add user
429
 
                                $user_id = user_add($user_row);
430
 
                        }
431
 
                }
432
 
                /* IVLE: End of IVLE Code */
433
 
 
434
359
 
435
360
                // Do we allow autologin on this board? No? Then override anything
436
361
                // that may be requested here
2013
1938
        }
2014
1939
}
2015
1940
 
2016
 
?>
 
1941
?>
 
 
b'\\ No newline at end of file'