本文整理汇总了PHP中utf_strlen函数的典型用法代码示例。如果您正苦于以下问题:PHP utf_strlen函数的具体用法?PHP utf_strlen怎么用?PHP utf_strlen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了utf_strlen函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: check_comment
function check_comment(&$str)
{
global $CONFIG, $lang_bad_words;
// convert some entities
$str = str_replace(array('&', '"', '<', '>', ' ', '''), array('&', '"', '<', '>', ' ', "'"), $str);
// if '<' is no start of a tag (e.g. a lower than + equal), convert it to entity to prevent strip_tags() to clip the comment wrongly
$str = preg_replace("/<([0-9<>=])/", '<\\1', $str);
// strip tags and cut to max allowed length
$str = trim(substr(strip_tags($str), 0, $CONFIG['max_com_size']));
// re convert some entities
$str = str_replace(array('"', '<', '>', "'"), array('"', '<', '>', '''), $str);
if ($CONFIG['filter_bad_words']) {
$ercp = array();
foreach ($lang_bad_words as $word) {
$ercp[] = '/' . ($word[0] == '*' ? '' : '\\b') . str_replace('*', '', $word) . ($word[strlen($word) - 1] == '*' ? '' : '\\b') . '/i';
}
$str = preg_replace($ercp, '(...)', $str);
}
$com_words = explode(' ', strip_tags(bb_decode($str)));
$replacements = array();
foreach ($com_words as $key => $word) {
if (utf_strlen($word) > $CONFIG['max_com_wlength']) {
$replacements[] = $word;
}
}
$str = str_replace($replacements, '(...)', $str);
}
示例2: check_comment
function check_comment(&$str)
{
global $CONFIG, $lang_bad_words, $queries;
// Added according to Andi's proposal: optimization of strip-Tags and max. comment length
// convert some entities
$str = str_replace(array('&', '"', '<', '>', ' ', '''), array('&', '"', '<', '>', ' ', "'"), $str);
// strip tags and cut to max allowed length
$str = trim(substr(strip_tags($str), 0, $CONFIG['max_com_size']));
// re convert some entities
$str = str_replace(array('"', '<', '>', "'"), array('"', '<', '>', '''), $str);
if ($CONFIG['filter_bad_words']) {
$ercp = array();
foreach ($lang_bad_words as $word) {
$ercp[] = '/' . ($word[0] == '*' ? '' : '\\b') . str_replace('*', '', $word) . ($word[strlen($word) - 1] == '*' ? '' : '\\b') . '/i';
}
$str = preg_replace($ercp, '(...)', $str);
}
$com_words = explode(' ', strip_tags(bb_decode($str)));
$replacements = array();
foreach ($com_words as $key => $word) {
if (utf_strlen($word) > $CONFIG['max_com_wlength']) {
$replacements[] = $word;
}
}
$str = str_replace($replacements, '(...)', $str);
}
示例3: check_comment
function check_comment(&$str)
{
global $CONFIG, $lang_bad_words, $queries;
if ($CONFIG['filter_bad_words']) {
$ercp = array();
foreach ($lang_bad_words as $word) {
$ercp[] = '/' . ($word[0] == '*' ? '' : '\\b') . str_replace('*', '', $word) . ($word[strlen($word) - 1] == '*' ? '' : '\\b') . '/i';
}
$str = preg_replace($ercp, '(...)', $str);
}
$com_words = explode(' ', strip_tags(bb_decode($str)));
$replacements = array();
foreach ($com_words as $key => $word) {
if (utf_strlen($word) > $CONFIG['max_com_wlength']) {
$replacements[] = $word;
}
}
$str = str_replace($replacements, '(...)', $str);
}
示例4: check
############################################################################################
############################################################################################
## Редактирование сообщения ##
############################################################################################
case 'editpost':
$uid = check($_GET['uid']);
$pid = abs(intval($_GET['pid']));
$msg = check($_POST['msg']);
if (isset($_POST['delfile'])) {
$del = intar($_POST['delfile']);
} else {
$del = 0;
}
if (is_user()) {
if ($uid == $_SESSION['token']) {
if (utf_strlen($msg) >= 5 && utf_strlen($msg) <= $config['forumtextlength']) {
$post = DB::run()->queryFetch("SELECT `posts`.*, `topics`.`topics_closed` FROM `posts` LEFT JOIN `topics` ON `posts`.`posts_topics_id`=`topics`.`topics_id` WHERE `posts_id`=? AND `posts_user`=? LIMIT 1;", array($pid, $log));
if (!empty($post)) {
if (empty($post['topics_closed'])) {
if ($post['posts_time'] + 600 > SITETIME) {
$msg = antimat($msg);
DB::run()->query("UPDATE `posts` SET `posts_text`=?, `posts_edit`=?, `posts_edit_time`=? WHERE `posts_id`=?;", array($msg, $log, SITETIME, $pid));
// ------ Удаление загруженных файлов -------//
if (!empty($del)) {
$del = implode(',', $del);
$queryfiles = DB::run()->query("SELECT * FROM `files_forum` WHERE `file_posts_id`=? AND `file_id` IN (" . $del . ");", array($pid));
$files = $queryfiles->fetchAll();
if (!empty($files)) {
foreach ($files as $file) {
if (file_exists(BASEDIR . '/upload/forum/' . $file['file_topics_id'] . '/' . $file['file_hash'])) {
unlink(BASEDIR . '/upload/forum/' . $file['file_topics_id'] . '/' . $file['file_hash']);
示例5: check
# Made by : VANTUZ #
# E-mail : visavi.net@mail.ru #
# Site : http://pizdec.ru #
# WAP-Site : http://visavi.net #
# ICQ : 36-44-66 #
# Вы не имеете право вносить изменения в код скрипта #
# для его дальнейшего распространения #
#-----------------------------------------------------#
require_once "../includes/start.php";
require_once "../includes/functions.php";
require_once "../includes/header.php";
include_once "../themes/" . $config['themes'] . "/index.php";
$msg = check($_POST['msg']);
show_title('partners.gif', 'Добавление сообщения');
if (is_user()) {
if (utf_strlen(trim($msg)) > 3 && utf_strlen($msg) < 1000) {
antiflood("Location: index.php?isset=antiflood&" . SID);
karantin($udata[6], "Location: index.php?isset=karantin&" . SID);
statistics(8);
$msg = no_br($msg, '<br />');
$msg = antimat($msg);
$msg = smiles($msg);
$file = file(DATADIR . "chat.dat");
$data = explode("|", end($file));
$text = no_br($msg . '|' . $log . '||' . SITETIME . '|' . $brow . '|' . $ip . '|0|' . $data[7] . '|' . $data[8] . '|');
write_files(DATADIR . "chat.dat", "{$text}\r\n");
$countstr = counter_string(DATADIR . "chat.dat");
if ($countstr >= $config['maxpostchat']) {
delete_lines(DATADIR . "chat.dat", array(0, 1, 2, 3, 4));
}
change_profil($log, array(14 => $ip, 12 => $udata[12] + 1, 36 => $udata[36] + 1, 41 => $udata[41] + 1));
示例6: check
############################################################################################
## Редактирование статьи ##
############################################################################################
############################################################################################
## Редактирование статьи ##
############################################################################################
case 'addeditblog':
$uid = check($_GET['uid']);
$title = check($_POST['title']);
$text = check($_POST['text']);
$user = check($_POST['user']);
$tags = check($_POST['tags']);
if ($uid == $_SESSION['token']) {
if (utf_strlen($title) >= 5 && utf_strlen($title) <= 50) {
if (utf_strlen($text) >= 100 && utf_strlen($text) <= $config['maxblogpost']) {
if (utf_strlen($tags) >= 2 && utf_strlen($tags) <= 50) {
if (preg_match('|^[a-z0-9\\-]+$|i', $user)) {
$queryblog = DB::run()->querySingle("SELECT `blogs_id` FROM `blogs` WHERE `blogs_id`=? LIMIT 1;", array($id));
if (!empty($queryblog)) {
DB::run()->query("UPDATE `blogs` SET `blogs_title`=?, `blogs_text`=?, `blogs_user`=?, `blogs_tags`=? WHERE `blogs_id`=?;", array($title, $text, $user, $tags, $id));
$_SESSION['note'] = 'Статья успешно отредактирована!';
redirect("blog.php?act=blog&cid={$cid}&start={$start}");
} else {
show_error('Ошибка! Данной статьи не существует!');
}
} else {
show_error('Ошибка! Недопустимые символы в логине! Разрешены только знаки латинского алфавита и цифры!');
}
} else {
show_error('Ошибка! Слишком длинные или короткие метки статьи (от 2 до 50 символов)!');
}
示例7: check_user_info
function check_user_info(&$error)
{
global $CONFIG;
global $lang_register_php, $lang_common, $lang_register_approve_email;
global $lang_register_user_login, $lang_errors;
$superCage = Inspekt::makeSuperCage();
$user_name = trim(get_post_var('username'));
$password = trim(get_post_var('password'));
$password_again = trim(get_post_var('password_verification'));
$email = trim(get_post_var('email'));
$profile1 = $superCage->post->getEscaped('user_profile1');
$profile2 = $superCage->post->getEscaped('user_profile2');
$profile3 = $superCage->post->getEscaped('user_profile3');
$profile4 = $superCage->post->getEscaped('user_profile4');
$profile5 = $superCage->post->getEscaped('user_profile5');
$profile6 = $superCage->post->getEscaped('user_profile6');
$agree_disclaimer = $superCage->post->getEscaped('agree');
$captcha_confirmation = $superCage->post->getEscaped('confirmCode');
$sql = "SELECT null FROM {$CONFIG['TABLE_USERS']} WHERE user_name = '{$user_name}'";
$result = cpg_db_query($sql);
if (mysql_num_rows($result)) {
$error = '<li style="list-style-image:url(images/icons/stop.png)">' . $lang_register_php['err_user_exists'] . '</li>';
return false;
}
mysql_free_result($result);
if (utf_strlen($user_name) < 2) {
$error .= '<li style="list-style-image:url(images/icons/stop.png)">' . $lang_register_php['username_warning2'] . '</li>';
}
if (!empty($CONFIG['global_registration_pw'])) {
$global_registration_pw = get_post_var('global_registration_pw');
if ($global_registration_pw != $CONFIG['global_registration_pw']) {
$error .= '<li style="list-style-image:url(images/icons/stop.png)">' . $lang_register_php['err_global_pw'] . '</li>';
} elseif ($password == $CONFIG['global_registration_pw']) {
$error .= '<li style="list-style-image:url(images/icons/stop.png)">' . $lang_register_php['err_global_pass_same'] . '</li>';
}
}
if (utf_strlen($password) < 2) {
$error .= '<li style="list-style-image:url(images/icons/stop.png)">' . $lang_register_php['password_warning1'] . '</li>';
}
if ($password == $user_name) {
$error .= '<li style="list-style-image:url(images/icons/stop.png)">' . $lang_register_php['password_warning2'] . '</li>';
}
if ($password != $password_again) {
$error .= '<li style="list-style-image:url(images/icons/stop.png)">' . $lang_register_php['password_verification_warning1'] . '</li>';
}
if (!Inspekt::isEmail($email)) {
$error .= '<li style="list-style-image:url(images/icons/stop.png)">' . $lang_register_php['email_warning2'] . '</li>';
}
if ($CONFIG['user_registration_disclaimer'] == 2 && $agree_disclaimer != 1) {
$error .= '<li style="list-style-image:url(images/icons/stop.png)">' . $lang_register_php['err_disclaimer'] . '</li>';
}
// Perform the ban check against email address and username
$result = cpg_db_query("SELECT null FROM {$CONFIG['TABLE_BANNED']} WHERE user_name = '{$user_name}' AND brute_force = 0 LIMIT 1");
if (mysql_num_rows($result)) {
$error .= '<li style="list-style-image:url(images/icons/stop.png)">' . $lang_register_php['user_name_banned'] . '</li>';
}
mysql_free_result($result);
$result = cpg_db_query("SELECT null FROM {$CONFIG['TABLE_BANNED']} WHERE email = '{$email}' AND brute_force = 0 LIMIT 1");
if (mysql_num_rows($result)) {
$error .= '<li style="list-style-image:url(images/icons/stop.png)">' . $lang_register_php['email_address_banned'] . '</li>';
}
mysql_free_result($result);
// check captcha
if ($CONFIG['registration_captcha'] != 0) {
if (!captcha_plugin_enabled('register')) {
require "include/captcha.inc.php";
if (!PhpCaptcha::Validate($captcha_confirmation)) {
$error .= '<li style="list-style-image:url(images/icons/stop.png)">' . $lang_errors['captcha_error'] . '</li>';
}
} else {
$error = CPGPluginAPI::filter('captcha_register_validate', $error);
}
}
if (!$CONFIG['allow_duplicate_emails_addr']) {
$sql = "SELECT null FROM {$CONFIG['TABLE_USERS']} WHERE user_email = '{$email}'";
$result = cpg_db_query($sql);
if (mysql_num_rows($result)) {
$error = '<li style="list-style-image:url(images/icons/stop.png)">' . $lang_register_php['err_duplicate_email'] . '</li>';
}
mysql_free_result($result);
}
$error = CPGPluginAPI::filter('register_form_validate', $error);
if ($error != '') {
return false;
}
if ($CONFIG['reg_requires_valid_email'] || $CONFIG['admin_activation']) {
$active = 'NO';
list($usec, $sec) = explode(' ', microtime());
$seed = (double) $sec + (double) $usec * 100000;
srand($seed);
$act_key = md5(uniqid(rand(), 1));
} else {
$active = 'YES';
$act_key = '';
}
$encpassword = md5($password);
$user_language = $CONFIG['lang'];
$sql = "INSERT INTO {$CONFIG['TABLE_USERS']} (user_regdate, user_active, user_actkey, user_name, user_password, user_email, user_profile1, user_profile2, user_profile3, user_profile4, user_profile5, user_profile6, user_language) VALUES (NOW(), '{$active}', '{$act_key}', '{$user_name}', '{$encpassword}', '{$email}', '{$profile1}', '{$profile2}', '{$profile3}', '{$profile4}', '{$profile5}', '{$profile6}', '{$user_language}')";
$result = cpg_db_query($sql);
$user_array = array();
//.........这里部分代码省略.........
示例8: isset
## Изменение описания ##
############################################################################################
############################################################################################
## Изменение описания ##
############################################################################################
case 'change':
$uid = isset($_GET['uid']) ? check($_GET['uid']) : '';
$title = isset($_POST['title']) ? check($_POST['title']) : '';
$text = isset($_POST['text']) ? check($_POST['text']) : '';
$types = empty($_POST['types']) ? 0 : 1;
$closed = empty($_POST['closed']) ? 0 : 1;
if ($uid == $_SESSION['token']) {
$queryoff = DB::run()->queryFetch("SELECT * FROM `offers` WHERE `offers_id`=? LIMIT 1;", array($id));
if (!empty($queryoff)) {
if (utf_strlen($title) >= 5 && utf_strlen($title) <= 50) {
if (utf_strlen($text) >= 5 && utf_strlen($text) <= 1000) {
$title = antimat($title);
$text = antimat($text);
DB::run()->query("UPDATE `offers` SET `offers_type`=?, `offers_closed`=?, `offers_title`=?, `offers_text`=? WHERE `offers_id`=?;", array($types, $closed, $title, $text, $id));
$_SESSION['note'] = 'Данные успешно отредактированы!';
redirect("offers.php?act=view&id={$id}");
} else {
show_error('Ошибка! Слишком длинное или короткое описание (От 5 до 1000 символов)!');
}
} else {
show_error('Ошибка! Слишком длинный или короткий заголовок (От 5 до 50 символов)!');
}
} else {
show_error('Ошибка! Данного предложения или проблемы не существует!');
}
} else {
示例9: check_user_info
function check_user_info(&$error)
{
global $CONFIG;
//, $PHP_SELF;
global $lang_register_php, $lang_register_confirm_email, $lang_continue, $lang_register_approve_email, $lang_register_activated_email, $lang_register_user_login;
//$CONFIG['admin_activation'] = FALSE;
//$CONFIG['admin_activation'] = TRUE;
$user_name = trim(get_post_var('username'));
$password = trim(get_post_var('password'));
$password_again = trim(get_post_var('password_verification'));
$email = trim(get_post_var('email'));
$profile1 = addslashes($_POST['user_profile1']);
$profile2 = addslashes($_POST['user_profile2']);
$profile3 = addslashes($_POST['user_profile3']);
$profile4 = addslashes($_POST['user_profile4']);
$profile5 = addslashes($_POST['user_profile5']);
$profile6 = addslashes($_POST['user_profile6']);
$sql = "SELECT user_id " . "FROM {$CONFIG['TABLE_USERS']} " . "WHERE user_name = '" . addslashes($user_name) . "'";
$result = cpg_db_query($sql);
if (mysql_num_rows($result)) {
$error = '<li>' . $lang_register_php['err_user_exists'];
return false;
}
mysql_free_result($result);
if (utf_strlen($user_name) < 2) {
$error .= '<li>' . $lang_register_php['err_uname_short'];
}
if (utf_strlen($password) < 2) {
$error .= '<li>' . $lang_register_php['err_password_short'];
}
if ($password == $user_name) {
$error .= '<li>' . $lang_register_php['err_uname_pass_diff'];
}
if ($password != $password_again) {
$error .= '<li>' . $lang_register_php['err_password_mismatch'];
}
if (!eregi("^[_\\.0-9a-z\\-]+@([0-9a-z][0-9a-z-]+\\.)+[a-z]{2,6}\$", $email)) {
$error .= '<li>' . $lang_register_php['err_invalid_email'];
}
if ($error != '') {
return false;
}
if (!$CONFIG['allow_duplicate_emails_addr']) {
$sql = "SELECT user_id " . "FROM {$CONFIG['TABLE_USERS']} " . "WHERE user_email = '" . addslashes($email) . "'";
$result = cpg_db_query($sql);
if (mysql_num_rows($result)) {
$error = '<li>' . $lang_register_php['err_duplicate_email'];
return false;
}
mysql_free_result($result);
}
if ($CONFIG['reg_requires_valid_email'] || $CONFIG['admin_activation']) {
$active = 'NO';
list($usec, $sec) = explode(' ', microtime());
$seed = (double) $sec + (double) $usec * 100000;
srand($seed);
$act_key = md5(uniqid(rand(), 1));
} else {
$active = 'YES';
$act_key = '';
}
if ($CONFIG['enable_encrypted_passwords']) {
$encpassword = md5($password);
} else {
$encpassword = $password;
}
$sql = "INSERT INTO {$CONFIG['TABLE_USERS']} " . "(user_regdate, user_active, user_actkey, user_name, user_password, user_email, user_profile1, user_profile2, user_profile3, user_profile4, user_profile5, user_profile6) " . "VALUES (NOW(), '{$active}', '{$act_key}', '" . addslashes($user_name) . "', '" . addslashes($encpassword) . "', '" . addslashes($email) . "', '{$profile1}', '{$profile2}', '{$profile3}', '{$profile4}', '{$profile5}', '{$profile6}')";
if ($CONFIG['log_mode']) {
log_write('New user "' . addslashes($user_name) . '" created on ' . date("F j, Y, g:i a"), CPG_ACCESS_LOG);
}
$result = cpg_db_query($sql);
if ($CONFIG['reg_requires_valid_email']) {
if (!$CONFIG['admin_activation'] == 1) {
//user gets activation email
$act_link = rtrim($CONFIG['site_url'], '/') . '/register.php?activate=' . $act_key;
$template_vars = array('{SITE_NAME}' => $CONFIG['gallery_name'], '{USER_NAME}' => $user_name, '{ACT_LINK}' => $act_link);
if (!cpg_mail($email, sprintf($lang_register_php['confirm_email_subject'], $CONFIG['gallery_name']), nl2br(strtr($lang_register_confirm_email, $template_vars)))) {
cpg_die(CRITICAL_ERROR, $lang_register_php['failed_sending_email'], __FILE__, __LINE__);
}
}
if ($CONFIG['admin_activation'] == 1) {
msg_box($lang_register_php['information'], $lang_register_php['thank_you_admin_activation'], $lang_continue, 'index.php');
} else {
msg_box($lang_register_php['information'], $lang_register_php['thank_you'], $lang_continue, 'index.php');
}
} else {
msg_box($lang_register_php['information'], $lang_register_php['acct_active'], $lang_continue, 'index.php');
}
// email notification to admin
if ($CONFIG['reg_notify_admin_email']) {
// get default language in which to inform the admin
$lang_register_php_def = cpg_get_default_lang_var('lang_register_php');
$lang_register_approve_email_def = cpg_get_default_lang_var('lang_register_approve_email');
if ($CONFIG['admin_activation'] == 1) {
$act_link = rtrim($CONFIG['site_url'], '/') . '/register.php?activate=' . $act_key;
$template_vars = array('{SITE_NAME}' => $CONFIG['gallery_name'], '{USER_NAME}' => $user_name, '{ACT_LINK}' => $act_link);
cpg_mail('admin', sprintf($lang_register_php_def['notify_admin_request_email_subject'], $CONFIG['gallery_name']), nl2br(strtr($lang_register_approve_email_def, $template_vars)));
} else {
cpg_mail('admin', sprintf($lang_register_php_def['notify_admin_email_subject'], $CONFIG['gallery_name']), sprintf($lang_register_php_def['notify_admin_email_body'], $user_name));
}
//.........这里部分代码省略.........
示例10: check
## Поиск ##
############################################################################################
case 'search':
$find = check(strval($_GET['find']));
$type = abs(intval($_GET['type']));
$where = abs(intval($_GET['where']));
$period = abs(intval($_GET['period']));
$section = abs(intval($_GET['section']));
if (!is_utf($find)) {
$find = win_to_utf($find);
}
if (utf_strlen($find) >= 3 && utf_strlen($find) <= 50) {
$findmewords = explode(" ", utf_lower($find));
$arrfind = array();
foreach ($findmewords as $val) {
if (utf_strlen($val) >= 3) {
$arrfind[] = empty($type) ? '+' . $val . '*' : $val . '*';
}
}
$findme = implode(" ", $arrfind);
if ($type == 2 && count($findmewords) > 1) {
$findme = "\"{$find}\"";
}
$config['newtitle'] = $find . ' - Результаты поиска';
$wheres = empty($where) ? 'topics' : 'posts';
$forumfind = $type . $wheres . $period . $section . $find;
// ----------------------------- Поиск в темах -------------------------------//
if ($wheres == 'topics') {
if (empty($_SESSION['forumfindres']) || $forumfind != $_SESSION['forumfind']) {
$searchsec = $section > 0 ? "`topics_forums_id`=" . $section . " AND" : '';
$searchper = $period > 0 ? "`topics_last_time`>" . (SITETIME - $period * 24 * 60 * 60) . " AND" : '';
示例11: check_user_info
function check_user_info(&$error)
{
// function check_user_info - start
global $CONFIG;
//, $PHP_SELF;
global $lang_register_php, $lang_register_confirm_email, $lang_common, $lang_register_approve_email;
global $lang_register_activated_email, $lang_register_user_login, $lang_errors;
$superCage = Inspekt::makeSuperCage();
//$CONFIG['admin_activation'] = FALSE;
//$CONFIG['admin_activation'] = TRUE;
$user_name = trim(get_post_var('username'));
$password = trim(get_post_var('password'));
$password_again = trim(get_post_var('password_verification'));
$email = trim(get_post_var('email'));
$profile1 = $superCage->post->getEscaped('user_profile1');
$profile2 = $superCage->post->getEscaped('user_profile2');
$profile3 = $superCage->post->getEscaped('user_profile3');
$profile4 = $superCage->post->getEscaped('user_profile4');
$profile5 = $superCage->post->getEscaped('user_profile5');
$profile6 = $superCage->post->getEscaped('user_profile6');
$agree_disclaimer = $superCage->post->getEscaped('agree');
$captcha_confirmation = $superCage->post->getEscaped('confirmCode');
$sql = "SELECT user_id " . "FROM {$CONFIG['TABLE_USERS']} " . "WHERE user_name = '" . $user_name . "'";
$result = cpg_db_query($sql);
if (mysql_num_rows($result)) {
$error = '<li>' . $lang_register_php['err_user_exists'] . '</li>';
return false;
}
mysql_free_result($result);
if (utf_strlen($user_name) < 2) {
$error .= '<li>' . $lang_register_php['err_uname_short'] . '</li>';
}
if (!empty($CONFIG['global_registration_pw'])) {
$global_registration_pw = get_post_var('global_registration_pw');
if ($global_registration_pw != $CONFIG['global_registration_pw']) {
$error .= '<li>' . $lang_register_php['err_global_pw'] . '</li>';
} elseif ($password == $CONFIG['global_registration_pw']) {
$error .= '<li>' . $lang_register_php['err_global_pass_same'] . '</li>';
}
}
if (utf_strlen($password) < 2) {
$error .= '<li>' . $lang_register_php['err_password_short'] . '</li>';
}
if ($password == $user_name) {
$error .= '<li>' . $lang_register_php['err_uname_pass_diff'] . '</li>';
}
if ($password != $password_again) {
$error .= '<li>' . $lang_register_php['err_password_mismatch'] . '</li>';
}
if (!eregi("^[_\\.0-9a-z\\-]+@([0-9a-z][0-9a-z-]+\\.)+[a-z]{2,6}\$", $email)) {
$error .= '<li>' . $lang_register_php['err_invalid_email'] . '</li>';
}
if ($CONFIG['user_registration_disclaimer'] == 2 && $agree_disclaimer != 1) {
$error .= '<li>' . $lang_register_php['err_disclaimer'] . '</li>';
}
// check captcha
if ($CONFIG['registration_captcha'] != 0) {
require "include/captcha.inc.php";
if (!PhpCaptcha::Validate($captcha_confirmation)) {
$error .= '<li>' . $lang_errors['captcha_error'] . '</li>';
}
}
if ($error != '') {
return false;
}
if (!$CONFIG['allow_duplicate_emails_addr']) {
$sql = "SELECT user_id " . "FROM {$CONFIG['TABLE_USERS']} " . "WHERE user_email = '" . addslashes($email) . "'";
$result = cpg_db_query($sql);
if (mysql_num_rows($result)) {
$error = '<li>' . $lang_register_php['err_duplicate_email'] . '</li>';
return false;
}
mysql_free_result($result);
}
if ($CONFIG['reg_requires_valid_email'] || $CONFIG['admin_activation']) {
$active = 'NO';
list($usec, $sec) = explode(' ', microtime());
$seed = (double) $sec + (double) $usec * 100000;
srand($seed);
$act_key = md5(uniqid(rand(), 1));
} else {
$active = 'YES';
$act_key = '';
}
if ($CONFIG['enable_encrypted_passwords']) {
$encpassword = md5($password);
} else {
$encpassword = $password;
}
$sql = "INSERT INTO {$CONFIG['TABLE_USERS']} " . "(user_regdate, user_active, user_actkey, user_name, user_password, user_email, user_profile1, user_profile2, user_profile3, user_profile4, user_profile5, user_profile6) " . "VALUES (NOW(), '{$active}', '{$act_key}', '{$user_name}', '{$encpassword}', '{$email}', '{$profile1}', '{$profile2}', '{$profile3}', '{$profile4}', '{$profile5}', '{$profile6}')";
if ($CONFIG['log_mode']) {
log_write('New user "$user_name" created on ' . date("F j, Y, g:i a"), CPG_ACCESS_LOG);
}
$result = cpg_db_query($sql);
// Create a personal album if corresponding option is enabled
if ($CONFIG['personal_album_on_registration'] == 1) {
print 'sub<br />';
$catid = mysql_insert_id() + FIRST_USER_CAT;
print $catid;
cpg_db_query("INSERT INTO {$CONFIG['TABLE_ALBUMS']} (`title`, `category`) VALUES ('{$user_name}', {$catid})");
//.........这里部分代码省略.........
示例12: build_caption
/**
* build_caption()
*
* @param array $rowset by reference
* @param array $must_have
**/
function build_caption(&$rowset, $must_have = array())
{
global $CONFIG, $THEME_DIR;
global $album_date_fmt, $lastcom_date_fmt, $lastup_date_fmt, $lasthit_date_fmt, $cat;
global $lang_get_pic_data, $lang_meta_album_names, $lang_errors;
foreach ($rowset as $key => $row) {
$caption = '';
if ($CONFIG['display_filename']) {
$caption .= '<span class="thumb_filename">' . $row['filename'] . '</span>';
}
$caption .= $row['title'] ? '<span class="thumb_title">' . $row['title'] . '</span>' : '';
if ($CONFIG['views_in_thumbview'] || in_array('hits', $must_have)) {
$caption .= '<span class="thumb_title">' . sprintf($lang_get_pic_data['n_views'], $row['hits']) . '</span>';
}
if ($CONFIG['caption_in_thumbview']) {
$caption .= $row['caption'] ? "<span class=\"thumb_caption\">" . strip_tags(bb_decode($row['caption'])) . "</span>" : '';
}
if ($CONFIG['display_comment_count']) {
$comments_nr = count_pic_comments($row['pid']);
if ($comments_nr > 0) {
$caption .= "<span class=\"thumb_num_comments\">" . sprintf($lang_get_pic_data['n_comments'], $comments_nr) . "</span>";
}
}
if ($CONFIG['display_uploader']) {
$caption .= $row['owner_id'] && $row['owner_name'] ? '<span class="thumb_title"><a href ="profile.php?uid=' . $row['owner_id'] . '">' . $row['owner_name'] . '</a></span>' : '';
}
if (in_array('msg_date', $must_have)) {
$caption .= '<span class="thumb_caption">' . localised_date($row['msg_date'], $lastcom_date_fmt) . '</span>';
}
if (in_array('msg_body', $must_have)) {
$msg_body = strip_tags(bb_decode($row['msg_body']));
// I didn't want to fully bb_decode the message where report to admin isn't available. -donnoman
$msg_body = utf_strlen($msg_body) > 50 ? utf_substr($msg_body, 0, 50) . '...' : $msg_body;
if ($CONFIG['enable_smilies']) {
$msg_body = process_smilies($msg_body);
}
if ($row['author_id']) {
$caption .= '<span class="thumb_caption"><a href ="profile.php?uid=' . $row['author_id'] . '">' . $row['msg_author'] . '</a>: ' . $msg_body . '</span>';
} else {
$caption .= '<span class="thumb_caption">' . $row['msg_author'] . ': ' . $msg_body . '</span>';
}
}
if (in_array('ctime', $must_have)) {
$caption .= '<span class="thumb_caption">' . localised_date($row['ctime'], $lastup_date_fmt) . '</span>';
}
if (in_array('pic_rating', $must_have)) {
if (defined('THEME_HAS_RATING_GRAPHICS')) {
$prefix = $THEME_DIR;
} else {
$prefix = '';
}
$caption .= "<span class=\"thumb_caption\">" . '<img src="' . $prefix . 'images/rating' . round($row['pic_rating'] / 2000) . '.gif" alt=""/>' . '<br />' . sprintf($lang_get_pic_data['n_votes'], $row['votes']) . '</span>';
}
if (in_array('mtime', $must_have)) {
$caption .= "<span class=\"thumb_caption\">" . localised_date($row['mtime'], $lasthit_date_fmt);
if (GALLERY_ADMIN_MODE) {
$caption .= "<br/>" . $row['lasthit_ip'];
}
$caption .= '</span>';
}
$rowset[$key]['caption_text'] = $caption;
}
$rowset = CPGPluginAPI::filter('thumb_caption', $rowset);
}
示例13: intval
$money = intval($_POST['money']);
$status = check($_POST['status']);
$avatar = check($_POST['avatar']);
$posrating = intval($_POST['posrating']);
$negrating = intval($_POST['negrating']);
if ($uid == $_SESSION['token']) {
$user = DB::run()->queryFetch("SELECT * FROM `users` WHERE `users_login`=? LIMIT 1;", array($uz));
if (!empty($user)) {
if ($log == $config['nickname'] || $log == $user['users_login'] || ($user['users_level'] < 101 || $user['users_level'] > 105)) {
if (empty($pass) || preg_match('|^[a-z0-9\\-]+$|i', $pass)) {
if (preg_match('#^([a-z0-9_\\-\\.])+\\@([a-z0-9_\\-\\.])+(\\.([a-z0-9])+)+$#', $email) || empty($email)) {
if (preg_match('#^http://([а-яa-z0-9_\\-\\.])+(\\.([а-яa-z0-9\\/])+)+$#u', $site) || empty($site)) {
if (preg_match('#^[0-9]{2}+\\.[0-9]{2}+\\.[0-9]{4}$#', $joined)) {
if (preg_match('#^[0-9]{2}+\\.[0-9]{2}+\\.[0-9]{4}$#', $birthday) || empty($birthday)) {
if ($gender == 1 || $gender == 2) {
if (utf_strlen($info) <= 1000) {
if ($log == $config['nickname']) {
$access = $level;
} else {
$access = $user['users_level'];
}
if (!empty($pass)) {
echo '<b><span style="color:#ff0000">Внимание! Вы изменили пароль пользователя!</span></b><br />';
echo 'Не забудьте ему напомнить его новый пароль: <b>' . $pass . '</b><br /><br />';
$mdpass = md5(md5($pass));
} else {
$mdpass = $user['users_pass'];
}
list($uday, $umonth, $uyear) = explode(".", $joined);
$joined = mktime('0', '0', '0', $umonth, $uday, $uyear);
$name = utf_substr($name, 0, 20);
示例14: abs
############################################################################################
############################################################################################
## Изменение ссылки ##
############################################################################################
case 'change':
if (isset($_GET['id'])) {
$id = abs(intval($_GET['id']));
} else {
$id = 0;
}
$uid = check($_GET['uid']);
$link = check(utf_lower($_POST['link']));
$name = check($_POST['name']);
if ($uid == $_SESSION['token']) {
if (utf_strlen($link) >= 10 && utf_strlen($link) <= 50) {
if (utf_strlen($name) >= 5 && utf_strlen($name) <= 25) {
if (preg_match('#^http://([а-яa-z0-9_\\-\\.])+(\\.([а-яa-z0-9\\/])+)+$#u', $link)) {
$querypyr = DB::run()->querySingle("SELECT `pyramid_id` FROM `pyramid` WHERE `pyramid_id`=? LIMIT 1;", array($id));
if (!empty($querypyr)) {
DB::run()->query("UPDATE `pyramid` SET `pyramid_link`=?, `pyramid_name`=? WHERE`pyramid_id`=?;", array($link, $name, $id));
$_SESSION['note'] = 'Рекламная ссылка успешно изменена!';
redirect("pyramid.php");
} else {
show_error('Ошибка! Данной ссылки нет в списке!');
}
} else {
show_error('Ошибка! Недопустимый адрес сайта! (http://sitename.domen)!');
}
} else {
show_error('Ошибка! Слишком длинное или короткое название. Не менее 5 и не более 25 символов!');
}
示例15: file
if (file_exists(DATADIR . "dataforum/mainforum.dat")) {
$fileforum = file(DATADIR . "dataforum/mainforum.dat");
$total = count($fileforum);
if ($total > 0) {
foreach ($fileforum as $forumval) {
$forum = explode("|", $forumval);
echo '<div class="b"><img src="/images/img/forums.gif" alt="image" /> ';
echo '<b><a href="forum.php?fid=' . $forum[0] . '&' . SID . '">' . $forum[1] . '</a></b> (' . $forum[2] . '/' . $forum[3] . ')</div>';
$totalforum = counter_string(DATADIR . "dataforum/topic" . $forum[0] . ".dat");
if ($totalforum > 0) {
$filetopic = file(DATADIR . "dataforum/topic" . $forum[0] . ".dat");
$topic = explode("|", end($filetopic));
if (file_exists(DATADIR . 'dataforum/' . $forum[0] . '-' . $topic[0] . '.dat')) {
$filepost = file(DATADIR . 'dataforum/' . $forum[0] . '-' . $topic[0] . '.dat');
$post = explode("|", end($filepost));
if (utf_strlen($topic[3]) > 35) {
$topic[3] = utf_substr($topic[3], 0, 30);
$topic[3] .= "...";
}
echo '<div>Тема: <a href="topic.php?act=end&fid=' . $forum[0] . '&id=' . $topic[0] . '&' . SID . '">' . $topic[3] . '</a><br />';
echo 'Сообщение: ' . nickname($post[2]) . ' (' . date_fixed($post[6]) . ')</div>';
} else {
echo 'Последняя тема не найдена!';
}
} else {
echo 'Раздел пустой! Темы еще не созданы!';
}
}
echo '<br />Всего разделов: <b>' . $total . '</b><br /><br />';
} else {
show_error('Форум пустой! Разделы еще не созданы!');