9, July 2008

Restrict pass char - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Access_user Class (Moderator: Olaf)
Topic: Restrict pass char
« previous next »
Pages: [1] Print

Author Topic: Restrict pass char  (Read 863 times)
Where are my glasses?
*
Posts: 22
176 credits
Members referred : 0



« on: Jul 09, 2006, 10:16:42 PM »

I'm interested in restricting the password chars (to alpha-numeric, no "special" char), and maybe increase the min length to 6. Where in the class should I be looking?
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6274
38470 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: Jul 10, 2006, 09:26:33 AM »

Hello,

modifying a open source class is not useful because you have to add your custom modifications to later updates too.

just try to add this regex test into you php code (or write some class extension):

Code:
<?php 
if (preg_match("/[a-z0-9]{6,}/i"$password) {
  
// do something
} else {
  echo 
"bad password";
}



Last blog : 4th of July Lottery from TemplateMonster.com
Where are my glasses?
*
Posts: 22
176 credits
Members referred : 0



« Reply #2 on: Jul 15, 2006, 08:53:30 AM »

I did find the place in the class, I don't know how I missed it when I first looked. It occures to me that password restrictions might be something many people might want, maybe a list of spacific char that are "bad" that could be specified as an array in the configureation. Some characters have no place in passwords, and lend themselves to SQL injection...
Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6274
38470 credits
Members referred : 374


It's time to use PHP5!


« Reply #3 on: Jul 15, 2006, 09:14:08 AM »

I did find the place in the class, I don't know how I missed it when I first looked. It occures to me that password restrictions might be something many people might want, maybe a list of spacific char that are "bad" that could be specified as an array in the configureation. Some characters have no place in passwords, and lend themselves to SQL injection...
I don't think so, I use often passwords with not alphanumerical characters because these passwords are more safe.

An injection is impossible because the password is saved in MD5 encoding, all posted values are prepared to get sql injections, check this function:

Code:
<?php
function 
ins_string($value) {
if (preg_match("/^(.*)(##)(int|date|eu_date)$/"$value$parts)) {
$value $parts[1];
$type $parts[3];
} else {
$type "";
}
$value = (!get_magic_quotes_gpc()) ? addslashes($value) : $value;
switch ($type) {
case "int":
$value = ($value != "") ? intval($value) : NULL;
break;
case "eu_date":
$date_parts preg_split ("/[\-\/\.]/"$value); 
$time mktime(000$date_parts[1], $date_parts[0], $date_parts[2]);
$value strftime("'%Y-%m-%d'"$time);
break;
case "date":
$value "'".preg_replace("/[\-\/\.]/""-"$value)."'";
break;
default:
$value = ($value != "") ? "'" $value "'" "''";
}
return $value;
}



Last blog : 4th of July Lottery from TemplateMonster.com
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=3206
Tags : php open source Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  Web Development  >  PhP  >  PHP classes @finalwebsites.com  >  Access_user Class (Moderator: Olaf)
Topic: Restrict pass char
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Jul 09, 2008, 12:29:51 PM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 35.588
Total Topics: 7.355
Total Members: 3.661
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: komrad

28 Guests, 4 Users online :

17 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.