예제 #1
0
파일: admin.php 프로젝트: cescgie/garth
 public function login()
 {
     if (!empty($_POST['username']) && !empty($_POST['password'])) {
         $username = filter_var($_POST['username'], FILTER_SANITIZE_STRING, FILTER_FLAG_STRIP_HIGH);
         $data["admin"] = $this->_model->check_admin("username", $username);
         if (!sizeof($data["admin"])) {
             Message::set("There is no username with this value '" . $_POST['username'] . "'", "error");
             URL::REDIRECT("portfolio");
         } else {
             foreach ($data["admin"] as $key => $value) {
                 $password = $_POST['password'];
                 $hash_password = $value['password'];
                 $username = $value['username'];
                 if ($value['state'] == 1) {
                     if (Password::validate($password, $hash_password)) {
                         Session::set("admin", $username);
                         Message::set("Herzlich Wilkommen " . Session::get('admin') . "!", "success");
                         URL::REDIRECT("portfolio");
                     } else {
                         Message::set("Password not matched", "error");
                         URL::REDIRECT("portfolio");
                     }
                 } else {
                     Message::set("Your account hasn't been activated yet. Please activate your account by confirming our email.", "info");
                     URL::REDIRECT("portfolio");
                 }
             }
         }
     } else {
         Message::set("Please fill the login form", "error");
         URL::REDIRECT("portfolio");
     }
 }
예제 #2
0
     $daten['lists'] = $_GET['daten'];
     $daten['name'] = $_GET['name'];
     $daten['updated_at'] = date("Y-m-d H:i:s");
     $db->update('playlist', $daten, 'name="' . $daten["name"] . '"');
 } elseif ($_GET['action'] == 'check_name') {
     $name = $_GET['name'];
     $result = $db->select("SELECT EXISTS(SELECT 1 FROM playlist WHERE name ='{$name}' LIMIT 1) as checked");
     /*
      * if exists result is 1 else is 0
      */
     print_r($result[0]['checked']);
 } elseif ($_GET['action'] == 'check_password') {
     $name = $_GET['name'];
     $pass = $_GET['password'];
     $result = $db->select("SELECT password FROM playlist WHERE name='{$name}' ");
     if ($password->validate($pass, $result[0]['password'])) {
         echo 1;
     } else {
         echo 0;
     }
 } elseif ($_GET['action'] == 'update_viewer') {
     # code...
     $id = $_GET['id'];
     $viewers = $db->select("SELECT * FROM yapi WHERE yid='{$id}' ");
     $viewer['viewers'] = $viewers[0]['viewers'] + 1;
     $db->update('yapi', $viewer, 'yid="' . $id . '"');
     echo $viewers[0]['viewers'];
 } elseif ($_GET['action'] == 'update_empf_videos') {
     $new_empf_id = $_GET['new_empf_id'];
     $old_empf_id = $_GET['old_empf_id'];
     $suggest_old['suggest'] = 0;