14 Replies - 342 Views - Last Post: 30 January 2018 - 10:22 AM Rate Topic: -----

#1 priya05   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 29-January 18

The Password not in the sequence of the numeric like 1234 in php

Posted 29 January 2018 - 03:13 AM

The Password not in the sequence of the numeric like 1234, it will be like 135974. Sequence number is not allowed in Password in PHP. Any one having any ideas?
Is This A Good Question/Topic? 0
  • +

Replies To: The Password not in the sequence of the numeric like 1234 in php

#2 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4212
  • View blog
  • Posts: 13,303
  • Joined: 08-June 10

Re: The Password not in the sequence of the numeric like 1234 in php

Posted 29 January 2018 - 03:15 AM

Quote

Any one having any ideas?

about what? your sentences do not make any sense.

This post has been edited by Dormilich: 29 January 2018 - 03:16 AM

Was This Post Helpful? 0
  • +
  • -

#3 priya05   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 29-January 18

Re: The Password not in the sequence of the numeric like 1234 in php

Posted 29 January 2018 - 03:18 AM

The Password not in the sequence of the numeric like 1234, it will be like 135974. Sequence number is not allowed in Password in PHP. Any one having any ideas?

This post has been edited by Dormilich: 29 January 2018 - 03:19 AM

Was This Post Helpful? 0
  • +
  • -

#4 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4212
  • View blog
  • Posts: 13,303
  • Joined: 08-June 10

Re: The Password not in the sequence of the numeric like 1234 in php

Posted 29 January 2018 - 03:19 AM

just repeating it does not make it clearer.
Was This Post Helpful? 0
  • +
  • -

#5 priya05   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 29-January 18

Re: The Password not in the sequence of the numeric like 1234 in php

Posted 29 January 2018 - 03:27 AM

Actually while typing your password in Register Form, I have to validate the password.

1. Minimum 1 Uppercase
2. Minimum 1 Lowercase
3. Minimum 1 Number
4. Minimum 1 Special Cahracter
5. The password is not in sequence form.


Example : Password is => [email protected] is not correct, because 5th point is not suit to this password.

Password must be like "[email protected]" continuous numeric value is need not to come.

I did the first four points, the fifth point is need to do. I don't have any idea. Kindly reply me if you have any ideas.
Was This Post Helpful? 0
  • +
  • -

#6 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4212
  • View blog
  • Posts: 13,303
  • Joined: 08-June 10

Re: The Password not in the sequence of the numeric like 1234 in php

Posted 29 January 2018 - 03:29 AM

you would have to extract the number and write a separate validation for it.

example strategy:
- get number
- get next number
- compare first number + 1 with second number
- bail out if they are equal
Was This Post Helpful? 0
  • +
  • -

#7 priya05   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 29-January 18

Re: The Password not in the sequence of the numeric like 1234 in php

Posted 29 January 2018 - 03:34 AM

View PostDormilich, on 29 January 2018 - 03:29 AM, said:

you would have to extract the number and write a separate validation for it.

example strategy:
- get number
- get next number
- compare first number + 1 with second number
- bail out if they are equal



I'm new to PHP, I don't have any idea to start the code, I did the below one, but it's not working


else if (preg_match("#(\d{2,})#u", $password)) {
echo "Sequence Number is not allowed";
return;
}

if(preg_match("/[A-Z]/", $password)==0){
drupal_set_message(t('Password must have minimum 1 upper case'));
return;
}

if(preg_match("/[a-z]/", $password)==0){
drupal_set_message(t('Password must have minimum 1 lower case'));
return;
}


if(preg_match("/[0-9]/", $password)==0){
drupal_set_message(t('Password must have minimum 1 numeric value'));
return;
}

if(preg_match('/[\W]/', $password)==0){
drupal_set_message(t('Password must have minimum 1 special character'));
return;
}


I did up-to this
Was This Post Helpful? 0
  • +
  • -

#8 priya05   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 29-January 18

