Password must be more than 3 char legth

This is a discussion on "Password must be more than 3 char legth" within the PHP Forum section. This forum, and the thread "Password must be more than 3 char legth are both part of the Program Your Website category.


 Subscribe in a reader

Go Back   Webforumz.com > Main Forums > Program Your Website > PHP Forum

Notices




Reply
 
LinkBack Thread Tools
  #1  
Old Apr 16th, 2007, 05:21
Up'n'Coming Member
Join Date: Jul 2006
Location: manila
Age: 28
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Password must be more than 3 char legth

hello guys need help, can give me example to check if password must be more than 5 char length


thanks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote

  #2  
Old Apr 16th, 2007, 08:11
Reputable Member
Join Date: May 2006
Location: Northampton, UK
Posts: 399
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Password must be more than 3 char legth

Use strlen();

Code: Select all
  <?php
$str = 'abcdef';
echo strlen($str); // 6

$str = ' ab cd ';
echo strlen($str); // 7
?>
The php manual is located here ... its great.... just dont try and print it off like i did..... i gave up after my printer tray was refilled for the 3rd time.


Edit..... i didnt really try and print it off... sheesh... do i look dumb :P
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3  
Old May 2nd, 2007, 04:17
Up'n'Coming Member
Join Date: Jul 2006
Location: manila
Age: 28
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Password must be more than 3 char legth

hello

can anybody give me another sample script on password must be more than 3 char.. im struggling here... plss
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4  
Old May 2nd, 2007, 08:15
Reputable Member
Join Date: May 2006
Location: Northampton, UK
Posts: 399
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Password must be more than 3 char legth

Code: Select all
<?php
$str = 'abcdef';
echo strlen($str); // 6

$str = ' ab cd ';
echo strlen($str); // 7
?>
The above is all you need..... or do you want me to write the entire script for you?

Let me talk you through the logic.... strlen() returns a numerical value equal to the length of the string passed into it

so.... pass your password into strlen() then use an if else statement to check it is more than 3 chars in length ....

Does that make things clearer?



edit:

just o make things really simple (and cos im a nice person )

Code: Select all
<?php
$pass = $_POST['pass'];

$pass_len = strlen($pass);

if ($pass_len < 3) {
echo "YOUR PASSWORD MUST BE LONGER THAN 3 CHARS!!";
}
else {
echo "Thankyou, your password has been accepted";
}
?>
Thats about as simple as i can make it..... basically all you need to do is change the echo statements to whatever procedural code you want in each outcoe and your done.

But seriously.... go and browse the php documentation... its a life saver

Last edited by Accurax; May 2nd, 2007 at 08:22.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5  
Old May 2nd, 2007, 09:33
Up'n'Coming Member
Join Date: Jul 2006
Location: manila
Age: 28
Posts: 61
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Password must be more than 3 char legth

hello

thank very much for the response it really helps me, now its clear for me mr. nice guy accurax
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6  
Old May 2nd, 2007, 10:57
Reputable Member
Join Date: May 2006
Location: Northampton, UK
Posts: 399
Thanks: 0
Thanked 0 Times in 0 Posts
Re: Password must be more than 3 char legth

my pleasure
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
password 3 char

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Forgot password and Change password PHP script Chono PHP Forum 4 May 16th, 2008 09:13
need help with password VanHype JavaScript Forum 2 May 24th, 2007 12:05
Limitation of 255 char? Monie Databases 1 Oct 15th, 2004 02:14
search a text FILE BY FIRST CHAR OF WORD gurbaksh Flash & Multimedia Forum 5 Aug 22nd, 2003 15:51


All times are GMT. The time now is 15:59.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42