本文整理汇总了PHP中trimAll函数的典型用法代码示例。如果您正苦于以下问题:PHP trimAll函数的具体用法?PHP trimAll怎么用?PHP trimAll使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了trimAll函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: mysqli_connect
include_once "./default.php";
include_once "./config.php";
$connect = mysqli_connect(DB, DBLOGIN, DBPASS, DBNAME);
mysqli_set_charset($connect, 'utf8');
if (isset($_POST['submit']) && filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
$_POST = m_r_e_sAll($_POST);
$_POST = trimAll($_POST);
$_POST = htmlAll($_POST);
$_POST = clearData($_POST);
$name = $_POST['name'];
$email = $_POST['email'];
$text = $_POST['text'];
$date = $_POST['date'];
$query = "INSERT INTO gbook VALUES ('','{$name}','{$email}','{$text}','{$date}')";
$res = mysqli_query($connect, $query) or die(mysqli_error());
header("Location:../index.php");
}
if (isset($_GET['del'])) {
//условие на удаление записи из Gbook
$_GET = m_r_e_sAll($_GET);
$_GET = trimAll($_GET);
$_GET = clearData($_GET);
$_GET = htmlAll($_GET);
$id = (int) $_GET['del'];
if ($id > 0) {
$query = "DELETE FROM gbook WHERE id = '{$id}'";
$res = mysqli_query($connect, $query) or die(mysqli_error());
}
header("Location:../index.php");
exit;
}
开发者ID:capons,项目名称:WEB-ALL-Information,代码行数:31,代码来源:Gbook.php
示例2: define
<?php
define('DB', 'localhost');
define('DBLOGIN', 'user');
define('DBPASS', '111');
define('DBNAME', 'bogdan');
define('DOMAIN', 'http://demo/Bogdan/libs/');
$connect = mysqli_connect(DB, DBLOGIN, DBPASS, DBNAME) or die(mysqli_error());
mysqli_set_charset($connect, 'utf8');
$coil = $_SESSION['user']['id'];
if (isset($_SESSION['pass'])) {
$new1 = $_SESSION['pass'];
unset($_SESSION['pass']);
}
if (isset($_POST['pass']) && $_POST['pass1'] && filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
$_POST = trimAll($_POST);
$_POST = m_r_e_sAll($_POST);
$_POST = htmlAll($_POST);
$email = $_POST['email'];
$pass = $_POST['pass'];
$pass1 = $_POST['pass1'];
if ($pass == $pass1) {
$pass = md5($pass);
//зашифрованный пароль можно использ функцию зашифровки в default myHash
} else {
$_SESSION['info'] = 'Пароль не правельный';
header("Location: ../settings.php");
}
if ($email == $_SESSION['user']['email']) {
mysqli_query($connect, "UPDATE capons SET\n pass = '{$pass}'\n WHERE id = '{$coil}'\n ") or die(mysqli_error());
// $id = mysqli_insert_id($connect); //функция возвращает ID последнего добавленного элемента в БД - что-бы передать ID для проверки активации
开发者ID:capons,项目名称:WEB-ALL-Information,代码行数:31,代码来源:button.php
示例3: nextAddress
public function nextAddress()
{
$myrow = mysql_fetch_array($this->result);
if ($myrow) {
return new Address(trimAll($myrow));
} else {
return false;
}
}
开发者ID:karanikn,项目名称:php-addressbook,代码行数:9,代码来源:address.class.php
示例4: get_userinfo
}
function get_userinfo()
{
$filename = "~/.hatebulist";
$str = exec('cat ' . $filename, $output);
$userinfo_array = explode(" ", $output[0]);
return array('user_name' => $userinfo_array[0], 'api_key' => $userinfo_array[1]);
}
$user = get_userinfo();
$user_name = $user['user_name'];
$api_key = $user['api_key'];
#http://d.hatena.ne.jp/i_ogi/20100214/wsse
$url = "http://b.hatena.ne.jp/" . $user_name . "/search/json?q=" . $query . "&sort=date&limit=20";
$nonce = md5(mt_rand());
$created = date(DATE_ISO8601);
$x_wsse = sprintf('UsernameToken Username="%s", PasswordDigest="%s", Nonce="%s", Created="%s"', $user_name, base64_encode(sha1($nonce . $created . $api_key, true)), base64_encode($nonce), $created);
$context = stream_context_create(array('http' => array('header' => "X-WSSE: {$x_wsse}\r\n" . "User-Agent: HatebuList.alfredworkflow")));
$file = file_get_contents($url, 0, $context);
$json = json_decode($file);
$dataList = $json;
foreach ($dataList->bookmarks as $data) {
$entry = $data->entry;
$title = $entry->title;
$count = $entry->count;
$snippet = trimAll($entry->snippet);
$wf_url = $entry->url;
$wf_title = $title;
$wf_description = $snippet;
$wf->result(time(), $wf_url, $wf_title, $wf_description, 'icon.png');
}
echo $wf->toxml();
开发者ID:snize,项目名称:alfred-hatebulist,代码行数:31,代码来源:hl.php
示例5: parse_str
<?php
require_once "../config/Autoload.php";
//Autoload class
require_once "../libs/datafilter.php";
//form validate
$method = $_SERVER['REQUEST_METHOD'];
//variable contains the name of the "Request method"
if ($method == 'DELETE') {
parse_str(file_get_contents("php://input"), $editData);
//$editData - variable containe delete Data
$editData = trimAll($editData);
//validate PUT data
$editData = htmlAll($editData);
//validate PUT data
$deleteCity = Main::deleteData($editData['del_country'], $editData['del_city'], $editData['del_language']);
//delete city
$editData['info'] = 'Successfully removed';
$lastCity = City::lastCity($editData['del_country']);
//if the country have only 1 city delete the country and language
if (mysqli_num_rows($lastCity) == 0) {
$deleteCountryLanguge = Language::deleteLanguage($editData['del_language']);
//delete language
$deleteCountry = Country::deleteCountry($editData['del_country']);
//delete country
$editData['info'] = 'Successfully removed';
}
echo json_encode($editData);
//send response data to Jquery
}
开发者ID:capons,项目名称:math,代码行数:30,代码来源:deleteData.php
示例6: checkRequirement
/**
* checkRequirement taking a String with course Requirements. E.g:
* 'MATH 1104'
* 'MATH 1003, SYSC 4000 and SYSC 1009'
* '(SYSC 1003 and SYSC 1005) and SYSC 4000 and SYSC 1009 or (SYSC 1003 and SYSC 1005)'
*
* @param [String] $requirement [description]
* @param [List] $completedCourses [description]
* @return [type] [description]
*/
function checkRequirement($requirement, $completedCourses)
{
$requirement = trimAll($requirement);
if ($requirement == '') {
return '';
}
while (findBracket($requirement)) {
$callback = new MyCallback($completedCourses);
$requirement = preg_replace_callback(BRACKETREG, array($callback, 'callbackFunction'), $requirement);
}
//No Bracket from here
if (isCourse($requirement)) {
//return true for completed this course
if (in_array($requirement, $completedCourses)) {
return True;
} else {
return False;
}
}
$checkResult = checkOrAnd($requirement);
if ($checkResult == '') {
// TODO; need to think about this..
// SPecial Requirements
// Giving a Message
if (strpos($requirement, 'permission of the department')) {
// Special requirement
$isEligible = true;
// Message to .....
// echo "MEssage";
}
} else {
if ($checkResult == 'and none') {
$req = '/(,|and|AND|And)/';
$arr = preg_split($req, $requirement);
foreach ($arr as $a) {
$a = trim($a);
if ($a == 'False' or $a != '' and !checkRequirement($a, $completedCourses)) {
return False;
}
}
return True;
} else {
if ($checkResult == 'or none') {
$req = '/(,|or|OR|Or)/';
$arr = preg_split($req, $requirement);
foreach ($arr as $a) {
$a = trim($a);
if ($a == 'True' or checkRequirement($a, $completedCourses)) {
return True;
}
}
return False;
} else {
if ($checkResult == 'or and') {
$andIndex = strpos($requirement, 'and');
$orStatement = checkRequirement(substr($requirement, 0, $andIndex), $completedCourses);
if ($orStatement) {
return True;
} else {
return checkRequirement(substr($requirement, $andIndex), $completedCourses);
}
} else {
if ($checkResult == 'and or') {
$orIndex = strpos($requirement, "or");
$orStatement = checkRequirement(substr($requirement, 0, $orIndex), $completedCourses);
if (!$orStatement) {
return False;
}
$orStatement = $orStatement ? 'True' : 'False';
return checkRequirement($orStatement . " " . substr($requirement, $orIndex), $completedCourses);
}
}
}
}
}
return True;
}
开发者ID:Rosengren,项目名称:CourseBuilder,代码行数:87,代码来源:PreRequisite.class.php
示例7: q
<?php
#Прокидываем запрос на проверку юзверя
if (!empty($_SESSION['user'])) {
$check_bd = q("\n SELECT *\n FROM `users`\n WHERE `id` = '" . ms($_SESSION['user']['id']) . "'\n LIMIT 1\n ");
if (mysqli_num_rows($check_bd)) {
$_SESSION['user'] = mysqli_fetch_assoc($check_bd);
#Если юзверь забанен - выгоняем его.
if ($_SESSION['user']['active'] == 2) {
include_once './modules/cab/exit.php';
exit;
}
}
} elseif (isset($_COOKIE['id'], $_COOKIE['hash'])) {
#Проверяем на куки
#Чистим от пробелов и экранируем кавычки перед запросом
$check = ms(trimAll($_COOKIE));
#Проверяем полученные куки и браузер юзверя на соответсвие в бд
$check_bd = q("\n SELECT *\n FROM `users`\n WHERE `hash` = '" . $check['hash'] . "'\n AND `id` = '" . $check['id'] . "'\n AND `agent` = '" . $_SERVER['HTTP_USER_AGENT'] . "'\n ");
#Если такой пользователь есть, то авторизуем его.
if (mysqli_num_rows($check_bd)) {
$_SESSION['user'] = mysqli_fetch_assoc($check_bd);
}
}
开发者ID:Vladimir25,项目名称:l17,代码行数:24,代码来源:allpages.php
示例8: mysql_query
}
} else {
if (isset($_REQUEST['all'])) {
include "include/view.w.php";
$sql = "SELECT * FROM {$base_from_where} order by lastname, firstname";
$result = mysql_query($sql, $db);
$cnt = 0;
echo "<h1>" . ucfmsg('ADDRESS_BOOK') . ($group ? " " . msg('FOR') . " <i>{$group}</i></h1>" : "</h1>");
?>
<table id="view">
<?php
$only_phones = isset($_REQUEST['phones']);
$addr_per_line = $only_phones ? 4 : 3;
while ($r = mysql_fetch_array($result)) {
$r = trimAll($r);
$address = new Address($r);
if ($address->hasPhone() || !$only_phones) {
if ($cnt % (2 * $addr_per_line) == 0) {
echo "<tr class='odd'>";
}
if ($cnt % (2 * $addr_per_line) == $addr_per_line) {
echo "<tr class='even'>";
}
echo "<td valign='top'>";
showOneEntry($r, $only_phones);
echo "</td>";
$cnt++;
if ($cnt % $addr_per_line == 0) {
echo "</tr>";
}
开发者ID:karanikn,项目名称:php-addressbook,代码行数:31,代码来源:view.php
示例9: makeDegreesSQL
function makeDegreesSQL($id)
{
//remove whitespace, then remove empty
trimAll($this->Majors);
trimAll($this->Minors);
$this->Majors = array_filter($this->Majors);
$this->Minors = array_filter($this->Minors);
if (count($this->Majors) + count($this->Minors) == 0) {
return "";
}
//TODO: I think this is only supposed to add degrees that exist in the Degrees table...
$sql = "INSERT INTO `UserDegrees` (UserID, DegName, IsMajor) VALUES ";
foreach ($this->Majors as $deg) {
sanitizeIn($deg);
//TODO: checkme!!! Does this work properly?
$sql = $sql . "('" . $id . "', '" . $deg . "', 1), ";
}
foreach ($this->Minors as $deg) {
sanitizeIn($deg);
//TODO: checkme!!! Does this work properly?
$sql = $sql . "('" . $id . "', '" . $deg . "', 0), ";
}
return substr($sql, 0, -2);
}
开发者ID:ahmeteren1453,项目名称:Web-Portal-Project,代码行数:24,代码来源:CreateProfile.php
注:本文中的trimAll函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论