password alphanumeric php without use regex -


i try this.

for($i=0;$i<$length;i++) {     if(!ctype_alpha($password[$i])     {         header("location:regist.php?err=password not contain letter");      }     else if(!is_numeric($password[$i]))     {         header("location:regist.php?err=password not contain  numbers");     }     else     {         //??     } } 

how validate password if password must alphanumeric without using regular expression ?

i think looking ctype_alnum check- http://www.php.net/manual/en/function.ctype-alnum.php

update-

you can check special characters in string like-

<?php $test = "password123";  $special_char = "#$%^&*()+=-[]';,./{}|:<>?~";  if (false === strpbrk($test, $special_char)) {      echo "good password"; } ?> 

Comments

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -