4
0
Эх сурвалжийг харах

Fix Login and settings refresh

causefx 10 жил өмнө
parent
commit
2954c5da7b
3 өөрчлөгдсөн 16 нэмэгдсэн , 12 устгасан
  1. 1 0
      index.php
  2. 1 1
      settings.php
  3. 14 11
      setup.php

+ 1 - 0
index.php

@@ -15,6 +15,7 @@ foreach ($config as $keyname => $section) {
             
             $guesticons = "<span><i class=\"fa fa-toggle-on\"></i></span>";
             $adminicons = "<span><i class=\"fa fa-toggle-on\"></i></span>";
+            $refreshicons = "<span><i class=\"fa fa-refresh\"></i></span>";
         }
     
         //Guest

+ 1 - 1
settings.php

@@ -61,7 +61,7 @@ if(array_key_exists('category-0', $_POST) == true){
         echo "<!DOCTYPE html>";
         echo "<head>";
         echo "<title>Form submitted</title>";
-        echo "<script type='text/javascript'>window.location.replace('settings.php');</script>";
+        echo "<script type='text/javascript'>window.parent.location.reload();</script>";
         echo "</head>";
         echo "<body></body></html>";
     }

+ 14 - 11
setup.php

@@ -33,26 +33,29 @@ try {
 
 foreach ($config as $keyname => $section) {
     
-        if(($keyname == "general")) { $hash_pass = $section["password"]; }
+    if(($keyname == "general")) { $hash_pass = $section["password"]; }
 
 }
 
 $pass = isset( $_POST["pass"] ) ? $_POST["pass"] : "none" ;
 
-if(isset( $_POST["pass"] ) && $pass !== "none"){ $error = "Wrong Password!";}
-
 $parts = explode('$', $hash_pass);
 $test_hash = crypt($pass, sprintf('$%s$%s$%s$', $parts[1], $parts[2], $parts[3]));
 
 if(($hash_pass == $test_hash)){ 
-        setcookie("logged", $hash_pass, time() + (86400 * 7), "/");
-        echo "<!DOCTYPE html>";
-        echo "<head>";
-        echo "<title>Form submitted</title>";
-        echo "<script type='text/javascript'>window.parent.location.reload()</script>";
-        echo "</head>";
-        echo "<body></body></html>";
-} 
+    setcookie("logged", $hash_pass, time() + (86400 * 7), "/");
+    $error = "You got it dude!";
+    echo "<!DOCTYPE html>";
+    echo "<head>";
+    echo "<title>Form submitted</title>";
+    echo "<script type='text/javascript'>window.parent.location.reload()</script>";
+    echo "</head>";
+    echo "<body></body></html>";
+}
+
+if(isset( $_POST["pass"] ) && ($hash_pass !== $test_hash)){
+    $error = "Wrong Password!";
+}
     
 if((!isset($_COOKIE["logged"]))){