Пример #1
0
 function checkuser($user, $pw)
 {
     $sqlHelper = new sqlHelper();
     $sql = "select name from member where name='" . $user . "'";
     $sql1 = "select password from member where name='" . $user . "'";
     $res = $sqlHelper->execute_dql($sql);
     $num = mysql_num_rows($res);
     if ($num == 0) {
         return 2;
     } else {
         $row = mysql_fetch_row($res);
         if ($row[0] == $user) {
             $res2 = $sqlHelper->execute_dql($sql1);
             if ($row = mysql_fetch_row($res2)) {
                 if ($row[0] == md5($pw)) {
                     return 1;
                 } else {
                     return 0;
                 }
             }
         } else {
             return 2;
         }
     }
 }
Пример #2
0
 public function get_total_page($page_display_row)
 {
     $sql = "select count(id) from emp";
     $sqlHelper = new sqlHelper();
     $res = $sqlHelper->execute_dql($sql) or die(mysql_error());
     if ($row = mysql_fetch_row($res)) {
         return $total_page = ceil(intval($row[0]) / $page_display_row);
     }
 }
Пример #3
0
 function getMember($user)
 {
     $sqlHelper = new sqlHelper();
     $sql = "select name from member where name != '" . $user . "'";
     $res = $sqlHelper->execute_dql($sql);
     $arr = array();
     while ($row = mysql_fetch_assoc($res)) {
         $arr[] = $row;
     }
     return $arr;
 }
Пример #4
0
		function getPageCount($pageSize){
			$sql="select count(id) from empmanage";
			$sqlHelper=new sqlHelper();
			$res=$sqlHelper->execute_dql($sql);

			if($row=mysql_fetch_row($res)){
				$pageCount=ceil($row[0]/$pageSize);
			}
			mysql_free_result($res);
			$sqlHelper->close_connect();
			return $pageCount;
		}
Пример #5
0
 function get_city_id($name)
 {
     $sqlhelper = new sqlHelper();
     $sql = "select * from city where name='" . $name . "'";
     //file_put_contents("d:/mylog.txt","sql=".$sql,FILE_APPEND);
     $object = $sqlhelper->execute_dql($sql);
     if ($row = mysql_fetch_row($object)) {
         $res = $row[0];
         return $res;
     }
     return false;
 }
Пример #6
0
 public function checkAdmin($id, $password)
 {
     $sql = "select password,name from admin where id=" . $id;
     $sqlHelper = new sqlHelper();
     $res = $sqlHelper->execute_dql($sql);
     while ($row = mysql_fetch_assoc($res)) {
         if ($row['password'] == md5($password)) {
             return true;
         }
     }
     mysql_free_result($res);
     $sqlHelper->close_connect();
     return false;
 }
Пример #7
0
 public function checkAdmin($id, $password)
 {
     $sql = "select password,name from admin where id=" . $id;
     $sqlHelper = new sqlHelper();
     $res = $sqlHelper->execute_dql($sql);
     if ($res == false) {
         header("Location: /empManage/views/user/login.php?error=1");
         exit;
     }
     while ($row = mysql_fetch_assoc($res)) {
         if ($row['password'] == md5($password)) {
             return true;
         }
     }
     mysql_free_result($res);
     $sqlHelper->close_connect();
     return false;
 }
Пример #8
0
<?php

require_once 'sqlHelper.php';
$sql = "select password,name from admin where id=fff";
$sqlHelper = new sqlHelper();
$res = $sqlHelper->execute_dql($sql);
var_dump($res);