소스 검색

Drobne poprawki

Mariusz Muszyński 8 년 전
부모
커밋
9db92f98ab
2개의 변경된 파일7개의 추가작업 그리고 4개의 파일을 삭제
  1. 5 2
      SE/se-lib/Token.php
  2. 2 2
      SE/stuff/scripts/secureMysql/getHash.php

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

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

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

@@ -2,7 +2,7 @@
 <?php
 $_SERVER['SERVER_NAME'] = gethostname();
 $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';
 date_default_timezone_set('Europe/Warsaw');
 if (!isset($argv[1])) die("Server name/UD missing\n");
@@ -16,6 +16,6 @@ try {
 	$token = readline("Token: ");
 	echo "Hash: {$tokenObj->getHash($token)}\n";
 } catch (Exception $e) {
-	echo "Unknown error";
+	echo "Unknown error\n";
 }
 ?>