示例#1
0
 static function exists()
 {
     if (!isset($_POST["username"]) || !isset($_POST["password"])) {
         return false;
     }
     $qb = new QB();
     $res = $qb->select("adm_users", "id", array("username" => $_POST["username"], "password" => md5($_POST["password"])))->getResult(false);
     if (is_array($res)) {
         return true;
     } else {
         $_SESSION["msg"] = "Login fallito";
         return false;
     }
 }
示例#2
0
文件: Sezioni.php 项目: Zanej/cms
 /**
  * 
  * @param type $type
  * @param type $filter
  * @param type $page
  * @return type
  */
 public function getRows($type = "", $filter = "", $page = "")
 {
     /*@var $controller_conf Conf_tableController*/
     $campi_r = $this->getCampi($type);
     foreach ($campi_r as $k => $v) {
         if (is_object($v)) {
             $campi[] = $v->get("field");
         } else {
             $campi[] = $v["field"];
         }
     }
     if ($page > 1) {
         $limit_from = ($page + 1) * $this->getPerPage();
         $limit_to = $this->getPerPage();
     } elseif ($page == 1) {
         $limit_from = 0;
         $limit_to = $this->getPerPage();
     }
     if (isset($this->controller)) {
         /*@var $controller AbstractController*/
         if ($limit_from) {
             $rows = $this->controller->findBy($filter, true, $campi, $limit_from, $limit_to);
         } else {
             $rows = $this->controller->findBy($filter, true, $campi);
         }
     } else {
         $qb = new QueryBuilder();
         if ($limit_from) {
             $rows = $qb->select($this->table, $campi, $filter)->limit($limit_from, $limit_to)->getResult(true);
         } else {
             $rows = $qb->select($this->table, $campi, $filter)->getResult(true);
         }
     }
     return $rows;
 }