Добрый день!
Помогите пожалуйста с регулярным выражением на php ( функция preg_match() ) для пароля.
Цитата |
Пароль должен содержать от 6 до 20 символов. Можно использовать латинские буквы, цифры и символы из списка: ! @ # $ % ^ & * ( ) _ - + : ; , . |
if(!preg_match('#[A-z!@\#$%^&*\(\)_\-\+:;,\.]{6,20}#',$text){
echo "you bad man";
}
else{
echo "Yep!";
}
Цитата (tanaevser @ 28.03.2011 - 19:18) |
Спасибо! Не пробовал, но в сайт воткнул =) |
Цитата (tanaevser @ 28.03.2011 - 21:46) |
Нельзя сразу вводить и цифры и заглавные и маленькие буквы. Нужно убирать либо заглавные, либо цифры... |
if(!preg_match("#[A-z!@\#$%^&*\(\)_\-\+:;,\.0-9]{6,20}#",$text))
{
echo "you bad man";
}
else
{
echo "Yep!";
}
Цитата (twin @ 28.03.2011 - 13:29) |
А зачем это, можно полюбопытствовать? |
Цитата |
Пароль должен содержать ... |
Цитата |
P.S. Это нужно для стандарта. Все крупные сайты используют иммено такой набор допустимых символов (Яндекс, Вконтакте, Фейсбук, Одноклассники, Майл, Гугл и т.п.). |
Как выбрать пароль
Пароль должен содержать от 6 до 20 символов. Можно использовать латинские буквы, цифры и символы из списка:
! @ # $ % ^ & * ( ) _ - + : ; , .
Цитата |
Это сделано из-за соображений безопасности и "антимусорства", так как пароль < 6 символов - не пароль |
Цитата |
так как пароль < 6 символов - не пароль |
@charset "UTF-8";
/* SpryValidationPassword.css - version 0.1 - Spry Pre-Release 1.6.1 */
/* Copyright © 2006. Adobe Systems Incorporated. All rights reserved. */
/* These are the classes applied on the error messages
* which prevent them from being displayed by default.
*/
.passwordRequiredMsg,
.passwordInvalidStrengthMsg,
.passwordMinCharsMsg,
.passwordMaxCharsMsg,
.passwordCustomMsg,
.passwordValidMsg {
display: none;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color:#F00;
}
/* These selectors change the way messages look when the widget is in one of the error states.
* These classes set a default red border and color for the error text.
* The state class (e.g. .passwordRequiredState) is applied on the top-level container for the widget,
* and this way only the specific error message can be shown by setting the display property to "inline".
*/
.passwordRequiredState .passwordRequiredMsg,
.passwordMinCharsState .passwordMinCharsMsg,
.passwordMaxCharsState .passwordMaxCharsMsg,
.passwordInvalidStrengthState .passwordInvalidStrengthMsg,
.passwordCustomState .passwordCustomMsg
{
display: inline;
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
color:#F00;
}
/* The next three group selectors control the way the core element (INPUT) looks like when the widget is in one of the states: * focus, required / invalid Strength / minValue / maxValue / custom invalid , valid
* There are two selectors for each state, to cover the two main usecases for the widget:
* - the widget id is placed on the top level container for the INPUT
* - the widget id is placed on the INPUT element itself (there are no error messages)
*/
/* When the widget is in the valid state the INPUT has a green background applied on it. */
.passwordValidState input, input.passwordValidState {
background-color: #B8F5B1;
}
/* When the widget is in an invalid state the INPUT has a red background applied on it. */
input.passwordRequiredState, .passwordRequiredState input,
input.passwordInvalidStrengthState, .passwordInvalidStrengthState input,
input.passwordMinCharsState, .passwordMinCharsState input,
input.passwordCustomState, .passwordCustomState input,
input.passwordMaxCharsState, .passwordMaxCharsState input {
background-color: #FF9F9F;
}
/* When the widget has received focus, the INPUT has a yellow background applied on it. */
.passwordFocusState input, input.passwordFocusState {
background-color: #FFFFCC;
}
! |
kirik |
Цитата (MaximGQ @ 5.04.2011 - 01:30) |
попробуй с JS Spry |
Цитата (MaximGQ @ 5.04.2011 - 01:42) |
сообщение выходит при неправильном заполнении |
Цитата (MaximGQ @ 5.04.2011 - 06:36) |
тут был я и скрыл этот ужас |
Цитата (MaximGQ @ 5.04.2011 - 02:05) |
А почему кстати загрузка CSS файлов не поддержана? А? |