本文整理汇总了PHP中check_string函数的典型用法代码示例。如果您正苦于以下问题:PHP check_string函数的具体用法?PHP check_string怎么用?PHP check_string使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_string函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: read_files_by_type_owner
/**
* @param $type
* @param $user_id
* @return array
*/
public function read_files_by_type_owner($type, $user_id, $limit = '')
{
check_int($user_id, 'user_id');
check_string($type, 'type');
$sql = "SELECT\n user_files.id AS user_files_id,\n user_file_types.name type,\n files.name file_name,\n files.date_added,\n files.id files_id\n\n FROM user_files\n INNER JOIN user_file_states ON user_file_states.id = user_files.user_file_states_id\n INNER JOIN user_file_types ON user_file_types.id = user_files.user_file_types_id\n INNER JOIN files ON files.id = user_files.files_id\n INNER JOIN users ON users.id = user_files.users_id\n WHERE users.id = {$user_id} AND user_file_types.name = '{$type}'\n ORDER BY files.date_added DESC\n " . ((int) $limit > 0 ? "LIMIT {$limit}" : "") . "\n ;";
return $this->common($sql);
}
示例2: nick
function nick()
{
$reg_mb_nick = $this->input->post('reg_mb_nick');
$TRUE = $FALSE = FALSE;
// 별명은 한글, 영문, 숫자만 가능
$this->load->helper('chkstr');
if (!check_string($reg_mb_nick, _RT_HANGUL_ + _RT_ALPHABETIC_ + _RT_NUMERIC_)) {
$FALSE = '별명은 공백없이 한글, 영문, 숫자만 입력 가능합니다.';
} else {
if (strlen($reg_mb_nick) < 4) {
$FALSE = '한글 2글자, 영문 4글자 이상 입력 가능합니다.';
} else {
$row = $this->Register_model->is('mb_nick', $reg_mb_nick);
if ($row != 0) {
$FALSE = '이미 존재하는 별명입니다.';
} else {
if (preg_match("/[\\,]?" . $reg_mb_nick . "/i", $this->config->item('cf_prohibit_id'))) {
$FALSE = '예약어로 사용할 수 없는 별명 입니다.';
} else {
$TRUE = '사용하셔도 좋은 별명 입니다.';
}
}
}
}
if ($TRUE) {
echo '<span class="text-success">' . $TRUE . '</span>';
} else {
if ($FALSE) {
echo '<span class="text-danger">' . $FALSE . '</span>';
}
}
}
示例3: update_field
/**
* @param $id
* @param $field
* @param $value
* @param $table
* @return array
*/
public function update_field($id, $field, $value, $table)
{
check_int($id, 'id');
check_string($field, 'field');
check_string($value, 'value');
check_string($table, 'table');
$sql = "UPDATE `{$table}` SET `{$field}` = " . $this->db->escape($value) . " WHERE id = " . $this->db->escape($id) . ";";
return $this->common($sql);
}
示例4: isAuthorized
function isAuthorized()
{
global $db, $CNF;
session_start();
$cookie_id = check_string($_COOKIE["user_id"], "digits");
$cookie_hash = check_string($_COOKIE["hash"], "string");
if (isset($cookie_id) and isset($cookie_hash)) {
$db = new DBLayer($CNF["db_host"], $CNF["db_user"], $CNF["db_pass"], $CNF["db_name"]);
$db->query("SET NAMES utf8");
$query_auth = $db->query("SELECT `uid`,`login`,`lastname`,`firstname`,`settings` FROM users WHERE `gid`=1 AND `uid`='{$cookie_id}' AND `pass_hash`='{$cookie_hash}'");
if ($db->num_rows($query_auth) == 1) {
$auth = $db->fetch_assoc($query_auth);
return $auth;
}
}
return false;
}
示例5: session_start
<?php
require 'conf.php';
require 'subs.php';
session_start();
// -- begin ENV -- //
$name = empty($_POST['name']) ? '' : check_string($_POST['name'], 'string');
// Login
$msg_class = empty($_POST['msg_class']) ? '' : $_POST['msg_class'];
// Класс сообщения (failed или success)
$msg = empty($_POST['msg']) ? '' : $_POST['msg'];
// Сообщения
// -- end ENV -- //
// ----- BEGIN ----- //
if (!isset($_POST['stage'])) {
include './forms/login.html';
/*Форма для ввода имени и пароля*/
} else {
if ($_POST['stage'] == 'Go') {
$admin_login = get_data_from_db(array("0" => "SELECT id,login,fio,email,permission FROM admins WHERE login='" . $name . "' and pass='" . md5($_POST['pass']) . "'"));
if ($admin_login[0] != '' and count($admin_login[0]) == 1) {
$_SESSION['valid'] = true;
$_SESSION['admin_id'] = $admin_login[0][0]['id'];
$_SESSION['admin'] = $admin_login[0][0]['login'];
$_SESSION['admin_fio'] = $admin_login[0][0]['fio'];
$_SESSION['admin_email'] = $admin_login[0][0]['email'];
$_SESSION['permission'] = $admin_login[0][0]['permission'];
unset($_POST['name'], $_POST['pass'], $_POST['stage']);
header("Location: index2.php");
} else {
$msg_class = 'failed';
示例6: session_start
<?php
session_start();
ob_start();
include 'db.inc.php';
include 'functions.php';
$action = $_POST['action'];
if ($action == "addfeedback") {
$url = "personal_trainings.php";
$error_msg = "";
$registration_id = $_SESSION['registration_id'];
$trainer_registraion_id = $_POST['trainer_registraion_id'];
$post_date = date('Y-m-d h:i:s');
$feed_description = check_string($_POST['feed_description']);
if ($feed_description == 1) {
$error_msg .= "<li>Enter Some Description</li>";
} else {
$feed_description = $_POST['feed_description'];
}
if ($error_msg == "") {
$check = $conn->query("select * from master_feedback where trainer_id='{$trainer_registraion_id}' and registration_id='{$registration_id}'");
$checkrows = $check->num_rows;
if ($checkrows > 0) {
$error_msg .= "Feedback is Alredy given";
} else {
if ($conn->query("insert into master_feedback set registration_id='{$registration_id}',trainer_id='{$trainer_registraion_id}',feed_description='{$feed_description}',status='1',post_date='{$post_date}'") == TRUE) {
$error_msg = "success";
} else {
$error_msg = "";
$url = "error.php";
}
示例7: is_null
$level = is_null($level) ? 'testsuite' : $level;
break;
}
}
$args->action = $action;
$smarty->assign('level', $level);
$smarty->assign('page_title', lang_get('container_title_' . $level));
if ($init_opt_transfer) {
$opt_cfg = initializeOptionTransfer($tproject_mgr, $tsuite_mgr, $args, $action);
}
// create web editor objects
list($oWebEditor, $webEditorHtmlNames, $webEditorTemplateKey) = initWebEditors($action, $level, $editorCfg);
if ($get_c_data) {
$name_ok = 1;
$c_data = getValuesFromPost($webEditorHtmlNames);
if ($name_ok && !check_string($c_data['container_name'], $g_ereg_forbidden)) {
$msg = $l18n['string_contains_bad_chars'];
$name_ok = 0;
}
if ($name_ok && $c_data['container_name'] == "") {
$msg = $l18n['warning_empty_testsuite_name'];
$name_ok = 0;
}
}
switch ($action) {
case 'fileUpload':
switch ($level) {
case 'testsuite':
fileUploadManagement($db, $args->testsuiteID, $args->fileTitle, $tsuite_mgr->getAttachmentTableName());
$gui = initializeGui($tsuite_mgr, $args->testsuiteID, $args, $l18n);
$gui->refreshTree = 0;
示例8: alert
//$str = "\$mb_id = trim(strip_tags(mysql_real_escape_string(\$_POST[mb_id])));
$str = "if (preg_match(\"/[^0-9a-z_]+/i\", \$mb_id)) {\n alert(\"회원아이디는 영문자, 숫자, _ 만 사용할수 있습니다.\");\n}";
$file = str_replace("<?php", "", $file);
$file = str_replace("<?", "", $file);
$file = str_replace("?" . ">", "", $file);
$file = str_replace($str, "", $file);
//g5
$str = 'if ($msg = valid_mb_id($mb_id))';
$file = str_replace($str, "//", $file);
$str = <<<HEREDOC
echo "
<html><title>회원정보수정</title><meta http-equiv='Content-Type' content='text/html; charset=\$g4[charset]'></html><body>
<form name='fregisterupdate' method='post' action='{\$https_url}/register_form.php'>
<input type='hidden' name='w' value='u'>
<input type='hidden' name='mb_id' value='{\$mb_id}'>
<input type='hidden' name='mb_password' value='{\$tmp_password}'>
<input type='hidden' name='is_update' value='1'>
</form>
<script type='text/javascript'>
alert('회원 정보가 수정 되었습니다.');
document.fregisterupdate.submit();
</script>
</body>
</html>";
HEREDOC;
$file = str_replace($str, "alert('회원정보가 수정되었습니다.', \$g4[path]);", $file);
if (!check_string($member['mb_name'], _G4_HANGUL_)) {
$file = str_replace("set mb_nick", "set mb_name = '\$mb_name', mb_nick", $file);
}
eval($file);
exit;
示例9: mysql_update_query
function mysql_update_query($table, $rsnew, $id_key)
{
$upd_query = "UPDATE {$table} SET ";
$flag = false;
$updates_value = array();
foreach ($rsnew as $key => $value) {
/* echo "<br><br>analisi campo $key";
echo "<br>vecchio valore ".$rsold->fields($key);
echo "<br>nuovo valore ".$updates[$key];*/
//se è il campo id vado al campo successivo
if ($key == $id_key) {
continue;
}
if ($value == 'NOW()') {
$newvalue = $value;
} elseif ($value == 'null') {
$newvalue = 'null';
} else {
$newvalue = "'" . check_string($value) . "'";
}
$updates_value[] = " {$key} = {$newvalue} ";
}
return $upd_query . " " . implode(',', $updates_value) . " WHERE {$id_key} = '" . $rsnew[$id_key] . "'; ";
}
示例10: isset
<?php
#---------------------------------------------#
# ********* RotorCMS ********* #
# Author : Vantuz #
# Email : visavi.net@mail.ru #
# Site : http://visavi.net #
# ICQ : 36-44-66 #
# Skype : vantuzilla #
#---------------------------------------------#
require_once 'includes/start.php';
require_once 'includes/functions.php';
require_once 'includes/header.php';
$act = isset($_GET['act']) ? check($_GET['act']) : 'index';
$domain = check_string($config['home']);
switch ($act) {
############################################################################################
## Авторизация ##
############################################################################################
case 'index':
$login = isset($_REQUEST['login']) ? check(utf_lower($_REQUEST['login'])) : '';
$pass = isset($_REQUEST['pass']) ? md5(md5(trim($_REQUEST['pass']))) : '';
if (!empty($_POST['cookietrue']) || !empty($_GET['login'])) {
$cookietrue = 1;
}
if (!empty($login) && !empty($pass)) {
$udata = DB::run()->queryFetch("SELECT `users_login`, `users_pass` FROM `users` WHERE LOWER(`users_login`)=? OR LOWER(`users_nickname`)=? LIMIT 1;", array($login, $login));
if (!empty($udata)) {
if ($pass == $udata['users_pass']) {
if (!empty($cookietrue)) {
setcookie('cooklog', $udata['users_login'], time() + 3600 * 24 * 365, '/', $domain);
示例11: uploadFile
if ($_FILES['upload_cv']['name'] != "") {
$upload_cv = uploadFile($file_name, $file_temp, $file_type, $file_size, "cv");
if (preg_match("<li>", $upload_cv)) {
$error_msg .= $upload_cv;
}
} else {
if ($check_upload_cv != '') {
$upload_cv = $check_upload_cv;
} else {
$error_msg .= "<li>Please Upload your CV</li>";
}
}
} else {
$upload_cv = "";
}
$preffered_location_flag = check_string($_POST['preffered_location']);
if ($preffered_location_flag == 1) {
$error_msg .= "<li>Please enter valid location</li>";
} else {
$preffered_location = $_POST['preffered_location'];
}
$brief_profile_flag = $_POST['brief_profile'];
if ($brief_profile_flag == "") {
$error_msg .= "<li>Please enter valid text in your profile</li>";
} else {
$brief_profile = $_POST['brief_profile'];
}
$brief_profile = ereg_replace("\n", "<br/>", $_POST['brief_profile']);
$keyword_skill_flag = $_POST['keyword_skill'];
if ($keyword_skill_flag == "") {
$error_msg .= "<li>Please enter valid text in your keyword</li>";
示例12: check_string
$rating = check_string($_REQUEST['rating'], 'digits');
$result = rateTicket($admin_login["uid"], $ticket, $rating);
break;
case "changeTicketStatus":
$ticket = check_string($_REQUEST['ticket'], 'digits');
$status = check_string($_REQUEST['status'], 'digits');
$result = changeTicketStatus($admin_login["uid"], $ticket, $status);
break;
case 'reloadComments':
require_once "../vendor/autoload.php";
Twig_Autoloader::register();
$loader = new Twig_Loader_Filesystem("../templates/helpdesk");
$twig = new Twig_Environment($loader, array("cache" => ""));
$c['users'] = getUsers();
$c['uid'] = $admin_id;
$ticket_id = check_string($_REQUEST['ticket_id'], 'digits');
$hide_autocomments = check_string($_REQUEST['hide_autocomments'], 'text');
$c['ticket']['comments'] = getTicketComments($ticket_id);
$template = $hide_autocomments == 0 ? 'ticket_edit_comments.twig' : 'client/ticket_view_comments.twig';
$result['comments_block'] = $twig->render($template, $c);
$result['success'] = true;
unset($result['msg']);
break;
}
}
/* Возвращаем результат также в виде JSON-объекта.
* В случае безошибочного получения результата,
* Делаем $result['success'] = true;
* Остальные параметры - опциональные
* */
print_r(json_encode($result));
示例13: check_string
$company_contact_email = $_POST['company_contact_email'];
}
$comapny_landline = $_REQUEST['comapny_landline'];
$address1_flag = check_string($_REQUEST['address1']);
if ($address1_flag == 1) {
$error_msg .= "<li>Enter valid address1</li>";
} else {
$address1 = $_REQUEST['address1'];
}
$address2_flag = check_string($_REQUEST['address2']);
if ($address2_flag == 1) {
$error_msg .= "<li>Enter valid address2</li>";
} else {
$address2 = $_REQUEST['address2'];
}
$address3 = $_POST['address3'];
$pincode_flag = check_string($_REQUEST['pincode']);
if ($pincode_flag == 1) {
$error_msg .= "<li>Enter valid pincode</li>";
} else {
$pincode = $_REQUEST['pincode'];
}
if ($error_msg == "") {
if ($conn->query("update job_profile set fname='{$fname}',company_name='{$company_name}',company_profile='{$company_profile}',company_contact_email='{$company_contact_email}',comapny_landline='{$comapny_landline}',address1='{$address1}',address2='{$address2}',address3='{$address3}',pincode='{$pincode}' where registration_id='{$registration_id}'") == TRUE) {
$error_msg = "success";
} else {
$url = "error.php";
$error_msg = "";
}
}
echo json_encode(array('url' => $url, 'error_msg' => $error_msg));
示例14: empty
$form_admin = empty($_POST['form_admin']) ? '' : check_string($_POST['form_admin'], 'string');
// Логин админа с формы
$form_permission_id = empty($_POST['form_permission_id']) ? '' : check_string($_POST['form_permission_id'], 'digits');
// Права доступа админа (группа) с формы
if (isset($_POST['form_admin_email']) and $_POST['form_admin_email'] != '') {
if (check_string($_POST['form_admin_email'], 'email')) {
$form_admin_email = $_POST['form_admin_email'];
} else {
$form_admin_email = '';
}
} else {
$form_admin_email = '';
}
$form_admin_pass = empty($_POST['form_admin_pass']) ? '' : $_POST['form_admin_pass'];
// Пароль админа с формы
$action = empty($_REQUEST['action']) ? '' : check_string($_REQUEST['action'], 'string');
// Действие
//$msg_class = empty($_POST['msg_class']) ? '' : $_POST['msg_class']; // Класс сообщения (failed или success)
$page_name = 'Личный кабинет: ' . $admin_fio;
// -- end ENV -- //
// ----- BEGIN ----- //
switch ($action) {
case 'cabinet_edit':
//Проверка введённых данных
if (strlen($form_admin_fio) > 3 and strlen($form_admin) > 3 and $form_permission_id != '' and $form_admin_email != '') {
if ($permission_id == 1) {
if ($form_admin_pass != '') {
$query_cabinet_edit = "UPDATE admins SET login='" . $form_admin . "',fio='" . $form_admin_fio . "',pass='" . md5($form_admin_pass) . "',email='" . $form_admin_email . "',permission=" . $form_permission_id . " WHERE id=" . $admin_id;
} else {
// Иначе пароль не указан, пароль не менять
$query_cabinet_edit = "UPDATE admins SET login='" . $form_admin . "',fio='" . $form_admin_fio . "',email='" . $form_admin_email . "',permission=" . $form_permission_id . " WHERE id=" . $admin_id;
示例15: unset
if ($permissions["bills"] == 'deny') {
unset($TITLE["bills"]);
}
if ($permissions["users"] == 'deny') {
unset($TITLE["users"]);
}
$c['sections'] = $TITLE;
$c['dir'] = "helpdesk/reports";
$c['admin_fio'] = $c["lastname"] . " " . $c["firstname"];
$c['notify'] = getBurnedCounts($c["uid"]);
$admins = getAdmins(true);
$performer = isset($_REQUEST["performer"]) ? check_string($_REQUEST["performer"], "digits") : null;
$p = isset($performer) ? array($admins[$performer]['uid'] => $admins[$performer]) : $admins;
// print_r($p);
$month = (int) (isset($_REQUEST["m"]) ? check_string($_REQUEST["m"], "digits") : date("m"));
$year = isset($_REQUEST["y"]) ? check_string($_REQUEST["y"], "digits") : date("Y");
$days = date("t", strtotime("{$year}-{$month}-1"));
if ($month > 0) {
$dates = "{$year}-{$month}-1,{$year}-{$month}-{$days} 23:59:59";
} else {
$dates = "{$year}-1-1,{$year}-12-31 23:59:59";
}
$c["performer"] = $performer;
$c["MONTHS"] = $MONTHS;
$c["MONTHS"][0] = "весь год";
$c["month"] = $month;
$c["year"] = $year;
$c["dates"] = $dates;
foreach ($p as $admin) {
$uid = $admin['uid'];
$p[$uid]['filter_opened'] = '{"performers":"@' . $uid . '@","dates":"' . $dates . '"}';