Password depending on day

Status
Not open for further replies.

Malmoc

New Member
Dec 31, 2011
8
1
Hey.

I was thinking if it were to be possible to make a login system where the password changes daily (preset).
As an example: Malmoc <-- Username
Password:
Monday: hey123
Tuesday: iliketrains
Wendsday: haddaway
-And so forth, until the end of the week.

Any ideas on how to do this?

- Malmoc
 

Beast

Posting Freak
Sep 15, 2011
625
163
What would be the point of randomizing a password though?

@OP
What you could do is have an array of passwords, and then for each new day, just select a random one.

So no one changes the pass and it automatically resets to avoid this. This is just a guess I do not know what this kid is going to use this for lol.
 

Adil

DevBest CEO
May 28, 2011
1,276
714
So no one changes the pass and it automatically resets to avoid this. This is just a guess I do not know what this kid is going to use this for lol.
You could eliminate resetting/editing the password completely by not allowing the user to do such things. :p
 

Weasel

👄 I'd intercept me
Nov 25, 2011
4,132
2,456
7 diffrent passwords rows.

PHP:
$currentday = date('l');
 
if($currentday == 'Monday'){
// code to get the password from password row monday
}
if($currentday == 'Tuesday'){
// code to get the password from password row tuesday
}

etc etc etc
 

Kaz

BooYah
Staff member
Nov 16, 2010
3,064
1,025
Im not going to write the code for you but i will explain how it is possible.

When registering the user selects a password for each day of the week. Ok thats done.

When they come to login, the user will enter the password for the day it is, when 'submit' has been clicked, you then need to check that the password is correct for that day and it gets the data from the correct password field

For example, Monday pass = 123456
Click - Submit
Password checking = check the date - ok date has been found what next?
Im presuming an if statement would be best for this to gather correct the data from the database
 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,637
2,389
Would this work? What if the server time was a different time to the user? Even though the server thinks it's Monday, the users computer could read it as Sunday or Tuesday because they're in a different time
 

Kaz

BooYah
Staff member
Nov 16, 2010
3,064
1,025
Would this work? What if the server time was a different time to the user? Even though the server thinks it's Monday, the users computer could read it as Sunday or Tuesday because they're in a different time
That was my first concern, the best and probably only way would be to base the times off the actual server time?
So for example if the server was in the USA and a UK person visted the site and the 2 timezones were on different days, then there should be a live server time of the US server so the UK members know which day it is
 

Markshall

Русский Стандарт
Contributor
Dec 18, 2010
2,637
2,389
That was my first concern, the best and probably only way would be to base the times off the actual server time?
So for example if the server was in the USA and a UK person visted the site and the 2 timezones were on different days, then there should be a live server time of the US server so the UK members know which day it is
Yeah exactly. Or unless you could find out what country/area the user is in, and set the timezone for that particular area with
Code:
date_default_timezone_set
 
Status
Not open for further replies.

Users who are viewing this thread

Top