PHP front-end code to obtain user passwords

Source: Internet
Author: User
PHP front-end code to obtain user passwords, such as user logon --> enter the personal homepage
When you enter the personal homepage, verify that all or all of the logon user passwords are in English.

Personal homepage prompt
The pop-up layer content:
The system detects that your account password is too simple and has serious security risks. we recommend that you modify the password in time to avoid unnecessary troubles and losses such as accidental deletion of recordings.
Two buttons <修改> <以后再说>

Can jquery or PHP be implemented in some way?


Reply to discussion (solution)

Ajax can be used for implementation. in document. ready, you can upload the user to the background for query, and then upload the user back for judgment.

Since you have verified the logon, of course, you have obtained the user-entered password before verification. so you can use this password to match the rule "is too simple". if it is too simple prompt.

Since you have verified the logon, of course, you have obtained the user-entered password before verification. so you can use this password to match the rule "is too simple". if it is too simple prompt.

Every time I see you, it's like shining your clothes .....


Since you have verified the logon, of course, you have obtained the user-entered password before verification. so you can use this password to match the rule "is too simple". if it is too simple prompt.

Every time I see you, it's like shining your clothes .....

Hentai !!!!

Ajax can be used for implementation. in document. ready, you can upload the user to the background for query, and then upload the user back for judgment.
--------
Paste the prawn code! Beginner's advice!



Since you have verified the logon, of course, you have obtained the user-entered password before verification. so you can use this password to match the rule "is too simple". if it is too simple prompt.

Every time I see you, it's like shining your clothes .....

Hentai !!!!







Paste the prawn code!

You can modify the authentication and login code.

Case "login": // log on
If (! Isset ($ _ SESSION) {session_start ();}
$ UserName = trim ($ Tools-> Request ("un "));
$ Password = trim ($ Tools-> Request ("pw "));
$ BackUrl = trim ($ Tools-> Request ("u "));
$ CheckCode = trim ($ Tools-> Request ("cc "));
$ User-> UserLogin ($ UserName, $ Password, $ CheckCode, $ BackUrl );
Break;

You can modify the authentication and login code.





Thank you!

You can modify the authentication and login code.

Http://www.kudystudio.com/jbox/jbox-demo.html fade-out box user jbox

Now, suppose you set the rule to "a password with a length less than 8 is a weak password ",

Case "login": // log on if (! Isset ($ _ SESSION) {session_start () ;}$ UserName = trim ($ Tools-> Request ("un ")); $ Password = trim ($ Tools-> Request ("pw"); $ BackUrl = trim ($ Tools-> Request ("u ")); $ CheckCode = trim ($ Tools-> Request ("cc"); $ User-> UserLogin ($ UserName, $ Password, $ CheckCode, $ BackUrl ); if (strlen ($ Password) <8) {// match according to your rules // write code here: you need to modify the password easily // or encapsulate these methods in User-> UserLogin () to call} break;

Now, suppose you set the rule to "a password with a length less than 8 is a weak password ",

Case "login": // log on if (! Isset ($ _ SESSION) {session_start () ;}$ UserName = trim ($ Tools-> Request ("un ")); $ Password = trim ($ Tools-> Request ("pw"); $ BackUrl = trim ($ Tools-> Request ("u ")); $ CheckCode = trim ($ Tools-> Request ("cc"); $ User-> UserLogin ($ UserName, $ Password, $ CheckCode, $ BackUrl ); if (strlen ($ Password) <8) {// match according to your rules // write code here: you need to modify the password easily // or encapsulate these methods in User-> UserLogin () to call} break;


Similar to PHP verification, can I add JavaScript code to verify that the password is full of numbers or letters, prompting the password to be simple in the past?

Right

For more information about this rule, see settings for other websites.

For example, the length cannot start with a number and must be greater than 8 digits. you must weigh the complexity of the password by yourself, the more "secure" the more likely it is to reduce the possibility of user registration (users may give up registration if they have a little trouble)

It can be determined by PHP when you log on as you said during registration.


Prawn code!



Var num = 0;

If (Password. search (/[A-Z]/)! =-1 ){
Num + = 1;
}

If (Password. search (/[0-9]/)! =-1 ){
Num + = 1;
}

If (Password. search (/[a-z]/)! =-1 ){
Num + = 1;
}

If (Password. search (/[^ A-Za-z0-9]/)! =-1 ){
Num + = 1;
}

If (num> = 2 & (Password. length> = 6 & Password. length <= 16 )){
Return true;
} Else {
Return false;
}
I know something about js, but how can I put it into the code of PHP? Paste the code

The regular expression in PHP cannot be used.

The regular expression in PHP cannot be used.
Come on!

If you want to use the regular expression to match your requirements, you can write them separately.

$ Password = "assssssss"; $ num = 0; if (preg_match ("/[A-Z]/", $ Password) {$ num ++ ;} if (preg_match ("/[0-9]/", $ Password) {$ num ++;} if (preg_match ("/[a-z]/", $ Password) {$ num ++ ;}if (preg_match ("/[^ A-Za-z0-9]/", $ Password) {$ num ++ ;} if ($ num> = 2 & strlen ($ Password)> = 6 & strlen ($ Password) <= 16) {//} else {// prompt code}


In addition, I think the title of the landlord requires front-end code, but you need to describe it as prompted after logging on, so it is best to use PHP to prompt

If you want to use the regular expression to match your requirements, you can write them separately.

$ Password = "assssssss"; $ num = 0; if (preg_match ("/[A-Z]/", $ Password) {$ num ++ ;} if (preg_match ("/[0-9]/", $ Password) {$ num ++;} if (preg_match ("/[a-z]/", $ Password) {$ num ++ ;}if (preg_match ("/[^ A-Za-z0-9]/", $ Password) {$ num ++ ;} if ($ num> = 2 & strlen ($ Password)> = 6 & strlen ($ Password) <= 16) {//} else {// prompt code}


In addition, I think the title of the landlord requires front-end code, but you need to describe it as prompted after logging on, so it is best to use PHP to prompt
----------------------------------------------------
But thank you! I have solved it myself! The score is also required.

How can this problem be solved? Share the solution

How can this problem be solved? Share the solution
---------------------------------------------------------
Well

1: I used jquery to obtain the cookie.
2: Start to verify Pwd by writing a new function, and return a parameter 1 & 0 to pass in cooike.
3: The page receives a cooike status to determine 1. the display box 0 is not displayed.
4: a new page is displayed, and the prompt is displayed here. after the prompt is displayed, the cooike is cleared, and only one prompt is displayed!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.