<?php require 'Class_DBOperation.php'; require 'global.php'; $dbOperation = new class_DBOperation(DBHOST, DBUSER, DBPWD, DBNAME, DBCHARSET); $username = $_GET['username']; $sex = $_GET['sex']; $b_date = $_GET['b_date']; $email = $_GET['email']; $sql = "update lbs_member set username='******' ,sex='{$sex}', b_date='{$b_date}',update_time=now(),status=1,xpos=0,ypos=0,qianming='',aihao='',xuexiao='',difang='',zhiye='',gongsi='',zhuye='',startposname='',endposname='',zuojia='',weihao='',restday='',pic='upload/no.jpg' where email='{$email}' "; //echo $sql; $dbOperation->query($sql); $resultJson = json_encode(array('regTag' => 1)); echo $resultJson;
<?php require 'Class_DBOperation.php'; require 'global.php'; $dbOperation = new class_DBOperation(DBHOST, DBUSER, DBPWD, DBNAME, DBCHARSET); $my = $_GET['my']; $u = $_GET['u']; $sql = "select * from lbs_myfriends where userid='{$my}' and fid='{$u}' "; $resultArr = $dbOperation->fetch_obj_arr($sql); if (!$resultArr) { $sql = "insert into lbs_myfriends(userid,fid,update_time,status) values('{$my}','{$u}',now(),1) "; $dbOperation->query($sql); $sql = "select * from lbs_myfriends where userid='{$u}' and fid='{$my}' "; $resultArr2 = $dbOperation->fetch_obj_arr($sql); if ($resultArr2) { $resultJson = json_encode(array('regTag' => 2)); } else { $resultJson = json_encode(array('regTag' => 1)); } echo $resultJson; return; } if (count($resultArr) == 0) { $sql = "insert into lbs_myfriends(userid,fid,update_time,status) values('{$my}','{$u}',now(),1) "; $dbOperation->query($sql); $sql = "select * from lbs_myfriends where userid='{$u}' and fid='{$my}' "; $resultArr2 = $dbOperation->fetch_obj_arr($sql); if ($resultArr2) { $resultJson = json_encode(array('regTag' => 2)); } else { $resultJson = json_encode(array('regTag' => 1));
<?php require 'Class_DBOperation.php'; require 'global.php'; $dbOperation = new class_DBOperation(DBHOST, DBUSER, DBPWD, DBNAME, DBCHARSET); $userid = $_GET['u']; /*$sql = "select id,sender_id,recver_id,send_date,recver_update_date,recver_status, sender_status,sender_update_date,content,getUserName(sender_id) as sender_name, getUserName(recver_id) as recver_name,getUserPic(sender_id) as sender_pic, getUserPic(recver_id) as recver_pic,getDistance(sender_id,recver_id) as distance from lbs_chat where sender_id = '$userid' or recver_id='$userid' order by id desc "; */ $sql = "select id,sender_id,recver_id,update_time,title,content,getUserPic(sender_id) as sender_pic,\r\n \tgetUserPic(recver_id) as recver_pic,getDistance(sender_id,recver_id) as distance from lbs_post where sender_id='{$userid}' or recver_id='{$userid}' order by id desc "; //echo $sql; $resultArr = $dbOperation->fetch_obj_arr($sql); if (!$resultArr) { $resultString = json_encode(QUERY_FAILD); echo $resultString; return; } if (count($resultArr) == 0) { $resultString = json_encode(QUERY_RESULT_IS_NULL); echo $resultString; } else { for ($i = 0; $i < count($resultArr); $i++) { $uid = $resultArr[$i]->sender_id; $sql = "select * from lbs_member where userid='{$uid}'"; $checkResult = $dbOperation->query($sql); if ($checkResult) { $resultObj = $dbOperation->fetch_obj($checkResult); if ($resultObj) {
<?php require 'Class_DBOperation.php'; require 'global.php'; $dbOperation = new class_DBOperation(DBHOST, DBUSER, DBPWD, DBNAME, DBCHARSET); $uid = $_GET['uid']; $cwid = $_GET['cwid']; $dbOperation->query("set names utf8"); $sql = "select a.userid,a.username,\r\n b.name as chewei_name,\r\n c.*,d.username as apply_username\r\n from lbs_member a,\r\n \t lbs_member d,\r\n lbs_chewei b,\r\n lbs_chewei_apply c\r\n where a.userid=b.userid\r\n and b.id=c.chewei_id\r\n and c.chewei_id='{$cwid}'\r\n and c.apply_userid=d.userid "; $resultArr = $dbOperation->fetch_obj_arr($sql); if (!$resultArr) { $resultString = json_encode(QUERY_FAILD); echo $resultString; return; } if (count($resultArr) == 0) { $resultString = json_encode(QUERY_RESULT_IS_NULL); echo $resultString; return; } else { $resultJson = json_encode($resultArr); echo $resultJson; }
<?php require 'Class_DBOperation.php'; require 'global.php'; //创建数据库连接 $dbOperation = new class_DBOperation(DBHOST, DBUSER, DBPWD, DBNAME, DBCHARSET); //接收客户端参数 $user_name = $_GET['name']; $user_pwd = $_GET['pwd']; $sqlCheck = "select userid from lbs_member where email = '{$user_name}'"; //echo $sqlCheck ; $check = $dbOperation->query($sqlCheck); $checkObj = $dbOperation->fetch_obj($check); if (!$checkObj) { //用户id尚未注册 $resultJson = json_encode(array('loginTag' => LOGIN_UNREGISTE_FAILD)); echo $resultJson; return; } $sqlQuery = "select userid from lbs_member where email = '{$user_name}' and password = '******'"; $checkResult = $dbOperation->query($sqlQuery); $resultObj = $dbOperation->fetch_obj($checkResult); if ($resultObj) { $sql = "update lbs_member set update_time=now() where email='{$user_name}' "; $dbOperation->query($sql); $resultJson = json_encode(array('loginTag' => LOGIN_SUCCESS, 'login_user_id' => $resultObj->userid)); echo $resultJson; } else { $resultJson = json_encode(array('loginTag' => LOGIN_FAILD)); echo $resultJson; return;
<?php require 'Class_DBOperation.php'; require 'global.php'; //创建数据库连接 $dbOperation = new class_DBOperation(DBHOST, DBUSER, DBPWD, DBNAME, DBCHARSET); $sql = "select id,title,content,update_time,userid,flag from lbs_bbs order by id desc "; $resultArr = $dbOperation->fetch_obj_arr($sql); if (!$resultArr) { $resultString = json_encode(QUERY_FAILD); echo $resultString; return; } if (count($resultArr) == 0) { $resultString = json_encode(QUERY_RESULT_IS_NULL); echo $resultString; return; } else { $resultJson = json_encode($resultArr); echo $resultJson; }