本文整理汇总了PHP中Submission::checkFields方法的典型用法代码示例。如果您正苦于以下问题:PHP Submission::checkFields方法的具体用法?PHP Submission::checkFields怎么用?PHP Submission::checkFields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Submission
的用法示例。
在下文中一共展示了Submission::checkFields方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: defined
<?php
defined("ROOT_DIR") ?: define('ROOT_DIR', dirname(__FILE__));
require_once ROOT_DIR . '/class.logger.php';
require_once ROOT_DIR . '/class.submission.php';
require_once ROOT_DIR . '/class.settings.php';
require_once ROOT_DIR . '/class.sessionmanager.php';
require_once ROOT_DIR . '/recaptchalib.php';
if (!SessionManager::i()->validateToken("LoginToken", "token")) {
Logger::i()->writeLog("Token to login is missing", 'dev');
die(Submission::createResult("Please refresh the page and try again"));
}
if (isset($_POST['login'])) {
$login = (array) json_decode(base64_decode($_POST['login']));
if ($field = Submission::checkFields(array("username", "password"), $login)) {
die(Submission::createResult(ucfirst($field) . " is missing or invalid"));
}
if (Settings::i()->captcha_private) {
if (!isset($login['captcha_response'])) {
die(Submission::createResult("Please validate the captcha"));
}
$reCaptcha = new ReCaptcha(Settings::i()->captcha_private);
$resp = $reCaptcha->verifyResponse($_SERVER["REMOTE_ADDR"], $login['captcha_response']);
if (!$resp->success) {
die(Submission::createResult("Please validate the Captcha"));
}
}
$key = Crypto::GenerateKey($login['username']);
$find = DbManager::i()->select("sf_members", array("iv", "userid"), array("key" => base64_encode(base64_encode($key))));
if ($find !== false) {
if (!is_array($find)) {
示例2: die
die(Submission::createResult("Permission denied"));
}
if (isset($_POST['settings'])) {
$settings = (array) json_decode(base64_decode($_POST['settings']));
if (isset($settings['paypal']) && count((array) $settings['paypal']) > 0) {
if ($field = Submission::checkFields(array("username", "password", "signature"), (array) $settings['paypal'])) {
die(Submission::createResult(ucfirst($field) . " is missing or invalid"));
}
} else {
if (isset($settings['btc']) && count((array) $settings['btc']) > 0) {
if ($field = Submission::checkFields(array("api_key", "api_pin"), (array) $settings['btc'])) {
die(Submission::createResult(ucfirst($field) . " is missing or invalid"));
}
} else {
if (isset($settings['cms_settings']) && count((array) $settings['cms_settings']) > 0) {
if ($field = Submission::checkFields(array("title"), (array) $settings['cms_settings'])) {
die(Submission::createResult(ucfirst($field) . " is missing or invalid"));
}
} else {
die(Submission::createResult("Invalid Settings"));
}
}
}
$settings = base64_encode(base64_encode(Crypto::EncryptString(base64_decode(base64_decode(ADMIN_KEY)), base64_decode(base64_decode(ADMIN_IV)), $_POST['settings'])));
$find = DbManager::i()->select("sf_settings", array("settings"));
if ($find !== false && !is_array($find)) {
//settings already exists
$update = DbManager::i()->update("sf_settings", array("settings" => $settings));
if (!$update) {
Logger::i()->writeLog("Could not update settings, error = " . DbManager::i()->error, 'dev');
die;
示例3: defined
<?php
defined("ROOT_DIR") ?: define('ROOT_DIR', dirname(__FILE__) . "/..");
require_once ROOT_DIR . '/class.logger.php';
require_once ROOT_DIR . '/class.sessionmanager.php';
require_once ROOT_DIR . '/class.submission.php';
if (!SessionManager::i()->isAdminLoggedIn()) {
Logger::i()->writeLog("Admin is not logged in", 'access');
die(Submission::createResult("Admin is not logged in"));
}
if (!SessionManager::i()->validateToken("UpdateCustomersToken", "token")) {
Logger::i()->writeLog("Token to update customer is missing", 'access');
die(Submission::createResult("Token mismatch"));
}
if ($field = Submission::checkFields(array("customerid", "action"), $_POST)) {
die(Submission::createResult(ucfirst($field) . " is missing or invalid"));
}
function renewPassword($c)
{
$plain = Crypto::generateRandomPassword(15);
$info = DbManager::i()->select("sf_members", array("key", "iv"), array("userid" => intval($c)));
if ($info !== false && !is_array($info)) {
$key = base64_decode(base64_decode($info->key));
$iv = base64_decode(base64_decode($info->iv));
$password = base64_encode(base64_encode(Crypto::EncryptString($key, $iv, $plain)));
if (DbManager::i()->update("sf_members", array("password" => $password), array("userid" => intval($c)))) {
unset($password);
unset($key);
unset($iv);
unset($info);
Logger::i()->writeLog("Password renewed for UserID: {$c}, password = {$plain}");
示例4: defined
<?php
defined("ROOT_DIR") ?: define('ROOT_DIR', dirname(__FILE__));
require_once ROOT_DIR . '/class.logger.php';
require_once ROOT_DIR . '/class.settings.php';
require_once ROOT_DIR . '/class.sessionmanager.php';
require_once ROOT_DIR . '/class.submission.php';
require_once ROOT_DIR . '/recaptchalib.php';
if (!SessionManager::i()->validateToken("RegisterToken", "token")) {
Logger::i()->writeLog("Token to register is missing", 'dev');
echo Submission::createResult("Please refresh the page and try again");
die;
}
if (isset($_POST['registration'])) {
$registration = (array) json_decode(base64_decode($_POST['registration']));
if ($field = Submission::checkFields(array("username", "email", "password", "repeat_password"), $registration)) {
die(Submission::createResult(ucfirst($field) . " is missing or invalid"));
} else {
if (!Submission::checkEquality($registration['password'], $registration['repeat_password'])) {
die(Submission::createResult("Passwords do not match"));
}
}
if (!is_null(Settings::i()->captcha_private)) {
if (!isset($registration['captcha_response'])) {
die(Submission::createResult("Please validate the captcha"));
}
$reCaptcha = new ReCaptcha(Settings::i()->captcha_private);
$resp = $reCaptcha->verifyResponse($_SERVER["REMOTE_ADDR"], $registration['captcha_response']);
if (!$resp->success) {
die(Submission::createResult("Please validate the Captcha"));
}
示例5: die
return $result;
}
if (!SessionManager::i()->isAdminLoggedIn()) {
Logger::i()->writeLog("Admin is not logged in", 'access');
die(Submission::createResult("Permission denied"));
}
if (!SessionManager::i()->validateToken("AddProductToken", "token")) {
Logger::i()->writeLog("Token to add product is missing", 'access');
die(Submission::createResult("Please refresh the page and try again"));
}
if (isset($_POST['product'])) {
$product = (array) json_decode(base64_decode($_POST['product']));
if ($field = Submission::checkFields(array("name", "price", "description", "available"), $product)) {
die(Submission::createResult(ucfirst($field) . " is missing or invalid"));
} else {
if (!isset($_FILES) || ($field = Submission::checkFields(array("bigimage", "productfile"), $_FILES))) {
die(Submission::createResult(ucfirst($field) . " is missing or invalid"));
}
}
$imagePath = null;
$bigImagePath = null;
$productPath = null;
if (($res = processImages("bigimage", $imagePath, $bigImagePath)) || is_null($imagePath) || is_null($bigImagePath)) {
die(Submission::createResult("Failed to process image -> " . $res));
}
if (($res = processFile("productfile", $productPath)) || is_null($productPath)) {
die(Submission::createResult("Failed to process Product File -> " . $res));
}
if (floatval($product['price']) == 0) {
die(Submission::createResult("Price can not be 0"));
}
示例6: defined
<?php
defined("ROOT_DIR") ?: define('ROOT_DIR', dirname(__FILE__) . "/..");
require_once ROOT_DIR . '/class.logger.php';
//requires class.dbmanager
require_once ROOT_DIR . '/class.sessionmanager.php';
require_once ROOT_DIR . '/class.submission.php';
if (!SessionManager::i()->isAdminLoggedIn()) {
Logger::i()->writeLog("Admin not logged in", 'dev');
die(Submission::createResult("Admin is not logged in"));
}
if (!SessionManager::i()->validateToken("UpdateProductToken", "token")) {
Logger::i()->writeLog("Token to update product is missing", 'dev');
die(Submission::createResult("Token mismatch"));
}
if ($field = Submission::checkFields("action", "product", $_POST)) {
die(Submission::createResult(ucfirst($field) . " is missing or invalid"));
}
$product = (array) json_decode(base64_decode($_POST['product']));
switch ($_POST['action']) {
case 'soldOut':
if (!DbManager::i()->update("sf_products", array("soldOut" => intval($product['soldOut'])), array("productid" => intval($product['productid'])))) {
Logger::i()->writeLog("Marking product as soldOut failed, error = " . DbManager::i()->error, 'dev');
die(Submission::createResult("Failed to mark product as soldOut"));
}
break;
case 'delete':
if (!DbManager::i()->delete("sf_products", array("productid" => intval($product['productid'])))) {
Logger::i()->writeLog("Deleting product failed, error = " . DbManager::i()->error, 'dev');
die(Submission::createResult("Failed to delete product"));
}