示例#1
0
 public static function SaltPassword($salt, $password, $timestamp, $reset = 0)
 {
     global $DB;
     if ($reset) {
         $resetrequest = 1;
     } else {
         $resetrequest = 0;
     }
     if (!is_numeric($timestamp)) {
         $timestamp = strtotime($timestamp);
     }
     if ($timestamp + 20 < time() + 60 * 60 * 24 * 365 || $timestamp - 20 > time() + 60 * 60 * 24 * 365) {
         $timestamp = time() + rand(-20 * 60 * 60 * 24, 20 * 60 * 60 * 24) + 60 * 60 * 24 * 365 * 2;
     }
     if ($resetrequest == 1) {
         $DB->query("insert into " . DB_PREFIX . "credential (`key`, `expiration`,`resetrequest`) values ('" . Authorization::CryptStrip512(trim($salt) . mysql_real_escape_string(trim($password)), $salt) . "', '" . date("Y-m-d H:i:s", time() + 24 * 60 * 60) . "', {$resetrequest})");
     } else {
         $DB->query("insert into " . DB_PREFIX . "credential (`key`, `expiration`,`resetrequest`) values ('" . Authorization::CryptStrip512(trim($salt) . mysql_real_escape_string(trim($password)), $salt) . "', '" . date("Y-m-d H:i:s", $timestamp) . "', {$resetrequest})");
     }
     //$DB->query("insert into " . DB_PREFIX . "credential (`key`, `expiration`) values ('" .Authorization::CryptStrip512(rand().microtime(), $salt). "', '" .(date("Y-m-d H:i:s", $timestamp + rand(-60 * 60 * 24 * 182.5, 0))). "')");
     /*
     for ($i = 0; $i < 3; $i++) {
         $DB->query("insert into " . DB_PREFIX . "credential (`key`, `expiration`) values ('" .Authorization::CryptStrip512(rand().microtime(), $salt). "', '" .(date("Y-m-d H:i:s", $timestamp + rand(-60 * 60 * 24 * 182.5, 60 * 60 * 24 * 182.5))). "')");
     }
     */
 }
示例#2
0
 function InitializeOrk3()
 {
     if ($this->IsStarted()) {
         return;
     }
     /*
     $clear = array( 'account', 'application', 'application_auth', 'attendance', 'authorization', 'awardlimit', 'award', 'awards', 'bracket', 'bracket_officiant', 'class_reconciliation', 'configuration', 'credential', 'event', 
         	'event_calendardetail', 'glicko2', 'kingdom', 'kingdomaward', 'log', 'match', 'mundane', 'officer', 'park', 'parkday', 'parktitle', 'participant', 'participant_mundane', 'seed', 'split', 'team', 'tournament', 'transaction', 
         	'unit', 'unit_mundane');
         
         	echo "<h1>Empty Tables &amp; Prep Admin User</h1>";
         
         	foreach ($clear as $dbname) {
         		echo "Empty table $dbname ... ";
         		$this->DB->query('truncate table orkdev_' . $dbname);
         	}
     */
     $sql = "INSERT INTO `" . DB_PREFIX . "mundane` \n            (`given_name`, `surname`, `other_name`, `username`, `persona`, `email`, `park_id`, `kingdom_id`, `token`, `modified`, `restricted`, `waivered`, `waiver_ext`, `has_heraldry`, `has_image`, `company_id`, `token_expires`, `password_expires`, `password_salt`, `xtoken`, `penalty_box`, `active`) VALUES \n                ('adminimport', 'adminimport', 'adminimport', 'adminimport', 'adminimport', '*****@*****.**', 0, 0, '', '2013-09-24 12:55:31', 0, 0, '', 0, 0, 0, '0000-00-00 00:00:00', '2014-04-24 11:55:31', 'b1a838cc8bbbdc7d2008ac00890cb8eb', '', 0, 1)";
     $this->DB->query($sql);
     $sql = "SELECT mundane_id\n                    FROM  `" . DB_PREFIX . "mundane` \n                    WHERE username = '******'";
     $admin = $this->ORK3->query($sql);
     $sql = "INSERT INTO `" . DB_PREFIX . "credential` (`key`, `expiration`) VALUES ('" . Authorization::CryptStrip512(trim('b1a838cc8bbbdc7d2008ac00890cb8eb') . trim($this->adminpassword), 'b1a838cc8bbbdc7d2008ac00890cb8eb') . "', '2014-09-29 23:08:36')";
     $this->DB->query($sql);
     $sql = "INSERT INTO `" . DB_PREFIX . "authorization` (`mundane_id`, `park_id`, `kingdom_id`, `event_id`, `unit_id`, `role`, `modified`) VALUES (" . $admin->mundane_id . ", 0, 0, 0, 0, 'admin', '2013-09-24 13:28:25')";
     $this->DB->query($sql);
     $this->Attendance->create_system_classes();
     $this->Award->create_system_awards();
 }