public function setUserInfo($openID) { $token = $this->getToken(); if ($token == '') { return ''; } $url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=" . $token . "&openid=" . $openID; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.31 (KHTML, like Gecko) Chrome/26.0.1410.64 Safari/537.31"); $content = curl_exec($curl); curl_close($curl); $data = json_decode($content, true); $mysqlHelperObj = new mysqlHelper(); $sql = "select id from users where user='******'"; $id = $mysqlHelperObj->queryValue($sql, 'id'); if ($id == '') { $sql = "insert into users (user) values('" . $openID . "')"; $mysqlHelperObj->execute($sql); } $sql = "update users set name='" . $data['nickname'] . "', city='" . $data['city'] . "',province='" . $data['province'] . "',sex='" . $data['sex'] . "',country='" . $data['country'] . "',headimgurl='" . addslashes($data['headimgurl']) . "', where user='******'"; $mysqlHelperObj->execute($sql); return 'true'; }
function data_insertjoke($content) { $content = addslashes($content); $ptype = addslashes($ptype); $ptime = time(); $sql = "INSERT INTO jokes (content,ptime)VALUES('{$content}', FROM_UNIXTIME({$ptime}) )"; $mysqlHelperObj = new mysqlHelper(); return $mysqlHelperObj->execute($sql); }
public function insertdb($name, $type, $msg) { date_default_timezone_set('PRC'); if ($type == 'ymsg') { $t = date('Y'); $sql = "update astrological set {$type} = '{$msg}', y='{$t}' where name = '{$name}'"; } else { if ($type == 'mmsg') { $t = date('n'); $sql = "update astrological set {$type} = '{$msg}', m='{$t}' where name = '{$name}'"; } else { if ($type == 'wmsg') { $z = date('z'); $t = date('w'); $sql = "update astrological set {$type} = '{$msg}', w='{$t}', wd='{$z}' where name = '{$name}'"; } else { if ($type == 'dmsg') { $t = date('z'); $sql = "update astrological set {$type} = '{$msg}', d='{$t}' where name = '{$name}'"; } } } } $mysqlHelperObj = new mysqlHelper(); return $mysqlHelperObj->execute($sqlstr); }
function d_setvalues_3($fromuser, $key, $value, $key1, $value1, $key2, $value2) { $news_str = addslashes($zhidao_str); $sql = "update users set {$key}='{$value}', {$key1}='{$value1}', {$key2}='{$value2}' where user = '******'"; $mysqlHelperObj = new mysqlHelper(); $mysqlHelperObj->execute($sql); }
function secret_updateflag($fromuser, $flag) { $sql = "update users set secret_flag = '{$flag}' where user = '******'"; $mysqlHelperObj = new mysqlHelper(); $result = $mysqlHelperObj->execute($sql); if (!$result) { return ''; } }