Jump to content

Recommended Posts

I am making a register script and I am trying to give an error for passwords that are not recommended, such as "password" or the password being the same as the username. Something like this..

 

if ($newpass == "password")

 

But the problem with this is, the user might enter "paSSwOrd" and the condition will say they do not equal, so what can I do so the capitals the user inputs does not matter.

 

Sorry if you do not understand, I find it hard to explain.

 

Thanks

Link to comment
https://forums.phpfreaks.com/topic/207367-capitals/
Share on other sites

Although your question has been answered, here's a small tip:

 

To be more efficient, use single quotes in the password variable (e.g. strtolower($newpass) == 'password'). This will not make PHP search for special characters (such as \n) or variables in the string and thus use less memory.

Link to comment
https://forums.phpfreaks.com/topic/207367-capitals/#findComment-1084193
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.