function writeinto($info) { $infoarr = json_decode($info, true); $flag = new M('flag'); $count = $flag->find("openid='" . $infoarr['openid'] . "'", '*', 'count'); $sqlarr = array("nickname" => bin2hex($infoarr['nickname']), "avatar" => $infoarr['headimgurl'], "fakeid" => randStr(), "sex" => $infoarr['sex'], "fromtype" => 'weixin', "datetime" => time(), "flag" => "2"); if (isset($infoarr['shadyphone'])) { $shady = new M('cj_shady'); $shadyarr = $shady->find("phone=" . $infoarr['shadyphone']); if (empty($shadyarr)) { $addarr = array('phone' => $infoarr['shadyphone'], 'shady' => $shadyarr['grade']); $sqlarr = array_merge($sqlarr, $addarr); } } if ($count) { $savve = $flag->update("openid='" . $infoarr['openid'] . "'", $sqlarr); } if ($savve) { echo "ok"; } }
function set_weibo_conf() { if (empty($_POST['folllow'])) { $_POST['folllow'] = 0; } if (empty($_POST['mention'])) { $_POST['mention'] = 0; } if (empty($_POST['letter'])) { $_POST['letter'] = 0; } if (!empty($_FILES['erweima']['type'])) { //上传的文件 include 'updata.php'; $erweifile = updateimg($_FILES['erweima'], 'weibo-ma'); $_POST['erweima'] = $erweifile; } file_get_contents("http://xbsslcurl.sinaapp.com/weiboapi/chengxml.php?token=" . $_POST['access_token']); $weixin_configc = new M('weibo_config'); $save = $weixin_configc->update('id=1', $_POST); echo "<script>alert('微博墙已经配置成功!');history.go(-1);</script>"; }