Ejemplo n.º 1
0
 public function getId($tel)
 {
     $sqlHelper = new SqlHelper();
     $user = new User();
     $sql = "select id from user where tel='{$tel}'";
     $res = $sqlHelper->dql_arr($sql);
     $user->setId($res[0]['id']);
     return $user;
 }
Ejemplo n.º 2
0
 public function AdminLogin($username, $password)
 {
     $sqlHelper = new SqlHelper();
     $admin = new Admin();
     $sql = "select password,level from admin where username='******'";
     $res = $sqlHelper->dql_arr($sql);
     if ($res[0]['password'] == md5($password)) {
         $admin->setUsername($username);
         $admin->setLevel($res[0]['level']);
         return $admin;
     } else {
         return null;
     }
 }
Ejemplo n.º 3
0
 public function getArticleDetail($id)
 {
     $sqlHelper = new SqlHelper();
     $article = new Article();
     $sql = "select * from lavender_article where id={$id}";
     $res = $sqlHelper->dql_arr($sql);
     $article->setId($res[0]['id']);
     $article->setPraise($res[0]['praise']);
     $article->setContent($res[0]['content']);
     $article->setDate($res[0]['date']);
     $article->setReadTime($res[0]['read_time']);
     $article->setImg($res[0]['img']);
     $article->setNoPraise($res[0]['no_praise']);
     $article->setTitle($res[0]['title']);
     return $article;
 }