Jump to content

Regex to ban password containing userid


oracle259

Recommended Posts

ok i read up on preg_match but the php manual recommends using strpos as it is faster. So let me know if this code would surffice:

<?php
$password = 'p.oracle259-ender';
$userid  = 'oracle259';
$inpass = strpos($password, $userid);

if ($incheck === true) {
  echo "Error: Sorry password cannot contain your set userid'";
} else {
  encrypt password
  make password DB safe
  insert password into DB
}

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.