本文整理汇总了PHP中set_vars函数的典型用法代码示例。如果您正苦于以下问题:PHP set_vars函数的具体用法?PHP set_vars怎么用?PHP set_vars使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_vars函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_categories
function get_categories()
{
global $db;
$cat_info = get_vars("category");
$this->priority = $this->cat_priority;
if (!is_array($cat_info)) {
$cat_info = array();
$db->query("SELECT * FROM " . PREFIX . "_category ORDER BY posi ASC");
while ($row = $db->get_row()) {
$cat_info[$row['id']] = array();
foreach ($row as $key => $value) {
$cat_info[$row['id']][$key] = $value;
}
}
set_vars("category", $cat_info);
$db->free();
}
$xml = "";
$lastmod = date("Y-m-d");
foreach ($cat_info as $cats) {
if ($this->allow_url == "yes") {
$loc = $this->home . $this->get_url($cats[id], $cat_info) . "/";
} else {
$loc = $this->home . "index.php?do=cat&category=" . $cats['alt_name'];
}
$xml .= $this->get_xml($loc, $lastmod);
}
return $xml;
}
示例2: page
function page()
{
global $G;
set_vars();
require_once HEADER;
require_once BODY;
require_once FOOTER;
exit;
}
示例3: page
function page($p)
{
global $CRUD;
// used in the required files
if (!$p) {
$p = "main";
}
set_vars();
require_once "assets/header.php";
require_once "assets/{$p}.php";
require_once "assets/footer.php";
exit;
}
示例4: Cookies
<?php
require_once __DIR__ . '/../all.php';
$cookies = new Cookies();
$user = $cookies->user_from_cookie();
$vars = array("id");
if (set_vars($_POST, $vars) && $user !== 0) {
DB::delete("category_items", "id=%s", $_POST["id"]);
}
header("Location: /admin.php?p=3");
exit;
示例5: array
$_POST['limit'] = 0;
$member_id = array();
$user_group = array();
$member_id['user_group'] = 1;
$user_group[$member_id['user_group']]['admin_googlemap'] = 1;
$cat_info = get_vars("category");
if (!is_array($cat_info)) {
$cat_info = array();
$db->query("SELECT * FROM " . PREFIX . "_category ORDER BY posi ASC");
while ($row = $db->get_row()) {
$cat_info[$row['id']] = array();
foreach ($row as $key => $value) {
$cat_info[$row['id']][$key] = stripslashes($value);
}
}
set_vars("category", $cat_info);
$db->free();
}
if (count($cat_info)) {
foreach ($cat_info as $key) {
$cat[$key['id']] = $key['name'];
$cat_parentid[$key['id']] = $key['parentid'];
}
}
include_once ROOT_DIR . '/engine/inc/googlemap.php';
die("done");
} elseif ($cronmode == "optimize") {
$arr = array();
$db->query("SHOW TABLES");
while ($row = $db->get_array()) {
if (substr($row[0], 0, strlen(PREFIX)) == PREFIX) {
示例6: array
$banned_info = array();
$db->query("SELECT * FROM " . USERPREFIX . "_banned");
while ($row = $db->get_row()) {
if ($row['users_id']) {
$banned_info['users_id'][$row['users_id']] = array('users_id' => $row['users_id'], 'descr' => stripslashes($row['descr']), 'date' => $row['date']);
} else {
if (count(explode(".", $row['ip'])) == 4) {
$banned_info['ip'][$row['ip']] = array('ip' => $row['ip'], 'descr' => stripslashes($row['descr']), 'date' => $row['date']);
} elseif (strpos($row['ip'], "@") !== false) {
$banned_info['email'][$row['ip']] = array('email' => $row['ip'], 'descr' => stripslashes($row['descr']), 'date' => $row['date']);
} else {
$banned_info['name'][$row['ip']] = array('name' => $row['ip'], 'descr' => stripslashes($row['descr']), 'date' => $row['date']);
}
}
}
set_vars("banned", $banned_info);
$db->free();
}
if ($config["lang_" . $_REQUEST['skin']]) {
if (file_exists(ROOT_DIR . '/language/' . $config["lang_" . $_REQUEST['skin']] . '/website.lng')) {
@(include_once ROOT_DIR . '/language/' . $config["lang_" . $_REQUEST['skin']] . '/website.lng');
} else {
die("Language file not found");
}
} else {
@(include_once ROOT_DIR . '/language/' . $config['langs'] . '/website.lng');
}
$config['charset'] = $lang['charset'] != '' ? $lang['charset'] : $config['charset'];
$is_logged = false;
$member_id = array();
if ($config['allow_registration'] == "yes") {
示例7: Cookies
<?php
require_once __DIR__ . '/../all.php';
$cookies = new Cookies();
$user = $cookies->user_from_cookie();
$vars = array("id", "service_id");
if (set_vars($_POST, $vars)) {
if ($user->data["permission"] === "4" || $user->data["permission"] === "3" && $user->data["service_id"] === $_POST["service_id"]) {
// DB::insert("menu_sides", array("name"=>$_POST["name"], "price"=>$_POST["price"], "required"=>$_POST["req"], "service_id"=>$_POST["service_id"]));
DB::delete("menu_categories", "id=%d", $_POST["id"]);
echo DB::affectedRows();
} else {
echo "-1";
}
} else {
echo "-1";
}
示例8: Copyright
-----------------------------------------------------
http://dle-news.ru/
-----------------------------------------------------
Copyright (c) 2004,2013 SoftNews Media Group
=====================================================
Данный код защищен авторскими правами
=====================================================
Файл: cron.php
-----------------------------------------------------
Назначение: Выполнение автоматических операций
=====================================================
*/
if (!defined('DATALIFEENGINE')) {
die("Hacking attempt!");
}
set_vars("cron", $_TIME);
if ($cron == 1) {
$db->query("DELETE FROM " . PREFIX . "_spam_log WHERE is_spammer = '0'");
}
if ($config['cache_count']) {
$result = $db->query("SELECT COUNT(*) as count, news_id FROM " . PREFIX . "_views GROUP BY news_id");
while ($row = $db->get_array($result)) {
$db->query("UPDATE " . PREFIX . "_post_extras SET news_read=news_read+{$row['count']} WHERE news_id='{$row['news_id']}'");
}
$db->free($result);
$db->query("TRUNCATE TABLE " . PREFIX . "_views");
clear_cache(array('news_', 'full_', 'rss'));
}
if ($cron == 2) {
$db->query("TRUNCATE TABLE " . PREFIX . "_login_log");
$db->query("TRUNCATE TABLE " . PREFIX . "_flood");
示例9: CheckLogin
private function CheckLogin()
{
if ($_SESSION['dle_log'] >= 5) {
die("Hacking attempt!");
}
$GLOBALS['user_group'] = get_vars("usergroup");
if (!$GLOBALS['user_group']) {
$GLOBALS['user_group'] = array();
$this->db->query("SELECT * FROM " . USERPREFIX . "_usergroups ORDER BY id ASC");
while ($row = $this->db->get_row()) {
$GLOBALS['user_group'][$row['id']] = array();
foreach ($row as $key => $value) {
$GLOBALS['user_group'][$row['id']][$key] = $value;
}
}
set_vars("usergroup", $GLOBALS['user_group']);
$this->db->free();
}
$hash_pass = md5(md5($_POST['password']));
$login = $this->db->safesql($_POST['name']);
if ($GLOBALS['member_id'] = $this->db->super_query("SELECT * FROM " . USERPREFIX . "_users WHERE name='{$login}' AND password='{$hash_pass}'")) {
if (!defined('DOMAIN')) {
define('DOMAIN', "." . $_SERVER['HTTP_HOST']);
}
setcookie("dle_password", md5($_POST['password']), time() + 3600 * 24 * 365, "/", DOMAIN, NULL, TRUE);
@session_register('dle_password');
@session_register('member_lasttime');
if ($GLOBALS['config']['version_id'] < 7.2) {
@session_register('dle_name');
setcookie("dle_name", $_POST['name'], time() + 3600 * 24 * 365, "/", DOMAIN, NULL, TRUE);
$_SESSION['dle_name'] = $_POST['name'];
} else {
@session_register('dle_user_id');
setcookie("dle_user_id", $GLOBALS['member_id']['user_id'], time() + 3600 * 24 * 365, "/", DOMAIN, NULL, TRUE);
$_SESSION['dle_user_id'] = $GLOBALS['member_id']['user_id'];
}
$_SESSION['dle_password'] = md5($_POST['password']);
$_SESSION['dle_log'] = 0;
return true;
} else {
$_SESSION['dle_log']++;
return false;
}
}
示例10: page
function page()
{
global $SID;
set_vars();
require_once "assets/header.php";
require_once "assets/main.php";
require_once "assets/footer.php";
}
示例11: die
if (!defined('DATALIFEENGINE')) {
die("Hacking attempt!");
}
define('BANNERS', 1);
//################# Определение баннеров
$banners = get_vars("banners");
if (!is_array($banners)) {
$banners = array();
$db->query("SELECT * FROM " . PREFIX . "_banners ORDER BY id ASC");
while ($row_b = $db->get_row()) {
$banners[$row_b['id']] = array();
foreach ($row_b as $key => $value) {
$banners[$row_b['id']][$key] = $value;
}
}
set_vars("banners", $banners);
$db->free();
}
$ban = array();
$banner_in_news = array();
if (count($banners) > 0) {
foreach ($banners as $name => $value) {
if ($value['approve']) {
//если активный
if ($value['category']) {
$value['category'] = explode(',', $value['category']);
if (!in_array($category_id, $value['category'])) {
$value['code'] = "";
}
}
if ($value['main']) {
示例12: die
die("Hacking attempt!");
}
$replace_links = array();
//################# Определение ссылок
$links = get_vars("links");
if (!is_array($links)) {
$links = array();
$db->query("SELECT * FROM " . PREFIX . "_links ORDER BY id DESC");
while ($row_b = $db->get_row()) {
$links[$row_b['id']] = array();
foreach ($row_b as $key => $value) {
$links[$row_b['id']][$key] = stripslashes($value);
}
}
usort($links, "cmplinks");
set_vars("links", $links);
$db->free();
}
function cmplinks($a, $b)
{
global $config;
return dle_strlen($b['word'], $config['charset']) - dle_strlen($a['word'], $config['charset']);
}
function comparehosts($a, $b)
{
$a = str_replace("http://", "", strtolower($a));
$a = str_replace("https://", "", $a);
if (substr($a, 0, 2) == '//') {
$a = str_replace("//", "", $a);
}
if (substr($a, 0, 4) == 'www.') {
示例13: _online_block
//.........这里部分代码省略.........
}
} else {
$users[$user['userid']]['username'] = $user['username'];
$users[$user['userid']]['lastactivity'] = $user['lastactivity'];
$users[$user['userid']]['useragent'] = $user['useragent'];
$users[$user['userid']]['host'] = $user['host'];
$users[$user['userid']]['location'] = $user['location'];
}
}
$location_array = array("%addcomments%" => $this->lang['paddcomments'], "%readnews%" => $this->lang['preadnews'], "%incategory%" => $this->lang['pincategory'], "%posin%" => $this->lang['pposin'], "%mainpage%" => $this->lang['pmainpage'], "%view_pofile%" => $this->lang['view_profile'], "%newposts%" => $this->lang['newposts'], "%view_stats%" => $this->lang['view_stats']);
if (count($users)) {
foreach ($users as $id => $value) {
if ($GLOBALS['member_id']['user_group'] == 1) {
$user_array[$value['username']] = $this->lang['os'] . $this->_os($users[$id]['useragent']) . '<br />' . $this->lang['browser'] . $this->_browser($users[$id]['useragent']) . '<br />' . '<b>IP:</b> ' . $users[$id]['host'] . '<br />';
}
$user_array[$value['username']] .= $this->lang['was'] . $this->_timeagos($users[$id]['lastactivity']) . $this->lang['back'] . '<br />' . $this->lang['location'];
if (preg_match("'%(.*?)%'si", $users[$id]['location'])) {
foreach ($location_array as $find => $replace) {
$users[$id]['location'] = str_replace($find, $replace, $users[$id]['location']);
}
} else {
$users[$id]['location'] = $this->lang['pforum'];
}
$user_array[$value['username']] .= $users[$id]['location'] . "<br/>";
$descr = $user_array[$value['username']];
$user_array[$value['username']] = array();
$user_array[$value['username']]['descr'] = $descr;
$user_array[$value['username']]['id'] = $id;
$count_user++;
}
}
if (count($robots)) {
foreach ($robots as $name => $value) {
if ($GLOBALS['member_id']['user_group'] == 1) {
$robot_array[$name] = $this->lang['os'] . $this->_os($robots[$name]['useragent']) . '<br />' . $this->lang['browser'] . $this->_browser($robots[$name]['useragent']) . '<br />' . '<b>IP:</b> ' . $robots[$name]['host'] . '<br />';
}
$robot_array[$name] .= $this->lang['was'] . $this->_timeagos($robots[$name]['lastactivity']) . $this->lang['back'] . '<br />' . $this->lang['location'];
if (preg_match("'%(.*?)%'si", $robots[$name]['location'])) {
foreach ($location_array as $find => $replace) {
$robots[$name]['location'] = str_replace($find, $replace, $robots[$name]['location']);
}
} else {
$robots[$name]['location'] = $this->lang['pforum'];
}
$robot_array[$name] .= $robots[$name]['location'] . "<br/>";
$count_robots++;
}
}
$users = "";
$i = 0;
if (count($user_array)) {
foreach ($user_array as $name => $a) {
$desc = $a['descr'];
$id = $a['id'];
if ($i) {
$users .= $this->config['separator'];
}
$desc = htmlspecialchars($desc, ENT_QUOTES);
if (!$this->config['vb_block_online_user_link_forum']) {
$user_url = $GLOBALS['config']['allow_alt_url'] == "yes" ? $GLOBALS['config']['http_home_url'] . "user/" . urlencode($name) . "/" : $PHP_SELF . "?subaction=userinfo&user=" . urlencode($name);
} else {
$user_url = $this->vb_config['bburl'] . "/member.php?u=" . $id;
}
$users .= "<a onmouseover=\"showhint('{$desc}', this, event, '180px');\" href=\"" . $user_url . "\" >" . $name . "</a>";
$i++;
}
} else {
$users = $this->lang['notusers'];
}
$robots = "";
$i = 0;
if (count($robot_array)) {
foreach ($robot_array as $name => $desc) {
if ($i) {
$robots .= $this->config['separator'];
}
$desc = htmlspecialchars($desc, ENT_QUOTES);
$robots .= "<span onmouseover=\"showhint('{$desc}', this, event, '180px');\" style=\"cursor:hand;\" >" . $name . "</span>";
$i++;
}
} else {
$robots = $this->lang['notbots'];
}
$tpl->load_template('block_online.tpl');
$tpl->set('{users}', $count_user);
$tpl->set('{guest}', $guests);
$tpl->set('{robots}', $count_robots);
$tpl->set('{all}', $count_user + $guests + $count_robots);
$tpl->set('{userlist}', $users);
$tpl->set('{botlist}', $robots);
$tpl->compile('block_online');
$tpl->clear();
if ($this->config['block_online_cache_time'] && function_exists('create_cache')) {
create_cache("vb_block_online_cache", $tpl->result['block_online']);
set_vars('vb_block_online_cache_time', time());
}
} else {
$tpl->result['block_online'] = $cache;
}
}
示例14: set_vars
<?php
require_once __DIR__ . '/includes/all.php';
$vars = set_vars($_GET, array("type", "id"));
if (!$vars) {
header("Location: /index.php");
exit;
}
$cookies = new Cookies();
$user = $cookies->user_from_cookie();
if ($user === 0) {
header("Location: /index.php");
exit;
}
$cookies->renew_cookie($user->id);
$user_id = $user->data["uid"];
$menu = new Menu($_GET["type"], $_GET["id"]);
?>
<!DOCTYPE HTML>
<html>
<head>
<title> </title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="viewport" content="initial-scale=1">
<meta name="description" content="" />
<meta name="keywords" content="" />
<!--[if lte IE 8]><script src="css/ie/html5shiv.js"></script><![endif]-->
<script src="js/jquery.min.js"></script>
<script src="js/jquery.scrolly.min.js"></script>
<script src="js/skel.min.js"></script>
<!-- <script src="js/jquery.cookie.js"></script>-->
示例15: die
*/
if (!defined('DATALIFEENGINE')) {
die("Hacking attempt!");
}
//################# Определение информеров
$informers = get_vars("informers");
if (!is_array($informers)) {
$informers = array();
$db->query("SELECT * FROM " . PREFIX . "_rssinform ORDER BY id ASC");
while ($row_b = $db->get_row()) {
$informers[$row_b['id']] = array();
foreach ($row_b as $key => $value) {
$informers[$row_b['id']][$key] = stripslashes($value);
}
}
set_vars("informers", $informers);
$db->free();
}
$allow_cache = $config['allow_cache'];
$config['allow_cache'] = 1;
$temp = array();
$i = 0;
if (count($informers)) {
foreach ($informers as $name => $value) {
if ($value['approve']) {
//если активный
if ($value['category']) {
$value['category'] = explode(',', $value['category']);
if (!in_array($category_id, $value['category'])) {
$value['url'] = "";
}