View previous topic :: View next topic |
Author |
Message |
olly86 -
Joined: 25 Apr 2003 Posts: 993 Location: Wiltshire, UK
|
Posted: Sun Sep 26, 2004 4:20 pm Post subject: length validation error |
|
|
the following elseif statement is triggered for any combination of letters, and will only work if more than 1 number is entered:
Code: | elseif ($_POST['password'] <5) {
$_SESSION['error']='your password is too short. Please try again!';
header("Location: account.php?action=register&process=password");
} |
I need this if statement to be triggered only if the $_POST['password'] variable contains less than 5 characters.
thanks in advance _________________ Olly |
|
Back to top |
|
 |
k1ll3rdr4g0n -
Joined: 04 Jul 2004 Posts: 609
|
Posted: Sun Sep 26, 2004 4:56 pm Post subject: |
|
|
Oh man thats mind boggling... woudlnt it be something like
Code: |
elseif ($_POST['password'] <5 [b]char[/b]) {
$_SESSION['error']='your password is too short. Please try again!';
header("Location: account.php?action=register&process=password");
}
| [/b] _________________
 |
|
Back to top |
|
 |
TRUSTAbyss -
Joined: 29 Oct 2003 Posts: 3752 Location: USA, GA
|
Posted: Sun Sep 26, 2004 8:24 pm Post subject: |
|
|
I think you setup your ifelse wrong , try this example here.
Code: |
<?php
if ($_POST['password'] < 5) {
$_SESSION['error']='your password is too short. Please try again!';
}else{
header("Location: account.php?action=register&process=password");
}
?>
|
|
|
Back to top |
|
 |
olly86 -
Joined: 25 Apr 2003 Posts: 993 Location: Wiltshire, UK
|
Posted: Sun Sep 26, 2004 8:44 pm Post subject: |
|
|
thanks for all the advice, but this is what I've found that works instead:
Code: | elseif (strlen($_POST['password']) <5) {
$_SESSION['error']='your password is too short. Please try again!';
header("Location: account.php?action=register&process=password");
} |
_________________ Olly |
|
Back to top |
|
 |
|