• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP protect函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中protect函数的典型用法代码示例。如果您正苦于以下问题:PHP protect函数的具体用法?PHP protect怎么用?PHP protect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了protect函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: nvweb_plugins_load

function nvweb_plugins_load()
{
    // load all webget plugins and exclude the DISABLED
    global $plugins;
    global $DB;
    global $website;
    $plugin_list = glob(NAVIGATE_PATH . '/plugins/*', GLOB_ONLYDIR);
    $plugins = array();
    if (is_array($plugin_list)) {
        // read the database to find the disabled plugins
        $DB->query('SELECT extension, enabled
                      FROM nv_extensions
                     WHERE website = ' . protect($website->id) . '
                       AND enabled = 0');
        $plugins_disabled = $DB->result('extension');
        foreach ($plugin_list as $plugin_path) {
            $plugin_name = basename($plugin_path);
            if (in_array($plugin_name, $plugins_disabled)) {
                continue;
            }
            if (file_exists($plugin_path . '/' . $plugin_name . '.php')) {
                @(include_once $plugin_path . '/' . $plugin_name . '.php');
            }
            $plugins[] = $plugin_name;
        }
    }
}
开发者ID:NavigateCMS,项目名称:Navigate-CMS,代码行数:27,代码来源:nvweb_plugins.php


示例2: register

 public function register(Container $c)
 {
     $c['database.manager'] = protect(new Capsule());
     $capsule = $c['database.manager'];
     // Extract database settings from dsn
     if (!isset($_ENV['DATABASE_URL'])) {
         throw new Exception('You must provide a database DSN in the DATABASE_URL environment variable');
     }
     $db = array('charset' => 'utf8', 'collation' => 'utf8_general_ci', 'prefix' => '');
     $db = array_merge($db, parse_url($_ENV['DATABASE_URL']));
     $db['driver'] = $db['scheme'] == 'postgres' ? 'pgsql' : $db['scheme'];
     $db['database'] = trim($db['path'], '/');
     $db['username'] = isset($db['user']) ? $db['user'] : '';
     $db['password'] = isset($db['pass']) ? $db['pass'] : '';
     $capsule->addConnection($db);
     $capsule->setAsGlobal();
     // Set the event dispatcher used by Eloquent models
     $capsule->setEventDispatcher(new IDispatcher(new IContainer()));
     // Set the cache manager instance used by connections... (optional)
     // No need for that now, let's keep it minimal
     //$capsule->setCacheManager(...);
     $capsule->bootEloquent();
     $c['db'] = function ($c) {
         return $c['database.manager']->getDatabaseManager();
     };
     \Illuminate\Support\Facades\Schema::setFacadeApplication($c);
 }
开发者ID:kiasaki,项目名称:vexillum,代码行数:27,代码来源:DatabaseProvider.php


示例3: lista

function lista($user)
{
    global $dateformat;
    $user = protect($user);
    requirelogin();
    $title = "Mensagens de {$user}";
    include "libs/accounts.php";
    // listar todas as mensagens de $user onde hidden = 'n' (para outro user ver)
    $output = menu($user) . url("message/send/{$user}", "[enviar mensagem]") . "<br>\n";
    $usr = resolveuser($user);
    $qry = mysql_query("SELECT `from`,`content`,`data` FROM messages WHERE `to`='{$usr}' AND `hidden`='n' ORDER BY id DESC LIMIT 30");
    if (mysql_numrows($qry) == 0) {
        $output .= 'Nenhuma mensagem!';
    } else {
        while ($row = mysql_fetch_array($qry)) {
            $user = mysql_query("SELECT login,foto FROM accounts WHERE id='{$row['from']}'");
            $user = mysql_fetch_array($user);
            $output .= '<p class="row">' . t("De") . ': ' . url("user/profile/{$user['login']}", $user['login']) . '<br/>';
            $output .= '<blockquote>
                 ' . bbcode($row['content']) . '
                  </blockquote>
                  <hr size="1"><i>' . date($dateformat, $row['data']) . '</i>
                  </p>';
        }
    }
    section($output, $title);
}
开发者ID:jesobreira,项目名称:soclwap,代码行数:27,代码来源:message.php


示例4: nvweb_votes

function nvweb_votes($vars = array())
{
    global $website;
    global $DB;
    global $current;
    global $webuser;
    switch ($vars['mode']) {
        case 'score':
            $out = nvweb_votes_calc($current['object'], $vars['round'], $vars['half'], $vars['min'], $vars['max']);
            break;
        case 'votes':
            $out = $current['object']->votes;
            break;
        case 'webuser':
            $score = NULL;
            if (!empty($webuser->id)) {
                $score = $DB->query_single('value', 'nv_webuser_votes', ' website = ' . protect($website->id) . '
					  AND webuser = ' . protect($webuser->id) . '
					  AND object = ' . protect($current['type']) . '
					  AND object_id = ' . protect($current['id']));
            }
            $out = empty($score) ? '0' : $score;
            break;
    }
    return $out;
}
开发者ID:NavigateCMS,项目名称:Navigate-CMS,代码行数:26,代码来源:votes.php


示例5: del

function del($id)
{
    onlyadmin();
    $id = protect($id);
    mysql_query("DELETE FROM shoutbox WHERE `id`='{$id}'");
    redir("shoutbox");
}
开发者ID:jesobreira,项目名称:soclwap,代码行数:7,代码来源:shoutbox.php


示例6: testProtect

 public function testProtect()
 {
     $uniqueVar = '987654';
     $protectedValue = protect($uniqueVar);
     $this->assertTrue(is_callable($protectedValue));
     $this->assertEquals($uniqueVar, $protectedValue());
 }
开发者ID:kiasaki,项目名称:vexillum,代码行数:7,代码来源:FunctionsTest.php


示例7: setUpContainer

 protected function setUpContainer()
 {
     $this->container = new Container();
     $this->container['app'] = protect($this);
     $this->container['request'] = protect(new Request());
     $this->container['response'] = protect(new FakeResponseThatDoesNothing());
 }
开发者ID:kiasaki,项目名称:vexillum,代码行数:7,代码来源:ApplicationTest.php


示例8: deleteroom

function deleteroom($id)
{
    onlyadmin();
    $id = protect($id);
    mysql_query("DELETE FROM chat_rooms WHERE `id`='{$id}'");
    mysql_query("DELETE FROM chat WHERE `room`='{$id}'");
    redir("chat/admin");
}
开发者ID:jesobreira,项目名称:soclwap,代码行数:8,代码来源:chat.php


示例9: remove

function remove($id)
{
    requirelogin();
    $id = protect($id);
    $owner = $_SESSION['id'];
    mysql_query("DELETE FROM videos WHERE `id`='{$id}' AND `owner`='{$owner}'");
    infobox("Vídeo excluído com sucesso!");
}
开发者ID:jesobreira,项目名称:soclwap,代码行数:8,代码来源:videos.php


示例10: resolvegroup

function resolvegroup($group)
{
    $group = protect($group);
    $qry = mysql_query("SELECT * FROM groups WHERE `url`='{$group}'");
    if (mysql_numrows($qry) != 0) {
        return mysql_fetch_array($qry);
    } else {
        infobox(t("Grupo inexistente."), true, true);
    }
}
开发者ID:jesobreira,项目名称:soclwap,代码行数:10,代码来源:funcs.php


示例11: __construct

 function __construct()
 {
     /* Prevent guests if the admin hasn't enabled public profiles. */
     if (!parent::getOption('profile-public-enable')) {
         protect('*');
     }
     /* If the admin requires users to update their password. */
     if (!empty($_SESSION['jigowatt']['forcePwUpdate'])) {
         $msg = "<div class='alert alert-warning'>" . _('<strong>Alert</strong>: The administrator has requested all users to update their passwords.') . "</div>";
     }
     // Save the username
     $this->username = !empty($_SESSION['jigowatt']['username']) ? $_SESSION['jigowatt']['username'] : _('Guest');
     $this->use_emails = parent::getOption('email-as-username-enable');
     $this->username_type = $this->use_emails ? 'email' : 'username';
     /* Check if the user is a guest to this profile. */
     $this->determineGuest();
     // Upload avatar
     if (!empty($_FILES['uploadAvatar'])) {
         $k = getimagesize($_FILES['uploadAvatar']['tmp_name']);
         if (empty($k)) {
             $this->error = sprintf('<div class="alert alert-warning">%s</div>', _('Sorry, that file is not accepted.'));
         } else {
             $uploaddir = dirname(dirname(__FILE__)) . '/assets/uploads/avatar/';
             $uploadfile = $uploaddir . md5($_SESSION['jigowatt']['user_id'] . $_SESSION['jigowatt']['email']) . '.' . pathinfo($_FILES['uploadAvatar']['name'], PATHINFO_EXTENSION);
             if (move_uploaded_file($_FILES['uploadAvatar']['tmp_name'], $uploadfile)) {
                 $this->error = sprintf('<div class="alert alert-success">%s</div>', _('Avatar change success!'));
                 $_SESSION['jigowatt']['gravatar'] = parent::get_gravatar($_SESSION['jigowatt']['email'], true, 26);
             } else {
                 $this->error = sprintf('<div class="alert alert-warning">%s</div>', _('Sorry, that file is not accepted.'));
             }
         }
     }
     if (!$this->guest && !empty($_POST)) {
         $this->retrieveFields();
         foreach ($_POST as $field => $value) {
             $this->settings[$field] = parent::secure($value);
         }
         // Validate fields
         $this->validate();
         // Process form
         if (empty($this->error)) {
             $this->process();
         }
     }
     $this->retrieveFields();
     if (!$this->guest && isset($_GET['key']) && strlen($_GET['key']) == 32) {
         $this->key = parent::secure($_GET['key']);
         $this->updateEmailorPw();
         $this->retrieveFields();
     }
     if (!empty($this->error) || !empty($msg)) {
         parent::displayMessage(!empty($this->error) ? $this->error : (!empty($msg) ? $msg : ''), false);
     }
 }
开发者ID:causefx,项目名称:MMHTPC-ManageMyHTPC,代码行数:54,代码来源:profile.class.php


示例12: remove

function remove($fid)
{
    requirelogin();
    $id = protect($fid);
    if (is_admin()) {
        mysql_query("DELETE FROM notes WHERE `id`='{$id}'");
    } else {
        $account = $_SESSION['id'];
        mysql_query("DELETE FROM notes WHERE `account`='{$account}' AND `id`='{$id}'");
    }
    redir("dashboard");
}
开发者ID:jesobreira,项目名称:soclwap,代码行数:12,代码来源:dashboard.php


示例13: youtube

function youtube($videourl)
{
    $ret = array();
    $video = explode("=", $videourl);
    $video = $video[1];
    $video = explode("&", $video);
    $video = $video[0];
    $video = str_replace("?v=", null, $video);
    $ret['code'] = '<object width="320" height="180"><param name="movie" value="http://www.youtube.com/v/' . $video . '&amp;hl=pt_BR&amp;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/' . $video . '&amp;hl=pt_BR&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="320" height="180"></embed></object>';
    $meta = get_meta_tags($videourl);
    $ret['title'] = protect($meta['title']);
    $ret['desc'] = protect($meta['description']);
    return $ret;
}
开发者ID:jesobreira,项目名称:soclwap,代码行数:14,代码来源:video.php


示例14: view

function view($id)
{
    global $site_id, $site, $url, $home;
    $id = protect($id);
    // não requer login (ou softwares não funcionarão)
    // id = md5 ( user_id . site_id )
    $qry = mysql_query("SELECT * FROM accounts");
    while ($row = mysql_fetch_array($qry)) {
        if (md5($row['id'] . $site_id) === $id) {
            $user = $row['id'];
            $usr_login = $row['login'];
            //break;
        }
    }
    if ($user) {
        echo '<?xml version="1.0"?>
<rss version="2.0">
  <channel>
    <title>' . $site['site_name'] . '</title>
    <link>' . $url . '</link>
    <description>' . t("Notificações de") . ' ' . $usr_login . '</description>
    ';
        $friends = mysql_query("SELECT `id1` FROM friends WHERE `id2`='{$user}'");
        if (mysql_numrows($friends) != 0) {
            while ($f = mysql_fetch_array($friends)) {
                $receive[] = $f['id1'];
            }
        }
        if (sizeof($receive) != 0) {
            $receive = implode(",", $receive);
            $qry = mysql_query("SELECT a.login AS login, n.content AS content, n.account AS id, n.id AS fid FROM notes n LEFT JOIN accounts a ON n.account=a.id WHERE n.account IN ({$receive}) ORDER BY n.id DESC LIMIT 30");
            if (mysql_numrows($qry) != 0) {
                while ($row = mysql_fetch_array($qry)) {
                    echo '<item>
                <title>' . $row['login'] . '</title>
                <link>' . $home . 'user/profile/' . $row['login'] . '</link>
                <description>' . $row['content'] . '</description>
                </item>';
                }
            }
        }
        echo '</channel>
</rss>';
    }
    die;
    // para não exibir front-end
}
开发者ID:jesobreira,项目名称:soclwap,代码行数:47,代码来源:rss.php


示例15: load

 /**
  * Load the translations dictionary of the Navigate CMS interface
  *
  * @param string $code Language code (2 letters)
  */
 public function load($code = 'en')
 {
     global $DB;
     $DB->query('SELECT * FROM nv_languages WHERE code = ' . protect($code));
     $data = $DB->first();
     $this->id = $data->id;
     $this->code = $data->code;
     $this->name = $data->name;
     $this->file = $data->nv_dictionary;
     $this->lang = array();
     $xliff = simplexml_load_file(NAVIGATE_PATH . '/' . $this->file);
     if (empty($xliff)) {
         // just use the default language (English)
         return;
     }
     foreach ($xliff->file[0]->body[0]->{"trans-unit"} as $unit) {
         $lid = intval($unit->attributes()->id);
         $this->lang[$lid] = (string) $unit->target;
         $this->lang[$lid] = str_replace("\n", "", $this->lang[$lid]);
     }
 }
开发者ID:NavigateCMS,项目名称:Navigate-CMS,代码行数:26,代码来源:language.class.php


示例16: post

function post()
{
    global $url;
    requirelogin();
    $me = $_SESSION['id'];
    $query = substr(protect($_POST['query']), 0, 16);
    if (strlen($query) < 3) {
        # isso não é um coração...
        infobox(t("Termos de busca muito pequenos.", true, true));
    }
    if ($_POST['usuarios']) {
        $qry = mysql_query("SELECT `foto`,`login` FROM accounts WHERE `login` LIKE '%{$query}%' OR `nome` LIKE '%{$query}%'");
        if (mysql_numrows($qry) == 0) {
            $usuarios = t("Nenhum resultado!");
        } else {
            $usuarios = null;
            while ($row = mysql_fetch_array($qry)) {
                $usuarios .= "\n" . '<p><div class="row">
                        <img src="' . $url . '/upload/' . thumb($row['foto']) . '"><br>
                        ' . url("user/profile/{$row['login']}", $row['login']) . '
                      </div></p>';
            }
        }
        section($usuarios, t("Buscando usuários."));
    }
    if ($_POST['grupos']) {
        $qry = mysql_query("SELECT `title`,`url` FROM groups WHERE `title` LIKE '%{$query}%' OR `desc` LIKE '%{$query}%'");
        if (mysql_numrows($qry) == 0) {
            $grupos = t("Nenhum resultado!");
        } else {
            $grupos = null;
            while ($row = mysql_fetch_array($qry)) {
                $grupos .= "\n" . '<p><div class="row">
                        ' . url("groups/view/{$row['url']}", $row['title']) . '
                      </div></p>';
            }
        }
        section($grupos, t("Buscando grupos."));
    }
}
开发者ID:jesobreira,项目名称:soclwap,代码行数:40,代码来源:search.php


示例17: __construct

 function __construct()
 {
     /* Prevent guests if the admin hasn't enabled public profiles. */
     if (!parent::getOption('profile-public-enable')) {
         protect('*');
     }
     /* If the admin requires users to update their password. */
     if (!empty($_SESSION['jigowatt']['forcePwUpdate'])) {
         $msg = "<div class='alert alert-warning'>" . _('<strong>Alert</strong>: The administrator has requested all users to update their passwords.') . "</div>";
     }
     // Save the username
     $this->username = !empty($_SESSION['jigowatt']['username']) ? $_SESSION['jigowatt']['username'] : _('Guest');
     $this->use_emails = parent::getOption('email-as-username-enable');
     $this->username_type = $this->use_emails ? 'email' : 'username';
     /* Check if the user is a guest to this profile. */
     $this->determineGuest();
     if (!$this->guest && !empty($_POST)) {
         $this->retrieveFields();
         foreach ($_POST as $field => $value) {
             $this->settings[$field] = parent::secure($value);
         }
         // Validate fields
         $this->validate();
         // Process form
         if (empty($this->error)) {
             $this->process();
         }
     }
     $this->retrieveFields();
     if (!$this->guest && isset($_GET['key']) && strlen($_GET['key']) == 32) {
         $this->key = parent::secure($_GET['key']);
         $this->updateEmailorPw();
         $this->retrieveFields();
     }
     if (!empty($this->error) || !empty($msg)) {
         parent::displayMessage(!empty($this->error) ? $this->error : (!empty($msg) ? $msg : ''), false);
     }
 }
开发者ID:fliptechit,项目名称:kick-notify,代码行数:38,代码来源:profile.class.php


示例18: mysql_query

         $unit['farmer'] += $farmer;
         $unit['warrior'] += $warrior;
         $unit['defender'] += $defender;
         $unit['wizard'] += $wizard;
         $update_unit = mysql_query("UPDATE `unit` SET \n                                        `merchant`='" . $unit['merchant'] . "',\n                                        `farmer`='" . $unit['farmer'] . "',\n                                        `warrior`='" . $unit['warrior'] . "',\n                                        `defender`='" . $unit['defender'] . "',\n                                        `wizard`='" . $unit['wizard'] . "'\n                                        WHERE `id`='" . $_SESSION['uid'] . "'") or die(mysql_error());
         $stats['food'] -= $food_needed;
         $update_food = mysql_query("UPDATE `stats` SET `food`='" . $stats['food'] . "' \n                                        WHERE `id`='" . $_SESSION['uid'] . "'") or die(mysql_error());
         include "update_stats.php";
         output("You have trained your units!");
     }
 } elseif (isset($_POST['untrain'])) {
     $merchant = protect($_POST['merchant']);
     $farmer = protect($_POST['farmer']);
     $warrior = protect($_POST['warrior']);
     $defender = protect($_POST['defender']);
     $wizard = protect($_POST['wizard']);
     $food_gained = 8 * $merchant + 8 * $farmer + 8 * $warrior + 8 * $defender + 8 * $wizard;
     if ($merchant < 0 || $farmer < 0 || $warrior < 0 || $defender < 0 || $wizard < 0) {
         output("You must untrain a positive number of units!");
     } elseif ($merchant > $unit['merchant'] || $farmer > $unit['farmer'] || $warrior > $unit['warrior'] || $defender > $unit['defender'] || $wizard > $unit['wizard']) {
         output("You do not have that many units to untrain!");
     } else {
         $unit['merchant'] -= $merchant;
         $unit['farmer'] -= $farmer;
         $unit['warrior'] -= $warrior;
         $unit['defender'] -= $defender;
         $unit['wizard'] -= $wizard;
         $update_unit = mysql_query("UPDATE `unit` SET \n                                        `merchant`='" . $unit['merchant'] . "',\n                                        `farmer`='" . $unit['farmer'] . "',\n                                        `warrior`='" . $unit['warrior'] . "',\n                                        `defender`='" . $unit['defender'] . "',\n                                        `wizard`='" . $unit['wizard'] . "' \n                                        WHERE `id`='" . $_SESSION['uid'] . "'") or die(mysql_error());
         $stats['food'] += $food_gained;
         $update_food = mysql_query("UPDATE `stats` SET `food`='" . $stats['food'] . "' \n                                        WHERE `id`='" . $_SESSION['uid'] . "'") or die(mysql_error());
         include "update_stats.php";
开发者ID:ExcessiveUseOfCobblestone,项目名称:KMKingdoms,代码行数:31,代码来源:units.php


示例19: dirname

<?php

include_once dirname(dirname(__FILE__)) . '/classes/check.class.php';
protect("1");
if (empty($_POST)) {
    include_once 'header.php';
}
include_once 'classes/settings.class.php';
?>

	<div id="message"></div>

	  <div class="tabbable tabs-left">

		<ul class="nav nav-tabs">
			<li><a href="#general-options" data-toggle="tab"><i class="glyphicon glyphicon-cog"></i> <?php 
_e('General');
?>
</a></li>
			<li><a href="#denied" data-toggle="tab"><i class="glyphicon glyphicon-exclamation-sign"></i> <?php 
_e('Denied');
?>
</a></li>
            <li class="dropdown">
              <a href="#" class="dropdown-toggle" data-toggle="dropdown"><i class="glyphicon glyphicon-envelope"></i> <?php 
_e('Emails');
?>
 <b class="caret"></b></a>
              <ul class="dropdown-menu">
                <li><a href="#emails-welcome" data-toggle="tab"><?php 
_e('Welcome');
开发者ID:causefx,项目名称:MMHTPC-ManageMyHTPC,代码行数:31,代码来源:settings.php


示例20: protect

<?php

include 'header.php';
include 'safe.php';
if (isset($_SESSION['uid'])) {
    if (isset($_POST['addNews'])) {
        $title = protect($_POST['title']);
        $text = protect($_POST['text']);
        $author = protect($_POST['author']);
        $data = date("Y-m-d");
        $czas = date("H:i");
        //$author = $datas['username'];
        if ($title == "" || $text == "") {
            echo "Wypełnij wszystkie pola!";
        } elseif (strlen($title) > 64) {
            echo "Tytuł nie może mieć więcej niż 64 znaków!";
        } else {
            $insert = mysql_query("INSERT INTO `cms_news` (`title`,`text`,`date`, `time`, `author`) VALUES ('{$title}','{$text}', '{$data}', '{$czas}', '{$author}')") or die(mysql_error());
            echo '</br><span class="label label-success">Pomyślnie dodano news: ' . $title . '</span>';
        }
    }
    ?>
	
	

	<form action="addNews.php" method="POST">
	<h1>Dodawanie newsa</h1></br>
	<div class="form-group">
 	<label for="author">Autor</label>
 
 	<?php 
开发者ID:criexowsky,项目名称:crie-cms,代码行数:31,代码来源:addNews.php



注:本文中的protect函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP protectPage函数代码示例发布时间:2022-05-15
下一篇:
PHP prot函数代码示例发布时间:2022-05-15
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap