Jump to content

[SOLVED] Hey! I didnt I just kick you out?


NorthWestSimulations

Recommended Posts

Okay.. Interesting title, I know. Im awesome like that. Heres my problem

 

My website: http://www.nwsim.com/

 

Has a login form. (I know the website is pale. I just started working on it a few moments ago...) But is there a way for me to make a thingy that allows a person to attempt to login 3 times and if they get it wrong the 4th time it bans them from the login system for oooh... I dont know? 5 minutes?

Link to comment
Share on other sites

yup, probably best off using Session vars

 

Yes but session variables are being used for the overall login process. Someone who ha failed the authenication attempt could simply visit http://www.nwsim.com/index.php?action=logout and completly delete there session data. I need something that stores there IP in a database and stuff... Then if $Current_time >= 5 minutes deletes it.

Link to comment
Share on other sites

yup, probably best off using Session vars

 

Yes but session variables are being used for the overall login process. Someone who ha failed the authenication attempt could simply visit http://www.nwsim.com/index.php?action=logout and completly delete there session data. I need something that stores there IP in a database and stuff... Then if $Current_time >= 5 minutes deletes it.

 

Or you could check to make sure a correct session (like user id) is in place before destroying the session, otherwise forward them back to the main page. DB would work too, to add onto what thorpe is saying, I would add in username, and have it lock that account, so you can't try to access that account on any computer for X minutes after X tries.

Link to comment
Share on other sites

Hmm, Interesting... So it would be like every time someone attempts a login it is a $x++; which would update over the acc. if the likit was equal to or greater than 3 then it would lock the acc and insert a time stamp. Then I would use Cron(); to delete that data after a certain time. Or have the script see if current timestamp is greater than +5 minutes.

 

Hmm... I think I got it.

Link to comment
Share on other sites

Cron's are not necessary.

 

You can have a script run at the beginning of every page prune the database of old session or login information as needed. If it does this first thing, it's like the values were never even there when your user came to the site, nothing will be able to view them before they're deleted.

Link to comment
Share on other sites

Cron's are not necessary.

 

You can have a script run at the beginning of every page prune the database

 

yeah but that adds unneccesary overhead to the page load of an undeserving user, where a cron once/twice per day (based on traffic) would prune a db table before it got too large to actually slowdown the site, and it wouldnt be an extra load on a user

 

but i see what you mean because if you are logging in for the second time since cron was last run, the db row with your name in it will probably have to be deleted anyway

Link to comment
Share on other sites

cron runs on linux servers, you host's tech support can probably help you set it up... it is a command to direct the internal browser of the server your site resides on to an address you choose. so you make a cron.php that does what you want it, usually db maintinence/backup and then point your cronjob there and it accesses the page whenever you want it to. rather than you having to go to your cron.php from your computer each day

 

heres my cron script, it is run at 4am every morning and it backs up my db

 

<?php
include ('../../dbbackups/config.php');

$backupFile = '../../dbbackups/' . date("Y-m-d") . '.sql.gz';
$command = "/usr/bin/mysqldump -h$dbhost -u$dbuser -p$dbpass $dbname | gzip -c > $backupFile";

$backup =`$command`; 

?> 

Link to comment
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.