public function ChangePassword($username, $oldPassword, $newPassword) { $result = false; $sql = "select password from t_admin where username='******'"; //创建一个SqlHelper对象 $sqlHelper = new SqlHelper(); $res = $sqlHelper->execute_dql($sql); if ($row = mysql_fetch_assoc($res)) { //比对密码 if (md5($oldPassword) == $row['password']) { $sql = "update t_admin set password='******' where username='******'"; if ($sqlHelper->execute_dml($sql) != 0) { $result = true; } else { $this->errMessage = "更新失败!"; } } else { $this->errMessage = "原始密码不正确"; } } //资源 mysql_free_result($res); //关闭链接 $sqlHelper->close_connect(); return $result; }
function getFenyePage($fenyePage){ $sqlHelper=new SqlHelper(); $sql1="select * from empmanage limit " .($fenyePage->pageNow-1)*$fenyePage->pageSize.",".$fenyePage->pageSize; $sql2="select count(id) from empmanage"; $sqlHelper->execute_dql_fenye($sql1,$sql2,$fenyePage); $sqlHelper->close_connect(); }
public function updateEmpUI($id, $name, $grade, $email) { $sql = "update emp set name='{$name}',grade={$grade},email='{$email}' where id={$id}"; $sqlHelper = new SqlHelper(); $res = $sqlHelper->execute_dml($sql); $sqlHelper->close_connect(); return $res; }
public function register($user) { $sqlHelper = new SqlHelper(); $username = $user->getUsername(); $password = md5($user->getPassword()); $tel = $user->getTel(); $sql = "insert into user(username,password,tel) values ('{$username}','{$password}','{$tel}')"; $res = $sqlHelper->dml($sql); $sqlHelper->close_connect(); return $res; }
public function checkAdmin($id, $password) { $sql="select password, name from admin where id=$id"; $sqlHelper = new SqlHelper(); $res = $sqlHelper->execute_dql($sql); if($row=mysql_fetch_assoc($res)){ // if(md5($password)==$row['password']) { return $row['name']; } } mysql_free_result($res); $sqlHelper->close_connect(); return false; }
public function checkAdmin($id, $password) { $sql = "select password,name from userlogin where id={$id}"; $sqlHelper = new SqlHelper(); $res = $sqlHelper->execute_dql($sql); if ($row = mysql_fetch_assoc($res)) { if (md5($password) == $row['password']) { return $row['name']; } } //关闭资源 mysql_free_result($res); //关闭连接 $sqlHelper->close_connect(); return ""; }
function getMessage($getter, $sender) { $sql = "select * from mes where getter='{$getter}' and sender='{$sender}' and state=0"; $mesXML = "<meses>"; $sqlHelper = new SqlHelper(); $mesList = $sqlHelper->execute_dql2($sql); if (count($mesList) != 0) { for ($i = 0; $i < count($mesList); $i++) { $row = $mesList[$i]; $mesXML .= "<id>{$row['id']}</id><sender>{$row['sender']}</sender><getter>{$row['getter']}</getter><con>{$row['content']}</con><sendTime>{$row['sendTime']}</sendTime>"; } $sql = "update mes set state=1 where getter='{$getter}' and sender='{$sender}'"; $res = $sqlHelper->execute_dml($sql); } $mesXML .= "</meses>"; $sqlHelper->close_connect(); return $mesXML; }
public function chekcAdimn($id, $password) { $sql = "select password,name from admin where id={$id}"; //创建一个SqlHelper对象 $sqlHelper = new SqlHelper(); $res = $sqlHelper->execute_dql($sql); if ($row = mysql_fetch_assoc($res)) { //比对密码 if (md5($password) == $row['password']) { return $row['name']; } } //释放资源 mysql_free_result($res); //关闭链接 $sqlHelper->close_connect(); return ""; }
function getMessage($getter, $sender) { $sql = "select * from messages where getter='{$getter}' and sender='{$sender}' and isGet=0"; //注意此处的sql语句中sender=“$getter”;是加引号的 //file_put_contents("C:/wamp/www/testinfo.log","sql=".$sql."\r\n", FILE_APPEND); $sqlhelper = new SqlHelper(); $array = $sqlhelper->execute_dql($sql); //dql返回的是数组 $mesInfo = "<mes>"; for ($i = 0; $i < count($array); $i++) { $row = $array[$i]; $mesInfo .= " <mesId>{$row['id']}</mesId>\n\t\t\t\t\t\t <sender>{$row['sender']}</sender>\n\t\t\t\t\t\t <getter>{$row['getter']}</getter>\n\t\t\t\t\t\t <content>{$row['content']}</content>\n\t\t\t\t\t\t <sendTime>{$row['sendTime']}</sendTime>"; } $mesInfo .= "</mes>"; $sqll = "update messages set isGet=1 where getter='{$getter}' and sender='{$sender}'"; // file_put_contents("C:/wamp/www/testinfo.log","sql=".$sql."\r\n", FILE_APPEND); $sqlhelper->execute_dml($sqll); //file_put_contents("C:/wamp/www/testinfo.log", $mesInfo."\r\n",FILE_APPEND); $sqlhelper->close_connect(); return $mesInfo; }
public function deleteallArticle($arr) { $id = ""; $sqlHelper = new SqlHelper(); for ($i = 0; $i < count($arr); $i++) { if ($i < count($arr) - 1) { $id .= $arr[$i] . ","; } else { $id .= $arr[$i]; } } $sql = "delete from lavender_article where id in ({$id})"; $res = $sqlHelper->dml($sql); $sqlHelper->close_connect(); return $res; }
function QueryAllNation() { $sql = "select nationId,nationName from t_Nation"; $sqlHelper = new SqlHelper(); $res = $sqlHelper->execute_dql2($sql); // 关闭连接 $sqlHelper->close_connect(); return $res; }
function Useraddemp($id, $name, $password) { //做一个$sql语句 $sql = "insert into admin (id,name,password) values('{$id}','{$name}',md5('{$password}'))"; //同sqlHelper完成添加 $sqlHelper = new SqlHelper(); $res = $sqlHelper->execute_dml($sql); $sqlHelper->close_connect(); return $res; }
$sqlhelper->execute_dql("update ydcom_users set user_money={$user_money} where user_id={$b2}"); //write_affiliate_log($oid, $up_uid, $row['user_name'], $setmoney, $setpoint, $separate_by); write_affiliate_log($oid, $b2, $user_name, $f2, 0, 0); $time = time(); $fyj = "分佣金"; $sqlhelper->execute_dql("insert into ydcom_account_log(user_id,user_money,frozen_money,rank_points,pay_points,change_time,change_desc,change_type) values({$b2},{$f2},0,0,0,{$time},{$fyj},2)"); } else { break; } $a2 = $b2; //b2就是上家id $b2 = $sqlhelper->execute_dql1("select parent_id from ydcom_users where user_id={$a2}"); } echo "恭喜分成成功"; $sqlhelper->execute_dql("update ydcom_order_info set is_separate=1 where order_id={$order_id}"); $sqlhelper->close_connect(); } function get_affiliate_ck() { $affiliate = unserialize($GLOBALS['_CFG']['affiliate']); empty($affiliate) && ($affiliate = array()); $separate_by = $affiliate['config']['separate_by']; $sqladd = ''; if (isset($_REQUEST['status'])) { $sqladd = ' AND o.is_separate = ' . (int) $_REQUEST['status']; $filter['status'] = (int) $_REQUEST['status']; } if (isset($_REQUEST['order_sn'])) { $sqladd = ' AND o.order_sn LIKE \'%' . trim($_REQUEST['order_sn']) . '%\''; $filter['order_sn'] = $_REQUEST['order_sn']; }
function QueryAllStudentInfo() { $sql = "select zkzh,name from t_StudentInfo"; $sqlHelper = new SqlHelper(); $res = $sqlHelper->execute_dql2($sql); // 关闭连接 $sqlHelper->close_connect(); return $res; }
<?php include "./mysql.php"; include "./message.php"; session_start(); if ($_REQUEST['account'] != "") { $account = $_REQUEST['account']; $password = $_REQUEST['password']; $SqlHelper = new SqlHelper(); $sql = 'select * from ims_xingfit_merchant_user where account = "' . $account . '" and password = "******"'; $res = $SqlHelper->pdo_fetch($sql); if ($res['merchantId'] != "") { $_SESSION['merchantId'] = $res['merchantId']; $sql2 = 'select * from ims_xingfit_merchant_info where merchantId = "' . $_SESSION['merchantId'] . '"'; $res2 = $SqlHelper->pdo_fetch($sql2); $_SESSION['logo'] = $res2['merchantLogo']; $_SESSION['username'] = $res2['merchantName']; include "./navigation.html"; } else { message('用户名或密码错误', './login.html', 'error'); } $SqlHelper->close_connect(); } else { include "./navigation.html"; }