Пример #1
0
 public function get_data_from_emp($page_now, $page_display_row)
 {
     $sql = "select * from emp limit " . ($page_now - 1) * $page_display_row . "," . $page_display_row;
     $sqlHelper = new sqlHelper();
     $res = $sqlHelper->execute_dql2($sql);
     $sqlHelper->close_connect();
     return $res;
 }
Пример #2
0
		function getEmpListByPage($pageNow, $pageSize){
			$sql="select * from empmanage limit ".$pageSize.' offset '.($pageNow-1)*$pageSize;

			$sqlHelper=new sqlHelper();
			$res=$sqlHelper->execute_dql2($sql);

			//mysql_free_result($res);
			$sqlHelper->close_connect();
			//print_r($res);
			return $res;
		}
Пример #3
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;
 }
Пример #4
0
 public function get_emp_info($id)
 {
     $sql = "select * from emp where id =" . $id;
     $sqlHelper = new sqlHelper();
     $arr = $sqlHelper->execute_dql2($sql);
     $sqlHelper->close_connect();
     $emp_class = new emp();
     $emp_class->setId($arr[0]['id']);
     $emp_class->setName($arr[0]['name']);
     $emp_class->setGrade($arr[0]['grade']);
     $emp_class->setEmail($arr[0]['email']);
     $emp_class->setSalary($arr[0]['salary']);
     return $emp_class;
     //这里必须把对象(地址)返回,再由updateEmp.php获得这个对象。
     //不能再响updateEmp.php创建新的对象  new emp(),这样会清空emp.class.php里的所有记录。
 }
 function getMessage($sender, $receiver)
 {
     $sql = "select * from message where sender='{$sender}' and receiver='{$receiver}' and isGet=0";
     //file_put_contents("F:/GitHub/Ajax-Practice/mylog4.log",$sql."\r\n",FILE_APPEND);
     $sqlHelper = new sqlHelper();
     $array = $sqlHelper->execute_dql2($sql);
     //file_put_contents("F:/GitHub/Ajax-Practice/mylog4.log",$array."\r\n",FILE_APPEND);
     $messageInfo = "<meses>";
     for ($i = 0; $i < count($array); $i++) {
         $row = $array[$i];
         $messageInfo .= "<mesid>{$row['id']}</mesid><sender>{$row['sender']}</sender><receiver>{$row['receiver']}</receiver><content>{$row['content']}</content><sendTime>{$row['sendTime']}</sendTime>";
     }
     $messageInfo .= "</meses>";
     file_put_contents("F:/GitHub/Ajax-Practice/mylog4.log", $messageInfo . "\r\n", FILE_APPEND);
     return $messageInfo;
     $sqlHelper->close_connect();
 }
Пример #6
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;
 }