本文整理汇总了PHP中Token::isExist方法的典型用法代码示例。如果您正苦于以下问题:PHP Token::isExist方法的具体用法?PHP Token::isExist怎么用?PHP Token::isExist使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Token
的用法示例。
在下文中一共展示了Token::isExist方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
/**
* GeniXCMS - Content Management System
*
* PHP Based Content Management System and Framework
*
* @package GeniXCMS
* @since 0.0.1 build date 20150202
* @version 0.0.6
* @link https://github.com/semplon/GeniXCMS
* @link http://genixcms.org
* @author Puguh Wijayanto (www.metalgenix.com)
* @copyright 2014-2015 Puguh Wijayanto
* @license http://www.opensource.org/licenses/mit-license.php MIT
*
*/
if (isset($_GET['token']) && Token::isExist($_GET['token'])) {
$token = TOKEN;
} else {
$token = '';
}
$_GET['act'] == "edit" ? $pagetitle = "Edit" : ($pagetitle = "New");
$_GET['act'] == "edit" ? $act = "edit&id={$_GET['id']}&token={$_GET['token']}" : ($act = "add");
if (isset($data['alertgreen'])) {
# code...
echo "<div class=\"alert alert-success\" >\n <button type=\"button\" class=\"close\" data-dismiss=\"alert\">\n <span aria-hidden=\"true\">×</span>\n <span class=\"sr-only\">Close</span>\n </button>";
foreach ($data['alertgreen'] as $alert) {
# code...
echo "{$alert}\n";
}
echo "</div>";
}
示例2: define
*
*/
define('GX_PATH', realpath(__DIR__ . '/'));
define('GX_LIB', GX_PATH . '/inc/lib/');
define('GX_MOD', GX_PATH . '/inc/mod/');
define('GX_THEME', GX_PATH . '/inc/themes/');
define('GX_ASSET', GX_PATH . '/assets/');
require "autoload.php";
try {
new System();
} catch (Exception $e) {
echo $e->getMessage();
}
if (isset($_POST['forgotpass'])) {
// Check token first
if (isset($_POST['token']) && Token::isExist($_POST['token'])) {
/*check if username is exist or not */
$username = Typo::cleanX(Typo::strip($_POST['username']));
$sql = sprintf("SELECT `userid`,`email`,`status`,`activation` FROM `user` WHERE `userid` = '%s'", $username);
$usr = Db::result($sql);
$c = Db::$num_rows;
//echo $c;
//print_r($usr);
if ($c == "1") {
//$alertgreen = "";
// check if user is active
if ($usr[0]->status == '1') {
/* get user password */
$newpass = User::generatePass();
$id = User::id($username);
$pass = User::randpass($newpass);
示例3: array
* @link https://github.com/semplon/GeniXCMS
* @link http://genixcms.org
* @author Puguh Wijayanto (www.metalgenix.com)
* @copyright 2014-2015 Puguh Wijayanto
* @license http://www.opensource.org/licenses/mit-license.php MIT
*
*/
$data['sitetitle'] = MODULES;
if (isset($GLOBALS['alertred'])) {
$data['alertred'] = $GLOBALS['alertred'];
}
if (isset($GLOBALS['alertgreen'])) {
$data['alertgreen'][] = $GLOBALS['alertgreen'];
}
if (isset($_POST['upload'])) {
if (!Token::isExist($_POST['token'])) {
$alertred[] = TOKEN_NOT_EXIST;
}
if (!isset($_FILES['module']['name']) || $_FILES['module']['name'] == "") {
$alertred[] = NOFILE_UPLOADED;
}
if (!isset($alertred)) {
//Mod::activate($_GET['modules']);
$path = "/inc/mod/";
$allowed = array('zip');
$mod = Upload::go('module', $path, $allowed);
//print_r($mod);
$zip = new ZipArchive();
if ($zip->open($mod['filepath']) === TRUE) {
$zip->extractTo(GX_MOD);
$zip->close();
示例4: foreach
}
if (isset($alertred)) {
$data['alertred'] = $alertred;
} else {
foreach ($post_id as $id) {
# code...
Posts::unpublish($id);
}
}
if (isset($_POST['token'])) {
Token::remove($_POST['token']);
}
break;
case 'delete':
# code...
if (!isset($_POST['token']) || !Token::isExist($_POST['token'])) {
// VALIDATE ALL
$alertred[] = TOKEN_NOT_EXIST;
}
if (isset($alertred)) {
$data['alertred'] = $alertred;
} else {
foreach ($post_id as $id) {
# code...
Posts::delete($id);
}
}
if (isset($_POST['token'])) {
Token::remove($_POST['token']);
}
break;
示例5: loader
public static function loader()
{
$data = "";
if (isset($_GET['page']) && $_GET['page'] == "modules") {
if (isset($_GET['act'])) {
if ($_GET['act'] == ACTIVATE) {
if (!Token::isExist($_GET['token'])) {
$alertred[] = TOKEN_NOT_EXIST;
}
if (!isset($alertred)) {
self::activate($_GET['modules']);
$GLOBALS['alertgreen'] = MODULES_ACTIVATED;
} else {
$GLOBALS['alertred'] = $alertred;
}
} elseif ($_GET['act'] == DEACTIVATE) {
if (!Token::isExist($_GET['token'])) {
$alertred[] = TOKEN_NOT_EXIST;
}
if (!isset($alertred)) {
self::deactivate($_GET['modules']);
$GLOBALS['alertgreen'] = MODULES_DEACTIVATED;
} else {
$GLOBALS['alertred'] = $alertred;
}
} elseif ($_GET['act'] == 'remove') {
if (!Token::isExist($_GET['token'])) {
$alertred[] = TOKEN_NOT_EXIST;
}
if (Mod::isActive($_GET['modules'])) {
$alertred[] = "Module is Active. Please deactivate first.";
}
if (!isset($alertred)) {
self::deactivate($_GET['modules']);
Files::delTree(GX_MOD . "/" . $_GET['modules']);
$GLOBALS['alertgreen'] = MODULES_DELETED;
} else {
$GLOBALS['alertred'] = $alertred;
}
}
}
}
$json = Options::get('modules');
$mods = json_decode($json, true);
if (!is_array($mods) || $mods == "") {
$mods = array();
}
foreach ($mods as $m) {
if (self::exist($m)) {
self::load($m);
}
}
return $data;
}
示例6: elseif
Token::remove($_POST['token']);
}
}
if (isset($_GET['act'])) {
if ($_GET['act'] == 'activate') {
if (!Token::isExist($_GET['token'])) {
$alertred[] = TOKEN_NOT_EXIST;
}
if (!isset($alertred)) {
Theme::activate($_GET['themes']);
$data['alertgreen'][] = THEME_ACTIVATED;
} else {
$data['alertred'] = $alertred;
}
} elseif ($_GET['act'] == 'remove') {
if (!Token::isExist($_GET['token'])) {
$alertred[] = TOKEN_NOT_EXIST;
}
if (Theme::isActive($_GET['themes'])) {
$alertred[] = MSG_THEME_IS_ACTIVE;
}
if (!isset($alertred)) {
if (Files::delTree(GX_THEME . "/" . $_GET['themes'])) {
$data['alertgreen'][] = THEME_REMOVED;
} else {
$data['alertred'][] = MSG_THEME_NOT_REMOVED;
}
} else {
$data['alertred'] = $alertred;
}
}