本文整理汇总了PHP中lazy_run_sql函数的典型用法代码示例。如果您正苦于以下问题:PHP lazy_run_sql函数的具体用法?PHP lazy_run_sql怎么用?PHP lazy_run_sql使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了lazy_run_sql函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buy
function buy($number, $uid = NULL)
{
$uid = format_uid($uid);
$money = intval(c('invite_price')) * $number;
$key = c('invite_use_gold') ? 'gold' : 'g';
$this->db->select($key)->from('app_ihome_user')->where('uid', $uid)->limit(1);
$now = lazy_get_var();
if ($now < $money) {
return false;
}
$sql = "UPDATE app_ihome_user SET {$key} = {$key} - {$money} WHERE uid = '{$uid}'";
lazy_run_sql($sql);
$data = array();
$data['u2_uid'] = $uid;
$data['u2_is_use'] = '0';
$data['u2_is_copied'] = '0';
$data['u2_date'] = date("Y-m-d");
while ($number > 0) {
do {
$icode = newpassword();
$check = $this->count_invite_code($icode);
} while ($check);
$data['u2_invite_code'] = $icode;
$this->db->insert('u2_invite', $data);
$number--;
}
return true;
}
示例2: get_view_uids
function get_view_uids($mid, $cid, $limit = 5)
{
$uids = lazy_get_vars("select `uid` from `u2_app_view` where `mid` = '{$mid}' and `cid` = '{$cid}' order by `id` desc limit {$limit}");
if (is_login()) {
$sql = "replace into `u2_app_view` (`mid`,`cid`,`uid`,`time`)values('{$mid}','{$cid}','" . format_uid() . "','" . date("Y-m-d H:i:s") . "')";
lazy_run_sql($sql);
}
return $uids;
}
示例3: iforum_save_cates
function iforum_save_cates($fid, $key, $desp)
{
if ($desp) {
$sql = "REPLACE INTO `app_iforum_cate` (`fid`,`key`,`desp`)VALUES('" . intval($fid) . "','" . intval($key) . "'," . s($desp) . ")";
lazy_run_sql($sql);
} else {
$sql = "UPDATE `app_iforum_posts` SET `type` = '0' WHERE `fid` = '" . intval($fid) . "' AND `type` = '" . intval($key) . "'";
lazy_run_sql($sql);
$sql = "DELETE FROM `app_iforum_cate` WHERE `fid` = '" . intval($fid) . "' AND `key` = '" . intval($key) . "' ";
lazy_run_sql($sql);
}
}
示例4: newone
function newone()
{
echo _sess('u2_first_time');
echo _sess('u2_inviter_uid');
echo _sess('u2_inviter_nickname');
//set_sess( 'u2_first_time' , '1' );
//info_page( 'ok' );
// add money
$sql = "INSERT INTO `app_ibank_account` ( `uid` , `g_count` , `gold_count` ) VALUES ( '" . format_uid() . "' , '" . intval(c('user_init_silver')) . "' , '" . intval(c('user_init_gold')) . "' ) ";
lazy_run_sql($sql);
// add cloth
$sql = "INSERT INTO `app_ihome_shop` ( `uid` , `item_id` ) VALUES ( '" . format_uid() . "' , '844' ) , ( '" . format_uid() . "' , '879' )";
lazy_run_sql($sql);
echo mysql_error();
info_page('初始化完毕');
}
示例5: info_page
if (!$feed || $feed == 'http://') {
info_page('你提交的博客地址错误');
}
if (strpos($feed, 'http://') === false) {
$feed = 'http://' . $feed;
}
}
$CI =& get_instance();
$CI->load->library('simplepie');
MakeDir(ROOT . 'static/data/cache');
$CI->simplepie->set_cache_location(ROOT . 'static/data/cache');
$CI->simplepie->set_feed_url($feed);
$CI->simplepie->init();
$data['ftitle'] = $CI->simplepie->get_title();
//标题
$flink = $CI->simplepie->get_link();
//连接地址
if (!$flink) {
$flink = $feed;
}
$data['flink'] = $flink;
//delete feed
lazy_run_sql("DELETE FROM `app_feed_recommend` WHERE `feed` = '" . $feed . "'");
//type list
foreach (app_config('titles') as $k => $v) {
$titles[$k] = $v;
}
unset($titles[1]);
$data['fselect'] = $titles;
$data['state'] = app_config('state');
layout($data, 'default', 'app');
示例6: format_uid
$uid = format_uid();
$insert_feed = "INSERT INTO `app_feed` (`feed`, `tid`, `uid`, `title`, `time`, `img`, `state`) VALUES";
$insert_feed .= "(" . s($feed) . ", '" . intval($tid) . "', '" . intval($uid) . "', " . s($title) . ", '" . date('Y-m-d H:i:s') . "', '" . $img . "' , '" . $status . "')";
lazy_run_sql($insert_feed);
$fid = lazy_last_id();
//add feed item
$CI =& get_instance();
$CI->load->library('simplepie');
//MakeDir(ROOT.'static/data/cache');
//$CI->simplepie->set_cache_location(ROOT.'static/data/cache');
$CI->simplepie->set_feed_url($feed);
$CI->simplepie->init();
$items = $CI->simplepie->get_items();
$values = array();
foreach ($items as $k => $v) {
$title = $v->get_title();
// 标题
$desp = $v->get_content();
// 内容
$link = $v->get_link();
//连接
$date = date('Y-m-d H:i:s', strtotime($v->get_date()));
$unistring = md5($link) . $date;
$values[] = "('" . intval($tid) . "', '" . intval($fid) . "', " . s($title) . ", " . s($desp) . ", '" . $date . "' , '" . $link . "', '" . $status . "', " . s($unistring) . ", '" . intval($uid) . "')";
}
$sql_insert_item = "INSERT INTO `app_feed_item` (`tid`, `fid`, `title`, `desp`, `time`, `link`, `state`, `unistring`, `admin_uid`) VALUES " . join(',', $values) . "";
//echo $sql_insert_item;
lazy_run_sql($sql_insert_item);
info_page("Feed成功保存!", "/app/native/" . $GLOBALS['app'] . "/feed/", "返回管理");
?>
示例7: dirname
<?php
include_once dirname(__FILE__) . '/function.php';
if (!is_login()) {
info_page('请登录后查看');
}
if (!is_admin()) {
info_page('你没有权限进行操作!');
}
$fid = intval(v('fid'));
if (!isset($fid) || $fid < 1) {
info_page("ID错误!");
}
lazy_run_sql("DELETE FROM `app_feed_item` WHERE `fid` = '" . intval($fid) . "'");
lazy_run_sql("DELETE FROM `app_feed` WHERE `id` = '" . intval($fid) . "' LIMIT 1");
info_page('成功删除!', '/app/native/' . $GLOBALS['app'] . '/feed', '点击这里返回!');
?>
示例8: dirname
<?php
include_once dirname(__FILE__) . '/function.php';
if (!is_login()) {
info_page('请登录后查看');
}
$id = intval(v('id'));
$title = z(trim(v('title')));
$step = intval(v('step'));
$desp = x(v('desp'));
$uid = format_uid();
if (empty($title) || empty($desp)) {
info_page('标题或内容不能为空!');
}
if ($id < 1) {
info_page('参数错误!');
}
lazy_run_sql("update `u2_comment` set `step` = '{$step}' where `tid` = '{$id}' and `uid` = '{$uid}' and `mid` = '{$mid}' ");
$sql = "INSERT INTO `u2_comment` (`tid`, `mid`, `uid`, `title`, `content`, `time`, `step`) VALUES ('" . intval($id) . "' , '" . intval($mid) . "' , '" . intval($uid) . "' , " . s($title) . " , " . s($desp) . " , '" . date('Y-m-d H:i:s') . "' , '" . intval($step) . "')";
lazy_run_sql($sql);
lazy_run_sql("UPDATE `app_content_{$mid}` SET `comnum` = `comnum`+1 WHERE `id` = '" . intval($id) . "'");
lazy_run_sql("replace into `u2_rate` (`uid` , `mid` , `cid` , `rate` , `time` )values('{$uid}','{$mid}','{$id}','{$step}' , '" . date("Y-m-d H:i:s") . "')");
header('Location: /app/native/' . $GLOBALS['app'] . '/display/' . $id . '');
die;
示例9: array
//应付
$stint = $money - $money_end;
//节省
$data = array();
$data['uid'] = intval($uid);
$data['toname'] = $toname;
$data['totell'] = $totell;
$data['tocode'] = intval($tocode);
$data['tohome'] = $tohome;
$data['need'] = $need;
$data['carry_type'] = intval($carry);
$data['pack_type'] = intval($pack);
$data['ware'] = $ware;
$data['money'] = $money_end;
$data['stint'] = $stint;
$data['time'] = time();
$data['enter'] = 0;
global $CI;
$CI->load->database();
$CI->db->insert('app_shoporder', $data);
$data['id'] = $id = $CI->db->insert_id();
$name_num = lazy_get_var("SELECT COUNT(*) FROM `app_shopuser` WHERE `uid` = '" . intval($uid) . "' AND `name` = " . s($toname) . " ");
if ($name_num == '0') {
$sql = "INSERT INTO `app_shopuser` (`uid`, `name`, `tell`, `code`, `home`)";
$sql .= "VALUES ('" . intval($uid) . "' , " . s($toname) . ", " . s($totell) . ", '" . intval($tocode) . "', " . s($tohome) . ")";
lazy_run_sql($sql);
} else {
lazy_run_sql("UPDATE `app_shopuser` SET `tell` = " . s($totell) . " , `code` = '" . intval($tocode) . "', `home` = " . s($tohome) . " WHERE `id` = '" . intval($suid) . "'");
}
lazy_run_sql("DELETE FROM `app_shopcart` WHERE `uid` = '" . intval($uid) . "'");
layout($data, 'default', 'app');
示例10: dirname
<?php
include_once dirname(__FILE__) . '/function.php';
if (!is_login()) {
info_page('请登录后查看');
}
$cid = intval(array_shift($args));
$uid = format_uid();
$num = lazy_get_var("SELECT `uid` FROM `app_content_{$mid}` WHERE `id` = '" . intval($cid) . "' limit 1");
if (!$num) {
info_page('错误的参数');
}
if ($num != $uid) {
info_page('您没有权限进行此操作');
}
$com = lazy_get_var("SELECT COUNT(*) FROM `u2_comment` WHERE `tid` = '" . intval($cid) . "'");
if ($com != '0') {
lazy_run_sql("DELETE FROM `u2_comment` WHERE `tid` = '" . $cid . "'");
lazy_run_sql("DELETE FROM `u2_comment_vote` WHERE `tid` = '" . $cid . "'");
lazy_run_sql("DELETE FROM `u2_comment_reply` WHERE `tid` = '" . $cid . "'");
}
lazy_run_sql("DELETE FROM `app_content_{$mid}` WHERE `id` = '" . intval($cid) . "'");
lazy_run_sql("DELETE FROM `u2_comment_reply` WHERE `tid` = '" . $cid . "'");
lazy_run_sql("DELETE FROM `u2_manager` WHERE `tid` = '" . intval($cid) . "' AND `u2_table` = 'app_content_{$mid}' ");
lazy_run_sql("DELETE FROM `u2_rate` WHERE `cid` = '" . intval($cid) . "' AND `mid` = '{$mid}' ");
info_page('成功删除' . app_config('model_name'), '/app/native/' . $GLOBALS['app'] . '/', '返回');
?>
示例11: header
<?php
//include_once( dirname( __FILE__ ) . '/function.php' );
header("Content-Type:text/xml;charset=utf-8");
header("Expires: Thu, 01 Jan 1970 00:00:01 GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
if (!is_login()) {
info_page('请登录后查看');
}
if (!is_admin()) {
info_page('你没有权限进行此次操作!');
}
$id = intval(array_shift($args));
$sid = intval(array_shift($args));
lazy_run_sql("UPDATE `app_feed_item` SET `state` = '" . intval($sid) . "' WHERE `id` = '" . intval($id) . "'");
//$uid = format_uid();
if ($sid == '1') {
echo "<span style='float:right'>\n\t\t <span id='state_" . $id . "'><img src='/static/images/tick.gif'></span>\n\t\t <INPUT TYPE='checkbox' onclick='Change_state( " . $id . " , 2)'>通过\n\t\t </span>";
} else {
echo "<span style='float:right'>\n\t\t <span id='state_" . $id . "'><img src='/static/images/tick.gif'></span>\n\t\t <INPUT TYPE='checkbox' onclick='Change_state( " . $id . " , 1)' checked>通过\n\t\t </span>";
}
die;
示例12: shop_update_type
private function shop_update_type($args)
{
$id = intval(array_shift($args));
$line = $this->admin->get_shop_type_by_id($id);
if (!$line) {
info_page('此商品类型已被删除', '/admin/shop/add/type/', '添加商品类型');
}
$data['name'] = z(v('name'));
if (!$data['name']) {
info_page('请填写商品类型名称');
}
if ($line['name'] != $data['name']) {
if ($this->admin->check_shop_type($data['name'])) {
info_page("错误, 已存在此商品类型");
}
}
$brand_array = v('brand');
if (v('all_brand')) {
$brand_array = array();
}
$extra_field = v('extra_field');
$field = array();
$sql_fields = array();
if ($extra_field) {
foreach ($extra_field as $v) {
if ($v) {
$v = unserialize(base64_decode($v));
$field[$v['id']] = $v;
$sql_fields[] = '`extra_' . $v['id'] . '` varchar( 255 ) NULL';
}
}
}
$extra['field'] = $field;
$extra['brands'] = $brand_array;
$data['extra'] = serialize($extra);
$this->admin->update_shop_type($data, $id);
$new = $field;
$line['extra'] = unserialize($line['extra']);
$old = $line['extra']['field'];
if (!$new) {
$eid = lazy_get_var("SHOW TABLES LIKE 'shop_extra_" . intval($id) . "' ");
if ($eid) {
lazy_run_sql("DROP TABLE `shop_extra_" . intval($id) . "`");
}
} elseif (!$old && $sql_fields) {
lazy_run_sql('CREATE TABLE IF NOT EXISTS `shop_extra_' . $line['id'] . '`(`id` int(11) NOT NULL auto_increment,`cid` int(11) NOT NULL ,' . join(',', $sql_fields) . ' ,PRIMARY KEY (`id`) ) ENGINE=MyISAM ;');
} else {
$acts = array();
foreach ($new as $v) {
if (isset($old[$v['id']])) {
unset($old[$v['id']]);
} else {
$acts[] = 'ADD `extra_' . $v['id'] . '` VARCHAR( 255 ) NULL ';
}
}
if ($old) {
foreach ($old as $v) {
$acts[] = 'DROP `extra_' . $v['id'] . '`';
}
}
if ($acts) {
lazy_run_sql("ALTER TABLE `shop_extra_" . intval($id) . "` " . join(',', $acts) . ";");
}
}
info_page("修改商品类型成功", '/admin/shop/modify/type/' . $id, '返回');
}
示例13: widgets_update
function widgets_update()
{
if (!is_login()) {
info_page('请登录后查看');
}
if (!is_admin()) {
info_page('你没有权限进行操作!');
}
$id = intval(v('id'));
$name = strip_tags(trim(v('name')));
$desp = strip_tags(v('desp'));
$pic = strip_tags(v('plugs_file'));
$big_pic = strip_tags(v('plugsbig_file'));
if ($id < 1) {
info_page('微件ID错误!');
}
$mid = lazy_get_var("SELECT `mid` FROM `u2_plugs_widget` WHERE `id` = '" . intval($id) . "'");
if (!$mid) {
info_page('微件ID错误!');
}
if ($name == '') {
info_page('微件名称不能为空!');
}
if ($desp == '') {
info_page('请填写微件简介!');
}
$widgets_update = "UPDATE `u2_plugs_widget` SET `name` = " . s($name) . ", `pic` = " . s($pic) . ", `big_pic` = " . s($big_pic) . ",";
$widgets_update .= "`desp` = " . s($desp) . ", `time` = '" . date('Y-m-d') . "' ";
$widgets_update .= "WHERE `id` = '" . intval($id) . "'";
//echo $widgets_update;
lazy_run_sql($widgets_update);
info_page('修改成功!', '/plugs/index/' . $mid, '| 返回');
}
示例14: dirname
<?php
include_once dirname(__FILE__) . '/function.php';
if (!is_login()) {
info_page('请登录后查看');
}
$id = intval(array_shift($args));
$page = intval(array_shift($args));
$return_page = intval(array_shift($args));
$return_key = intval(array_shift($args));
$line = lazy_get_line("SELECT * FROM `app_iforum_posts` WHERE id = '{$id}' AND `is_active` = 1 LIMIT 1");
if (!$line || $line['uid'] != format_uid()) {
info_page('你没有权限进行此操作');
}
if ($line['parent_id'] != '0') {
$desp = v('desp');
if (!$desp) {
info_page('内容不能为空@');
}
lazy_run_sql("update `app_iforum_posts` set `desp` = " . s($desp) . " WHERE id = '{$id}' LIMIT 1 ");
} else {
$title = htmlspecialchars(z(v('title')));
$type = intval(v('type'));
$desp = v('desp');
if (!$title || !$desp) {
info_page('标题和内容不能为空');
}
lazy_run_sql("update `app_iforum_posts` set `title` = '{$title}' ,`desp`=" . s($desp) . ", `type` = '{$type}' WHERE id = '{$id}' LIMIT 1 ");
}
$dis_id = $line['parent_id'] == '0' ? $id : $line['parent_id'];
header("Location: /app/native/iforum/display/" . $dis_id . '/' . $page . '/' . $return_page . '/' . $return_key);
示例15: lazy_get_line
$item = lazy_get_line("select * FROM `global_items` WHERE `id` = '{$id}' limit 1 ");
if (!$item) {
die('没有找道具资料');
}
//装备检查
$weared = lazy_get_var("select count(*) from `global_items_carry` where `iid`='{$id}' and `uid` = '{$uid}' ");
if ($weared) {
die('你已经携带了此道具');
}
$weared_count = lazy_get_var("select count(*) from `global_items_carry` where `uid` = '{$uid}' ");
if ($weared_count >= 5) {
die('你已经不能再携带东西了');
}
if ($count == '1') {
lazy_run_sql("DELETE FROM `global_user_items` WHERE `uid` ='{$uid}' and `iid` = '{$id}' limit 1 ");
$js_data[] = '$("item_' . $id . '").remove()';
$js_data[] = '$("baggage_count").value =parseInt($("baggage_count").value) - 1 ';
} else {
lazy_run_sql("UPDATE `global_user_items` SET `count` = `count` - 1 WHERE `uid` = '{$uid}' and `iid` = '{$id}' limit 1 ");
$js_data[] = '$("item_count_value_' . $id . '").value = parseInt($("item_count_value_' . $id . '").value ) - 1 ';
$js_data[] = '$("item_count_' . $id . '").innerHTML =$("item_count_value_' . $id . '").value';
}
lazy_run_sql("INSERT INTO `global_items_carry` (`uid` , `iid` ,`taked` )VALUES('{$uid}','{$item['id']}' , '0' ) ");
$js_data[] = 'ihome_carry_item("' . $id . '","' . $item['pic'] . '" ,"' . $item['desp'] . '")';
//$js_data[] = '$("wear_'.$item['type'].'").setHTML("<a href=\"JavaScript:irpg_unset_item('.$item['id'].')\"><img src=\''.$item['pic'].'\' alt=\"'.$item['desp'].'\" /></a>")';
$display = '您携带了' . $item['name'];
echo $display;
if ($js_data) {
$js_code = '<script>' . join(';', $js_data) . ';</script>';
echo $js_code;
}