Re: The Password not in the sequence of the numeric like 1234 in php

Posted 29 January 2018 - 03:42 AM

View PostDormilich, on 29 January 2018 - 03:29 AM, said:

you would have to extract the number and write a separate validation for it.

example strategy:
- get number
- get next number
- compare first number + 1 with second number
- bail out if they are equal



Will you help me to start the code in procedure?
Was This Post Helpful? 0
  • +
  • -

#9 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4212
  • View blog
  • Posts: 13,303
  • Joined: 08-June 10

Re: The Password not in the sequence of the numeric like 1234 in php

Posted 29 January 2018 - 04:59 AM

first thing is to extract the number:

preg_match_all('~\d+~', $password, $match);
$numbers = $match[0];


This post has been edited by Dormilich: 30 January 2018 - 01:15 AM
Reason for edit:: fixed variable name

Was This Post Helpful? 0
  • +
  • -

#10 priya05   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 29-January 18

Re: The Password not in the sequence of the numeric like 1234 in php

Posted 29 January 2018 - 05:14 AM

then i have to use for loop?

This post has been edited by Dormilich: 29 January 2018 - 06:40 AM

Was This Post Helpful? 0
  • +
  • -

#11 Dormilich   User is offline

  • 痛覚残留
  • member icon

Reputation: 4212
  • View blog
  • Posts: 13,303
  • Joined: 08-June 10

Re: The Password not in the sequence of the numeric like 1234 in php

Posted 29 January 2018 - 06:41 AM

I'd prefer foreach or one of the array functions.
Was This Post Helpful? 0
  • +
  • -

#12 ArtificialSoldier   User is offline

  • D.I.C Lover
  • member icon

Reputation: 2059
  • View blog
  • Posts: 6,306
  • Joined: 15-January 14

Re: The Password not in the sequence of the numeric like 1234 in php

Posted 29 January 2018 - 10:32 AM

You need to figure out the minimum size for a sequence. If you're going to not allow any sequential 3 digits, or 4 digits, or whatever the minimum sequence size is, then you need to figure that out first. Then you use a regular expression similar to above to extract everything that size and test each one for sequence. If you also want to test for sequences of letters it's a similar process, because you can convert each letter to a number and then check those numbers.
Was This Post Helpful? 0
  • +
  • -

#13 CTphpnwb   User is online

  • D.I.C Lover
  • member icon

Reputation: 3798
  • View blog
  • Posts: 13,755
  • Joined: 08-August 08

Re: The Password not in the sequence of the numeric like 1234 in php

Posted 29 January 2018 - 06:50 PM

What about Abcdef!? Is that a valid password or does it violate the sequence rule?
Was This Post Helpful? 0
  • +
  • -

#14 priya05   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 27
  • Joined: 29-January 18

Re: The Password not in the sequence of the numeric like 1234 in php

Posted 29 January 2018 - 09:48 PM

View PostArtificialSoldier, on 29 January 2018 - 10:32 AM, said:

You need to figure out the minimum size for a sequence. If you're going to not allow any sequential 3 digits, or 4 digits, or whatever the minimum sequence size is, then you need to figure that out first. Then you use a regular expression similar to above to extract everything that size and test each one for sequence. If you also want to test for sequences of letters it's a similar process, because you can convert each letter to a number and then check those numbers.


Do you have any example coding related to that?
Was This Post Helpful? 0
  • +
  • -

#15 ArtificialSoldier   User is offline

  • D.I.C Lover
  • member icon

Reputation: 2059
  • View blog
  • Posts: 6,306
  • Joined: 15-January 14

Re: The Password not in the sequence of the numeric like 1234 in php

Posted 30 January 2018 - 10:22 AM

No I do not. There is not code for figuring out the minimum size of a sequence, that should come from your brain. Then you need a regular expression to extract character sequences of that size, much of which was already posted, and then a loop of a couple lines to go through each match and check if it's a sequence.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1