passwords - PasswordHash not working php CI -


I have followed the tutorial, but when I enter the password

  M @ Ndiri %% 321 and M @ ndiri %% 654   

At any rate my password has been reversed. If there is a problem in regex?

How to fix ?? Thanks

According to the regex shown above, you should not be anything except alphanumeric characters, but like That you can see, you have some special characters in your password string :)

The above expression can be written as / ([a-zA-Z0-9] +) / If you want to add special characters such as / ([[: alnum:] +]) / g

then / ([- ~] +) Use / g . This will allow you to use (English) alphanumeric and special characters.

Or if you want to allow alphabetical and only special characters described below, then / ([a-zA-Z0-9% @ # $] +) / g Use your comments.

How to use the above pattern with PHP

  $ password = "aH8J9% 3 $%"; If (! Preg_match ("/ ^ ([a-zA-Z0-9% @ # $] +) $ /", $ password) {echo "invalid password!";}   

How to use it with Javascript

  var pattern = / ^ ([a-zA-Z0- 9% @ # $] +) $ / g; var password = document.getElementById ( "Password"). Value; // aH8J9% 3 $% if (! Pattern.test (password)) {warning ("invalid password!");}    

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -