Przeglądaj źródła

Drobne poprawki

Mariusz Muszyński 8 lat temu
rodzic
commit
9db92f98ab

+ 5 - 2
SE/se-lib/Token.php

@@ -9,7 +9,6 @@ class Token {
 			if ($bn === "JakOnZyjeToMyTezMozemy") $this->bn = true;
 			if ($bn === "JakOnZyjeToMyTezMozemy") $this->bn = true;
 			else die();
 			else die();
 		}
 		}
-		$this->time = floor(time()/60);
 	}
 	}
 
 
 	private static function chr($n) {
 	private static function chr($n) {
@@ -21,6 +20,7 @@ class Token {
 	}
 	}
 
 
 	public function genToken() {
 	public function genToken() {
+		$this->time = floor(time()/60);
 		$token = '';
 		$token = '';
 		for ($i = 0; $i < 8; $i++) $token .= self::chr(time() + rand(0, pow(2, 18) - 1));
 		for ($i = 0; $i < 8; $i++) $token .= self::chr(time() + rand(0, pow(2, 18) - 1));
 		$this->token = $token;
 		$this->token = $token;
@@ -48,7 +48,10 @@ class Token {
 	}
 	}
 
 
 	public function getHash($token) {
 	public function getHash($token) {
-		if ($this->bn) return $this->genHash($token);
+		if ($this->bn) {
+			$this->time = floor(time()/60);
+			return $this->genHash($token);
+		}
 		return null;
 		return null;
 	}
 	}
 
 

+ 2 - 2
SE/stuff/scripts/secureMysql/getHash.php

@@ -2,7 +2,7 @@
 <?php
 <?php
 $_SERVER['SERVER_NAME'] = gethostname();
 $_SERVER['SERVER_NAME'] = gethostname();
 $curDir = dirname(__FILE__);
 $curDir = dirname(__FILE__);
-if (!preg_match('/(^.*)stuff.*$/', $curDir, $matches)) die('ScriptLocationError');;
+if (!preg_match('/(^.*)stuff.*$/', $curDir, $matches)) die('Script location error\n');;
 @require_once $matches[1] .  'se-lib' . DIRECTORY_SEPARATOR . 'bootstrap.php';
 @require_once $matches[1] .  'se-lib' . DIRECTORY_SEPARATOR . 'bootstrap.php';
 date_default_timezone_set('Europe/Warsaw');
 date_default_timezone_set('Europe/Warsaw');
 if (!isset($argv[1])) die("Server name/UD missing\n");
 if (!isset($argv[1])) die("Server name/UD missing\n");
@@ -16,6 +16,6 @@ try {
 	$token = readline("Token: ");
 	$token = readline("Token: ");
 	echo "Hash: {$tokenObj->getHash($token)}\n";
 	echo "Hash: {$tokenObj->getHash($token)}\n";
 } catch (Exception $e) {
 } catch (Exception $e) {
-	echo "Unknown error";
+	echo "Unknown error\n";
 }
 }
 ?>
 ?>