本文整理汇总了PHP中is_valid函数的典型用法代码示例。如果您正苦于以下问题:PHP is_valid函数的具体用法?PHP is_valid怎么用?PHP is_valid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_valid函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: contact_plugin
function contact_plugin()
{
if (isset($_POST['submit'])) {
$username = $_POST['username'];
$subject = $_POST['subject'];
$message = $_POST['content'];
echo "<br/>";
echo "<br/>";
echo "<br/>";
echo "<br/>";
echo $username;
if (is_valid($subject, $message) == false) {
echo "</br></br></br>";
echo $subject . "</br>";
echo $message;
$headers = 'From: webmaster@example.com' . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
mail("asmit@gmail.com", $subject, $message, $headers);
}
}
echo '<div class="contain">';
echo '<form action="" method="post">';
echo '<div class="form-group">';
echo '<label>Enter Your name</label>';
echo '<input name="username" class="form-control" id="un" required ">';
echo '<label>Topic</label>';
echo '<input name="subject" class="form-control" id="un" required ">';
echo '<label>Message</label>';
echo '<textarea class="form-control" rows="5" name="content" id="comment"></textarea>';
echo '<div id="button1">';
echo '<button name="submit" type="submit" class="btn btn-primary btn-block">Submit</button>';
echo '</div>';
echo '</div>';
echo '</form>';
echo '</div>';
}
示例2: next_password
function next_password($codes)
{
$codes = increase($codes);
while (!is_valid($codes)) {
$codes = increase($codes);
}
return $codes;
}
示例3: get
public function get($slug)
{
if (is_valid($slug)) {
$this->ttpl->set('title', 'Hello, world');
$this->ttpl->set('content', 'Load an article that matches the slug: ' . $slug);
} else {
$this->not_found();
}
}
示例4: upload
public function upload($file, $options = array())
{
$options['return_error'] = false;
$ret = Uploader::upload($file, $options);
$preloaded = new PreloadedFile(Cloudinary::signedPreloadedImage($ret));
if ($this->verifyUpload && !$preloaded . is_valid()) {
throw new \Exception("Error! Couldn't verify cloudinary response!");
}
$this->identifier = $preloaded->extendedIdentifier();
}
示例5: get_wet
function get_wet()
{
$wet_url = 'http://121.42.31.195:9071/WIFPa/ResourceData.xml/0001000054f08cfa?ResourceID=4';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $wet_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HEADER, 0);
$wet_data = curl_exec($ch);
curl_close($ch);
$wet_reg = '/<resvalue>(.*?)<\\/resvalue>/';
$wet_ret = is_valid($wet_data, $wet_reg);
$tag_start_len = strlen('<resvalue>');
$tag_end_len = strlen('<\\/resvalue>');
$gross_len = strlen($wet_ret);
$wet_len = $gross_len - $tag_start_len - $tag_end_len;
$wet_ret = substr($wet_ret, $tag_start_len, $wet_len + 1);
return $wet_ret;
}
示例6: show_cast
/**
* Display the series cast
*/
function show_cast()
{
global $apikey, $w, $id;
$url = "http://api.trakt.tv/show/summary.json/{$apikey}/{$id}/extended";
$show = $w->request($url);
$show = json_decode($show);
if (is_valid($show)) {
$w->result('cast', '', 'Back ...', '', 'icons/back.png', 'no', 'id:' . $id . ':summary');
foreach ($show->people->actors as $actor) {
$w->result('cast', '', $actor->character, $actor->name, 'icons/actor.png', 'no');
}
}
}
示例7: header
case "getIndic":
$rt->getIndic();
break;
case "getData":
if (isset($_GET['idgraphe'])) {
$rt->getData($_GET['idgraphe']);
}
break;
case "getBoilerMode":
if (isset($_GET['way'])) {
$rt->getBoilerMode($_GET['way']);
}
break;
case "setBoilerMode":
if (isset($_GET['mode']) && isset($_GET['way'])) {
$rt->setBoilerMode($_GET['mode']);
break;
}
}
break;
}
}
} else {
if (!is_ajax()) {
echo '<pre>xmlhttprequest needed ! </pre>';
}
if (!is_valid()) {
header("Content-type: text/json; charset=utf-8");
echo '{"response": false,"apiToken": "invalid"}';
}
}
示例8: stripslashes
<TR>
<TD width="10" vAlign=top</TD>
<TD width="740" vAlign=top colspan="2">
<IMG SRC="images/menu/textmenu_member.gif" BORDER="0">
<TABLE width="740" align=center cellSpacing=0 cellPadding=0 border=0>
<TR>
<TD height="1" class="dotline" ></TD>
</TR>
<TR><td>
<?php
$user_login = stripslashes($_POST['user_login']);
$user_login = mysql_real_escape_string($_POST['user_login']);
$pwd_login = stripslashes($_POST['pwd_login']);
$pwd_login = mysql_real_escape_string($_POST['pwd_login']);
if (is_valid($user_login) == true && is_valid($pwd_login) == true) {
$Username = preg_replace('/"/i', '\\"', $user_login);
$Password = preg_replace("/'/i", "\\'", $pwd_login);
anti_injection($Username, $Password, $IPADDRESS);
//ÃкºÊÁÒªÔ¡àÊÃÔÁ maxsite 1.10 ¾Ñ²¹Òâ´Â www.narongrit.net
if (USE_CAPCHA) {
if ($_SESSION['security_code'] != $_POST['security_code'] or empty($_POST['security_code'])) {
echo "<script language='javascript'>";
echo "alert('" . _JAVA_CAPTCHA_NOACC . "')";
echo "</script>";
echo "<script language='javascript'>javascript:history.go(-1)</script>";
// echo " if(".$_SESSION['security_code']." != ".$_POST['security_code']." OR empty(".$_POST['security_code'].")) {";
exit;
}
}
if (isset($Username) and isset($Password)) {
示例9: mysql_free_result
if ($row && $row->user_id == $_SESSION['user_id']) {
$ok = true;
}
if (isset($_SESSION['source_browser'])) {
$ok = true;
}
$view_reinfo = "";
if ($ok == true) {
if ($row->user_id != $_SESSION['user_id']) {
$view_mail_link = "<a href='mail.php?to_user={$row->user_id}&title={$MSG_SUBMIT} {$id}'>Mail the auther</a>";
}
mysql_free_result($result);
$sql = "SELECT `error` FROM `runtimeinfo` WHERE `solution_id`='" . $id . "'";
$result = mysql_query($sql);
$row = mysql_fetch_object($result);
if ($row && ($OJ_SHOW_DIFF || is_valid($row->error))) {
$view_reinfo = htmlspecialchars(str_replace("\n\r", "\n", $row->error));
}
mysql_free_result($result);
} else {
mysql_free_result($result);
$view_errors = "I am sorry, You could not view this message!";
require "template/" . $OJ_TEMPLATE . "/error.php";
exit(0);
}
/////////////////////////Template
require "template/" . $OJ_TEMPLATE . "/reinfo.php";
/////////////////////////Common foot
if (file_exists('./include/cache_end.php')) {
require_once './include/cache_end.php';
}
示例10: sendHipchatMessage
<?php
require __DIR__ . '/vendor/autoload.php';
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
$dotenv = new Dotenv\Dotenv(__DIR__);
$dotenv->load();
$request = Request::createFromGlobals();
if (is_valid($request)) {
sendHipchatMessage($request);
}
/**
* Verification request + calcul signature
*/
function is_valid($request)
{
$payload = $request->getContent();
if (empty($payload)) {
returnResponse('empty payload', 400);
return false;
}
//Bignou calcul signature Gihub
if (!isGithubSignatureValid($request)) {
returnResponse('invalid github signature', 400);
return false;
}
//verif valid payload
if (null === json_decode($payload)) {
returnResponse('invalid json body', 400);
return false;
}
示例11: mx_mnfanmed
function mx_mnfanmed($page, $option, $action)
{
global $mxuser;
mx_showhtmlpage('fanmed');
$subs = $mxuser->getsub();
// TODO: search active subs only
//error_log('subs:'.print_r($subs,true));
$artists = array();
foreach ($subs as $sub) {
if (is_valid($sub)) {
$artists[] = $sub->artistid;
}
}
echo mx_showmediastr($artists, 'fanmed');
}
示例12: elseif
// check all chars are valid
if (!preg_match("/^[-+*\\/.\\d]+\$/", $expr)) {
return false;
} elseif (preg_match("/^[+*\\/.]{2,}\$/", $expr)) {
return false;
} elseif (preg_match("/^[-]{3,}\$/", $expr)) {
return false;
} elseif (preg_match("/^[+*\\/.]/", $expr)) {
return false;
} elseif (preg_match("/[-+*\\/.]\$/", $expr)) {
return false;
}
return true;
}
$expr = trim($_GET["expr"]);
if (is_valid($expr)) {
$expr = str_replace("--", "+", $expr);
if (preg_match("/\\/[0]/", $expr)) {
// does NOT handle cases such as 1/0.5
echo "Division by zero error!";
} else {
$invalid = eval("\$ans={$expr};");
if ($invalid) {
echo "Invalid expression!";
} else {
echo $expr . " = " . $ans;
}
}
} else {
echo "Invalid expression!";
}
示例13: get_nameid
}
function get_nameid($xml)
{
$xpath = new DOMXPath($xml);
$xpath->registerNamespace("samlp", "urn:oasis:names:tc:SAML:2.0:protocol");
$xpath->registerNamespace("saml", "urn:oasis:names:tc:SAML:2.0:assertion");
//$query = "/samlp:Response/saml:Assertion/saml:Subject/saml:NameID";
$query = "/samlp:Response/saml:Assertion/saml:AttributeStatement/saml:Attribute";
$entries = $xpath->query($query);
return $entries->item(0)->nodeValue;
}
function genToken()
{
return mt_rand() . mt_rand() . mt_rand() . mt_rand() . mt_rand();
}
if (is_valid($document, $x509certificate)) {
//echo htmlentities($documentStr);
$authedUser = get_nameid($document);
$desiredUser = $_COOKIE['userId'];
if ($authedUser != $desiredUser) {
echo "Sorry, you want to log in to '{$desiredUser}' but it looks like you are '{$authedUser}'. Please go away.";
die;
} else {
$token = genToken();
$categories = json_encode(explode(',', $_COOKIE['scope']));
$redis->set('token:' . $_COOKIE['userId'] . ':' . $token, $categories);
//echo 'redis->set(token:'.$_COOKIE['userId'].':'.$token.', '.$categories;
//echo 'Location: '.$_COOKIE['redirectUri'].'#access_token='.urlencode($token);
header('Location: ' . $_COOKIE['redirectUri'] . '#access_token=' . urlencode($token));
}
} else {
示例14: mysqli_free_result
if ($row && $row->user_id == $_SESSION['user_id']) {
$ok = true;
}
if (isset($_SESSION['source_browser'])) {
$ok = true;
}
$view_reinfo = "";
if ($ok == true) {
if ($row->user_id != $_SESSION['user_id']) {
$view_mail_link = "<a href='mail.php?to_user={$row->user_id}&title={$MSG_SUBMIT} {$id}'>Mail the auther</a>";
}
mysqli_free_result($result);
$sql = "SELECT `error` FROM `runtimeinfo` WHERE `solution_id`='" . $id . "'";
$result = mysqli_query($mysqli, $sql);
$row = mysqli_fetch_object($result);
if ($row && ($OJ_SHOW_DIFF || $OJ_TEST_RUN || is_valid($row->error))) {
$view_reinfo = htmlentities(str_replace("\n\r", "\n", $row->error), ENT_QUOTES, "UTF-8");
}
mysqli_free_result($result);
} else {
mysqli_free_result($result);
$view_errors = "I am sorry, You could not view this message!";
require "template/" . $OJ_TEMPLATE . "/error.php";
exit(0);
}
/////////////////////////Template
require "template/" . $OJ_TEMPLATE . "/reinfo.php";
/////////////////////////Common foot
if (file_exists('./include/cache_end.php')) {
require_once './include/cache_end.php';
}
示例15: die
if (mydb::cxn()->error != '') {
die("Retrieving valid YEARs failed: " . mydb::cxn()->error . "<br>\n" . $query);
}
while ($row = $result->fetch_assoc()) {
if ($row['year'] == $year) {
return 1;
}
}
return 0;
//Year is NOT valid or else function would have returned 1 by now
}
//************** MAIN **************************************
if ($_GET['year'] == "current") {
$_GET['year'] = date('Y');
}
if (is_valid($_GET['year'])) {
$year = $_GET['year'];
} else {
$year = 0;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml2/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Roster :: Siskiyou Rappel Crew</title>
<?php