Exemplo n.º 1
0
 public static function getAllUser()
 {
     $db = new DB();
     $data = $db->getObjListBySql("SELECT * FROM user");
     if (count($data) != 0) {
         return $data;
     } else {
         return null;
     }
 }
Exemplo n.º 2
0
<?php

$db = new DB();
$user = $_POST['user'];
$oldPassword = $_POST['oldPassword'];
$newPassword = $_POST['newPassword'];
$oldPassword = $db->escapeStringTODb($oldPassword);
$newPassword = $db->escapeStringTODb($newPassword);
$user = $db->escapeStringTODb($user);
$oldPassword = md5($oldPassword);
$newPassword = md5($newPassword);
$arr = array();
$sql = "select * from admin where username='******' and password='******'";
$row = $db->getObjListBySql($sql);
if (!$row) {
    $arr = array('statusCode' => 200, 'message' => "密码错误", 'navTabId' => "", 'rel' => "", 'callbackType' => "closeCurrent", "forwardUrl" => "");
} else {
    //$sql="update  admin set password='******' where username='******' and password='******'";
    $columns[0] = "password";
    $values[0] = $newPassword;
    $row = $db->updateParamById("admin", $columns, $values, "username", $user);
    $arr = array('statusCode' => 200, 'message' => "修改成功", 'navTabId' => "", 'rel' => "", 'callbackType' => "closeCurrent", "forwardUrl" => "");
}
echo json_encode($arr);