本文整理汇总了PHP中inserttable函数的典型用法代码示例。如果您正苦于以下问题:PHP inserttable函数的具体用法?PHP inserttable怎么用?PHP inserttable使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了inserttable函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wz_record
function wz_record($get)
{
global $_SGLOBAL, $_SC;
reset($get);
foreach ($get as $k => $v) {
if ($k == 'wxid') {
$wxid = getstr($get[$k]);
}
if ($k == 'token') {
$token = getstr($get[$k]);
}
if ($k == 'mid') {
$mid = intval($get[$k]) ? intval($get[$k]) : 0;
}
if ($k == 'wxid' || $k == 'token' || $k == 'mid') {
unset($get[$k]);
continue;
} else {
$get[$k] = getstr($get[$k]);
}
$get[$k] = getstr($get[$k]);
}
$query = json_encode($get);
$arr = array('token_id' => $_SGLOBAL['supe_token_id'], 'query' => $query, 'ip' => getonlineip(), 'user_agent' => $_SERVER["HTTP_USER_AGENT"], 'wxid' => $wxid, 'token' => $token, 'mid' => $mid, 'addtime' => $_SGLOBAL['timestamp']);
$record_id = inserttable(tname('wz_record'), $arr, 1);
return $record_id;
}
示例2: getjokes
function getjokes($num)
{
for ($i = 2; $i <= $num; $i++) {
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, 'http://www.haha365.com/er_joke/index_' . $i . '.htm');
curl_setopt($curl, CURLOPT_HEADER, 0);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_TIMEOUT, 4);
$data = curl_exec($curl);
curl_close($curl);
if ($data == null) {
continue;
}
while (strstr($data, '<div id="endtext">')) {
$index = strpos($data, '<div id="endtext">');
$index2 = strpos($data, '</div>', $index);
$len = strlen('<div id="endtext">');
$joke = substr($data, $index + $len, $index2 - $index - $len);
$joke = str_replace('“', '"', $joke);
$joke = str_replace('”', '"', $joke);
$joke = str_replace('¡¡', '', $joke);
$joke = str_replace('…', '...', $joke);
$joke = str_replace('<br />', '', $joke);
$joke = str_replace("<p>", '"', $joke);
$joke = str_replace("</p>", '"', $joke);
$joke = trim($joke);
$data = substr($data, $index2);
$joke = iconv("gb2312", "utf-8", $joke);
echo $joke . "\n\n";
inserttable($joke, "å„¿ç");
}
}
}
示例3: active_rightbottom_sitemail
function active_rightbottom_sitemail()
{
if ($_POST) {
$sid = MooGetGPC('msg_sid', 'integer', 'P');
if (empty($_POST['msg_sid']) && !empty($_POST['msg_username'])) {
$username = MooGetGPC('msg_username', 'string', 'P');
$sql = "SELECT uid FROM {$GLOBALS['dbTablePre']}admin_user WHERE username='{$username}'";
$admin_user = $GLOBALS['_MooClass']['MooMySQL']->getOne($sql);
if (empty($admin_user)) {
salert('此用户不存在');
exit;
}
$sid = $admin_user['uid'];
}
$data['sid'] = $sid;
$data['title'] = "{$GLOBALS['adminid']}号客服:" . MooGetGPC('msg_title', 'string', 'P');
$data['content'] = MooGetGPC('msg_content', 'string', 'P');
$data['awoketime'] = time() + 120;
$data['dateline'] = time();
$data['send_id'] = $GLOBALS['adminid'];
inserttable('admin_remark', $data);
salert('发送成功');
exit;
}
$group_list = get_group_type();
require adminTemplate('other_rightbottom_sitemail');
}
示例4: auth_add
function auth_add($ownertype, $ownerid, $domain, $did, $auth, $level, $iscancel)
{
$arr = array('ownertype' => base_protect($ownertype), 'ownerid' => (int) $ownerid, 'domain' => base_protect($domain), 'did' => (int) $did, 'auth' => base_protect($auth), 'level' => (int) $level, 'iscancel' => (int) $iscancel);
$arr['grantat'] = date('Y-m-d H:i:s');
$arr['grantby'] = $_SESSION['twt_uid'];
$flag = inserttable('authmap', $arr);
return $flag;
}
示例5: active_activity_add
function active_activity_add()
{
$data = array();
if (!empty($_POST)) {
$data['title'] = trim(MooGetGPC('title', 'string', 'P'));
if (empty($data['title'])) {
MooMessageAdmin('请活动主题', 'index.php?action=active_activity&h=add');
exit;
}
$data['type'] = MooGetGPC('type', 'integer', 'P');
$data['price'] = MooGetGPC('price', 'integer', 'P');
$data['price_online'] = MooGetGPC('price_online', 'integer', 'P');
$data['starttime'] = MooGetGPC('starttime', 'string', 'P');
if (empty($data['starttime'])) {
MooMessageAdmin('请填写活动的报名开始时间', 'index.php?action=active_activity&h=add');
exit;
}
$data['starttime'] = strtotime($data['starttime'] . ' 0:0:0');
$data['endtime'] = MooGetGPC('endtime', 'string', 'P');
if (empty($data['endtime'])) {
MooMessageAdmin('请填写活动的报名结束时间', 'index.php?action=active_activity&h=add');
exit;
}
$data['endtime'] = strtotime($data['endtime'] . ' 23:59:59');
$data['opentime'] = MooGetGPC('opentime', 'array', 'P');
if (empty($data['opentime']['day'])) {
$data['opentime'] = 0;
} else {
$data['opentime'] = strtotime($data['opentime']['day'] . ' ' . $data['opentime']['hour'] . ':' . $data['opentime']['mintue'] . ':0');
}
$data['closetime'] = MooGetGPC('closetime', 'array', 'P');
if (empty($data['closetime']['day'])) {
$data['closetime'] = 0;
} else {
$data['closetime'] = strtotime($data['closetime']['day'] . ' ' . $data['closetime']['hour'] . ':' . $data['closetime']['mintue'] . ':0');
}
$data['issex'] = MooGetGPC('issex', 'string', 'P');
$data['issex'] = $data['issex'] < 1 ? 100 : ($data['issex'] > 100 ? 100 : $data['issex']);
$data['province'] = MooGetGPC('province', 'integer', 'P');
$data['city'] = MooGetGPC('city', 'integer', 'P');
$data['activity_img'] = 'module/activity/templates/default/images/activity_new/' . MooGetGPC('img', 'string', 'P');
$data['href'] = 'index.php?n=activity&h=' . MooGetGPC('href', 'string', 'P');
$data['place'] = htmlspecialchars(trim(MooGetGPC('place', 'string', 'P')));
$data['profile'] = htmlspecialchars(trim(MooGetGPC('profile', 'string', 'P')));
$data['introduction'] = htmlspecialchars(trim(MooGetGPC('introduction', 'string', 'P')));
$data['regtime'] = time();
$data['adminid'] = $GLOBALS['adminid'];
$id = inserttable('activity', $data, true);
if (empty($id)) {
MooMessageAdmin('活动添加失败,请联系技术支持,或者重新填写表单项', 'index.php?action=active_activity&h=add');
exit;
} else {
MooMessageAdmin('活动添加成功', 'index.php?action=active_activity&h=add');
exit;
}
}
require adminTemplate('active_activity_detail');
}
示例6: post
function post($uId, $message, $clientIdentify, $ip = '')
{
$fields = array('uid' => $uId, 'message' => $message, 'from' => $clientIdentify, 'dateline' => time());
if ($ip) {
$fields['ip'] = $ip;
}
$result = inserttable('doing', $fields, 1);
return new APIResponse($result);
}
示例7: addComment
function addComment($type, $id)
{
global $_MooClass, $dbTablePre, $user_arr;
$content = Text2Html(MooGetGPC('content', 'string', 'P'));
$temp = mb_convert_encoding($content, 'gbk', 'utf-8');
if ($content == '' || isset($temp[220])) {
return false;
}
$arr_in = array('type' => $type, 'id' => $id, 'uid' => $user_arr['uid'], 'username' => $user_arr['nickname'], 'dateline' => time(), 'ischeck' => 0, 'comment' => $content);
return inserttable('comment', $arr_in, 1);
}
示例8: add
/**
* 添加信息
*
* @param unknown_type $garray
* @return unknown
*/
function add($dataarray)
{
if (is_array($dataarray)) {
$oid = inserttable($this->table, $dataarray, 1);
if (is_numeric($oid)) {
return $oid;
} else {
return lang('insert_data_error');
}
}
return lang('datatype_error');
}
示例9: cron_config
function cron_config()
{
global $_SGLOBAL;
//下次执行cron时间
$query = $_SGLOBAL['db']->query("SELECT nextrun FROM " . tname('cron') . " WHERE available>'0' ORDER BY nextrun LIMIT 1");
$nextrun = $_SGLOBAL['db']->result($query, 0);
if (empty($nextrun)) {
$nextrun = 0;
}
//更新config
inserttable('config', array('var' => 'cronnextrun', 'datavalue' => $nextrun), 0, true);
include_once S_ROOT . './source/function_cache.php';
config_cache(false);
}
示例10: email_reg
function email_reg($email, $backurl = '')
{
global $_SGLOBAL, $_SC;
$email_reg['email'] = $email;
$email_reg['ip'] = getonlineip(1);
$email_reg['salt'] = random(6);
$email_reg['hash'] = substr(md5(md5($email) . $email_reg['salt']), 8, 7);
$email_reg['addtime'] = $_SGLOBAL['timestamp'];
$email_reg['used'] = 0;
$email_reg['backurl'] = $backurl;
$id = inserttable(tname("open_email_reg"), $email_reg, 1, 1);
$h = $email_reg['hash'];
return $_SC['site_host'] . "/?r=" . $h;
}
示例11: add
function add($uId, $appId, $appName, $privacy, $allowSideNav, $allowFeed, $allowProfileLink, $defaultBoxType, $defaultMYML, $defaultProfileLink, $version, $displayMethod, $displayOrder = null) {
$sql = sprintf('SELECT appid FROM %s WHERE uid = %d AND appid = %d', $GLOBALS['tablepre'].'userapp', $uId, $appId);
$query = $GLOBALS['db']->query($sql);
$row = $GLOBALS['db']->fetch_array($query);
if($row['appid']) {
$errCode = '170';
$errMessage = 'Application has been already added';
return new APIErrorResponse($errCode, $errMessage);
}
switch($privacy) {
case 'public':
$privacy = 0;
break;
case 'friends':
$privacy = 1;
break;
case 'me':
$privacy = 3;
break;
case 'none':
$privacy = 5;
break;
default:
$privacy = 0;
}
$narrow = ($defaultBoxType == 'narrow') ? 1 : 0;
$fields = array(
'appid' => $appId,
'appname' => $appName,
'uid' => $uId,
'privacy' => $privacy,
'allowsidenav' => $allowSideNav,
'allowfeed' => $allowFeed,
'allowprofilelink' => $allowProfileLink,
'narrow' => $narrow,
'profilelink' => $defaultProfileLink,
'myml' => $defaultMYML
);
if($displayOrder !== null) {
$fields['displayOrder'] = $displayOrder;
}
$result = inserttable('userapp', $fields, 1);
$displayMethod = ($displayMethod == 'iframe') ? 1 : 0;
$this->refreshApplication($appId, $appName, $version, $displayMethod, $narrow, null, null);
return new APIResponse($result);
}
示例12: insertsession
function insertsession($setarr)
{
global $_SGLOBAL, $_SCONFIG;
$_SCONFIG['onlinehold'] = intval($_SCONFIG['onlinehold']);
if ($_SCONFIG['onlinehold'] < 300) {
$_SCONFIG['onlinehold'] = 300;
}
$_SGLOBAL['db']->query("DELETE FROM " . tname('session') . " WHERE uid='{$setarr['uid']}' OR lastactivity<'" . ($_SGLOBAL['timestamp'] - $_SCONFIG['onlinehold']) . "'");
//添加在线
$ip = getonlineip(1);
$setarr['lastactivity'] = $_SGLOBAL['timestamp'];
$setarr['ip'] = $ip;
inserttable('session', $setarr, 0, true, 1);
//更新用户
updatetable('space', array('lastlogin' => $_SGLOBAL['timestamp'], 'ip' => $ip), array('uid' => $setarr['uid']), 1);
}
示例13: send
function send($uId, $recipientIds, $appId, $requestName, $myml, $type)
{
global $_SGLOBAL;
include_once S_ROOT . './source/function_cp.php';
$now = time();
$result = array();
$type = $type == 'request' ? 1 : 0;
$fields = array('typename' => $requestName, 'appid' => $appId, 'type' => $type, 'fromuid' => $uId, 'dateline' => $now);
foreach ($recipientIds as $key => $val) {
$hash = crc32($appId . $val . $now . rand(0, 1000));
$hash = sprintf('%u', $hash);
$fields['touid'] = intval($val);
$fields['hash'] = $hash;
$fields['myml'] = str_replace('{{MyReqHash}}', $hash, $myml);
$result[] = inserttable('myinvite', $fields, 1);
}
return new APIResponse($result);
}
示例14: system_adminteam_addteam
function system_adminteam_addteam()
{
if ($_POST) {
$manage_list = MooGetGPC('grouparr', 'string', 'P');
if ($manage_list) {
$manage_list = array_unique($manage_list);
$arr['manage_list'] = implode(',', $manage_list);
}
$arr['manage_name'] = MooGetGPC('manage_name', 'string', 'P');
$arr['manage_desc'] = MooGetGPC('manage_desc', 'string', 'P');
$arr['leader_uid'] = MooGetGPC('team_leader', 'string', 'P');
$arr['type'] = 2;
inserttable('admin_manage', $arr);
salert('添加成功');
exit;
}
require_once adminTemplate('adminteam_addteam');
}
示例15: system_adminmanage_addgroup
function system_adminmanage_addgroup()
{
if ($_POST) {
$manage_list = MooGetGPC('userlist', 'string', 'P');
if ($manage_list) {
$manage_list = array_unique($manage_list);
$arr['manage_list'] = implode(',', $manage_list);
}
$arr['manage_name'] = MooGetGPC('manage_name', 'string', 'P');
$arr['manage_desc'] = MooGetGPC('manage_desc', 'string', 'P');
$arr['manage_type'] = MooGetGPC('manage_type', 'integer', 'P');
$arr['type'] = 1;
$arr['dateline'] = time();
inserttable('admin_manage', $arr);
salert('添加成功');
exit;
}
require_once adminTemplate('adminmanage_addgroup');
}