PHP foreground code implementation to get the user password function

Source: Internet
Author: User
For example, user login-Enter the personal homepage
When entering the personal home page, verify that the user password is all digital or full English

Access to personal homepage tips
Pop out of the layer content:
The system detects your account password is too simple, there are serious security risks, it is recommended that you modify in time, so as not to cause the recording is mistakenly deleted and other unnecessary trouble and loss.
Two x buttons <修改> <以后再说>

User jquery or PHP can be implemented in some way?


Reply to discussion (solution)

With Ajax can be implemented, Document.ready can send the user into the background query, and then passed back to judge just

Now that you've verified the login, of course, the user entered the password before verifying it. So you can match the password with the "whether it's too simple" rule you've made, if it's too simple.

Now that you've verified the login, of course, the user entered the password before verifying it. So you can match the password with the "whether it's too simple" rule you've made, if it's too simple.

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


Now that you've verified the login, of course, the user entered the password before verifying it. So you can match the password with the "whether it's too simple" rule you've made, if it's too simple.

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

Hentai!!!!

With Ajax can be implemented, Document.ready can send the user into the background query, and then passed back to judge just
--------
Prawn code paste it out! Novice for advice!



Now that you've verified the login, of course, the user entered the password before verifying it. So you can match the password with the "whether it's too simple" rule you've made, if it's too simple.

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

Hentai!!!!







Prawn code paste it out!

Braised boil the code that you verify the login to change it.

Case "Login"://Login
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

Braised boil the code that you verify the login to change it.





Shrimp, please.

Braised boil the code that you verify the login to change it.

http://www.kudystudio.com/jbox/jbox-demo.html Fade Box User Jbox

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

Case "Login"://Login 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) {//    follow the rules you set      up//write code hints here: Your password is simpler to modify//     or encapsulate these methods in user- >userlogin () inside call}break;

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

Case "Login"://Login 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) {//    follow the rules you set      up//write code hints here: Your password is simpler to modify//     or encapsulate these methods in user- >userlogin () inside call}break;


Similar to PHP validation can add JS code to verify the password full number or full English letters to prompt password past simple?

That's right

This rule you can refer to the other site settings

For example, not all numbers must be more than 8 digits in length, and so on. The more complex the password is, the more "secure" it is to reduce the likelihood of user registration (the user is a little bit troublesome and may abandon registration)

Can be used at the time of registration with JS to determine the same as you say the login is determined by PHP


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;
}
JS I know some, but how to put in PHP that what code inside? Prawn help code to paste out

In the case of PHP regular is not sure of such a tall man.

In the case of PHP regular is not sure of such a tall man.
Master prawn come quickly!

Want to use the regular one to match your needs ... Failed to succeed. Let's just write it apart.

$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{  //Hint code}


In addition, I look at the landlord title is required foreground code but you need to describe the login prompt so it is best to use PHP to prompt

Want to use the regular one to match your needs ... Failed to succeed. Let's just write it apart.

$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{  //Hint code}


In addition, I look at the landlord title is required foreground code but you need to describe the login prompt so it is best to use PHP to prompt
----------------------------------------------------
But thank you very much ha, I have solved myself! The points are also to be given.

What's the deal? Let's share the solution.

What's the deal? Let's share the solution.
---------------------------------------------------------
Well

1: I use jquery to get a cookie
2: Write a function from the beginning verify the PWD and return a parameter 1 & 0 incoming Cooike
3: Page receive cooike a state to Judge 1 Show box 0 do not show box
4: will appear to change a page in this prompt, the solution after the page prompts, the cooike empty, then the implementation only user prompt!

  • Related Article

    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.