| | |
sleep function
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Aug 2008
Posts: 381
Reputation:
Solved Threads: 33
Hi Amy,
I don't fully understand onion routers, but if I understand correctly -- users within a group share, or mix and match IP addresses in order to make back-tracing to one specifiic user impossible. This might be used for hacking attempts, and add more IPs to the mix of ones detected...but don't quote me on that.
I've forgotten my password before and been max-attempted out of trying to login to a site. The user will know they are pushing the envelope. You can also include a way for a user to reset their password to their database-stored email address (only). You shouldn't get too many complaints when the users realize their personal info is safe with you. Also, my little script resets after the time-limit -- on every attempt, not as a batch.
I'm not sure I would use sleep, it freezes the whole script execution and probably will frustrate users. My little example takes number of attempts within a specific time-frame into consideration without using sleep.
As was mentioned, there is no absolute security methodology. There is only your best effort against the hackers. Also, how sensitive is your data that you're protecting -- how tempting is it to advanced hackers? If it is really valuable, I would recommend getting a security specialist on-board, otherwise do your best and get a good nights sleep.
Cheers
•
•
•
•
Okay, so if I block the IP addresses, it's possible the hacker will have an onion router so I can't see their IP address.
•
•
•
•
If I use something to shut down the user themselves and not let them get into their account after so many wrong attempts, I may have a lot of users try to get in touch with me with complaints.
•
•
•
•
I'm understanding that there are even problems with the sleep function.
If we use all these functions at once, are we really any safer? Can we win?
As was mentioned, there is no absolute security methodology. There is only your best effort against the hackers. Also, how sensitive is your data that you're protecting -- how tempting is it to advanced hackers? If it is really valuable, I would recommend getting a security specialist on-board, otherwise do your best and get a good nights sleep.
Cheers
Last edited by langsor; Aug 26th, 2008 at 5:29 pm.
Google is the answer to all of your questions -- the trick is knowing what question to ask in your specific predicament.
•
•
Join Date: Aug 2008
Posts: 94
Reputation:
Solved Threads: 0
To tell you the truth, there is nothing really valuable. What I mean is that pretty much everything that they type into their account gets posted online, except for some small things. They know this in advance. I do not have any credit card info or SS#'s or anything of the such. But my customers are allowed to upload pics and I would just like things to remain clean. I'd hate to get on there one day and see some dirty pics of a blonde doing a midget or something. It just wouldn't be very appropriate, ya know?
I really appreciate everyone writing in, this is a great response! Now if I can just figure out which one would be best...I think I'm leaning toward allowing the user to only have a certain amount of attempts. Is it possible and do you think it would be a good idea to let the user know after each attempt that they only have a certain number of attempts left?
~Amy
I really appreciate everyone writing in, this is a great response! Now if I can just figure out which one would be best...I think I'm leaning toward allowing the user to only have a certain amount of attempts. Is it possible and do you think it would be a good idea to let the user know after each attempt that they only have a certain number of attempts left?
~Amy
•
•
Join Date: Aug 2008
Posts: 1,160
Reputation:
Solved Threads: 137
Its all up to you. Typically you would not let the user know how many attempts they have left and just display a message after they have locked themselves out, that their account has been locked and will be available in 'x minutes' or if they reset their password or whatever method you choose.
Another reason that you wouldn't let them know, is if you ever decide to change the number of attempts, you might have to change the error message. Also with the hacking thing, this will let them know how many chances they have left to try for this account, before moving on to the next one.
All in all, still a personal preference.
Another reason that you wouldn't let them know, is if you ever decide to change the number of attempts, you might have to change the error message. Also with the hacking thing, this will let them know how many chances they have left to try for this account, before moving on to the next one.
All in all, still a personal preference.
Custom Application & Software Development
www.houseshark.net
www.houseshark.net
•
•
Join Date: Aug 2008
Posts: 381
Reputation:
Solved Threads: 33
dickersonka makes good points, especially about alerting hackers to how many attempts they have. It would be easy enough to calculate how many attempts within a certain period the hacker has and write a delay in their script to compensate for that.
Of course, 5 attempts every 5 minutes (how it is set now) would only allow 60 possible usename-password combinations an hour, which would take a decade to perform a brute force attack if the password is at all secure.
If you want to show number of attempts, you can do so dynamically by returning the count from the test_attempts function: replace return $allow; with...
...and in your main function after print 'PROCEED'; when you've tested if the username and password match the database-stored values ... if they don't you can display the greater of the current counts...
I didn't test the above snippets, but they should work
Hope this helps
Of course, 5 attempts every 5 minutes (how it is set now) would only allow 60 possible usename-password combinations an hour, which would take a decade to perform a brute force attack if the password is at all secure.
If you want to show number of attempts, you can do so dynamically by returning the count from the test_attempts function: replace return $allow; with...
php Syntax (Toggle Plain Text)
return ( $allow ) ? $count : FALSE;
php Syntax (Toggle Plain Text)
print ( $allow_user > $allow_pass ) ? $allow_user : $allow_pass;
Hope this helps
Google is the answer to all of your questions -- the trick is knowing what question to ask in your specific predicament.
•
•
Join Date: Aug 2008
Posts: 381
Reputation:
Solved Threads: 33
Okay, still haven't tested it but realized a fatal flaw in my logic above...NOT
return ( $allow ) ? $count : FALSE;
For count up
For count down
Or something like this...you might have to play with it some...you just don't want to return a zero (0) count, as that will be interpreted as FALSE. :-)
Cheers
return ( $allow ) ? $count : FALSE;
For count up
php Syntax (Toggle Plain Text)
return ( $allow ) ? $count +1 : FALSE;
For count down
php Syntax (Toggle Plain Text)
return ( $allow ) ? $max - ($count + 1) : FALSE;
Or something like this...you might have to play with it some...you just don't want to return a zero (0) count, as that will be interpreted as FALSE. :-)
Cheers
Google is the answer to all of your questions -- the trick is knowing what question to ask in your specific predicament.
You know, you can implement a system to beat that situation where a hacker is using a specific password with several usernames by just blocking any attempt on that password for the next hour or so. I would create an abuse table or set of tables and abused passwords would be one of them with password, timestamp and attempts as the columns. Just keep it cleaned up with cron.
Last edited by R0bb0b; Aug 26th, 2008 at 10:21 pm.
“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” - Dr. Seuss
-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
•
•
Join Date: Aug 2008
Posts: 381
Reputation:
Solved Threads: 33
•
•
•
•
So there is a way to limit failed login attempts that are either for wrong passwords or for wrong usernames?
Langsor, have you tested the php you posted earlier?
Thanks,
~Amy
I did not actually test the small additional pieces in my last couple posts though, those were off the top of my head.
Let me know if you have any questions or need any help with this code.
Google is the answer to all of your questions -- the trick is knowing what question to ask in your specific predicament.
“Be who you are and say what you feel because those who mind don't matter and those who matter don't mind.” - Dr. Seuss
-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
-- The documentation is inevitable, you may get away with it for a little while but eventually you too will have to do the deed.
•
•
Join Date: Aug 2008
Posts: 94
Reputation:
Solved Threads: 0
Okay, I'm come up with something else, please tell me if you think it would be a good idea or not.
My website is a site where you can go in and post your home online by county. Is it possible to prevent some attacks by making the user put in not only their username and password, but also the county in which they live? I could write the php code to check all of that and if they got it all correct, then they are smooth sailing.
The only problem I worried about running into would be if they didn't spell their county correctly, but I think it would take a real moron to not know how to spell their own county, but then again, I have to expect that, I suppose. Hehe
Since their are over 3,000 counties, do you believe this is a good idea for prevention?
~Amy
My website is a site where you can go in and post your home online by county. Is it possible to prevent some attacks by making the user put in not only their username and password, but also the county in which they live? I could write the php code to check all of that and if they got it all correct, then they are smooth sailing.
The only problem I worried about running into would be if they didn't spell their county correctly, but I think it would take a real moron to not know how to spell their own county, but then again, I have to expect that, I suppose. Hehe
Since their are over 3,000 counties, do you believe this is a good idea for prevention?
~Amy
![]() |
Similar Threads
- Using the sleep function (Java)
- Python Sleep Function: (Python)
- What is sleep function (Perl)
- PHP hold program execute function (PHP)
- Interrupt Sleep function (Python)
- Help: need feedback on my Java assignment about thread sleep. It's already coded. (Java)
Other Threads in the PHP Forum
- Previous Thread: from in email
- Next Thread: easy question
| Thread Tools | Search this Thread |
# 5.2.10 alexa apache api array beginner binary broken cakephp checkbox class clean clients cms code cron curl database date directory display dissertation dropdown dynamic echo echo$_get[x]changingitintovariable... email encode error fairness file files folder form forms function functions google href htaccess html image images include indentedsubcategory insert ip javascript joomla legislation limit link local login mail memberships menu mlm multiple multipletables mysql mysqlquery newsletters oop open paypal pdf persist php problem provider query radio random recursion remote rss script search server sessions sms sockets source space spam sql syntax system table tutorial update upload url validator variable video web youtube






