PHP Coding
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsPHP RelatedPHP Coding

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old August 12th, 2002, 02:48 PM
freddymio freddymio is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: La Baule, France
Posts: 22 freddymio User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to freddymio
Tracking unwanted visitors

Hi!
I'd like to track visitors who have failed to succeed their login more than three time by writing their remote data to a DB and emailing him and the site administrator the incident.
Using: Apache 2; PHP4, MySQL-max

Reply With Quote
  #2  
Old August 12th, 2002, 02:52 PM
D1NGO D1NGO is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Perth, Australia
Posts: 221 D1NGO User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: Tracking unwanted visitors

You could do it by creating a column in the DB, and each time they failed their login attempt..add 1 to the tally, and have it expire after say 5 mins..then if the tally exceeds three...use a simple mail function. That is of course you know the basics of PHP. i'll go work on a lil script for ya now ;)

Reply With Quote
  #3  
Old August 12th, 2002, 05:41 PM
freddymio freddymio is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: La Baule, France
Posts: 22 freddymio User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via Yahoo to freddymio
RE: RE: Tracking unwanted visitors

Thank you D1NGO! I hope you have time soon.

Thanks to you ShaneO too, helpful remarks.

Quote:
You could do it by creating a column in the DB, and each time they failed their login attempt..add 1 to the tally, and have it expire after say 5 mins..then if the tally exceeds three...use a simple mail function. That is of course you know the basics of PHP. i'll go work on a lil script for ya now ;)


Reply With Quote
  #4  
Old August 13th, 2002, 05:08 AM
siteworkspro.com siteworkspro.com is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Sydney, Australia
Posts: 92 siteworkspro.com User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
Send a message via ICQ to siteworkspro.com Send a message via AIM to siteworkspro.com
RE: Tracking unwanted visitors

also maybe after the 3(or 5) time you could displaya lost password page??? saying something like, if you cant remember....

something like that to help your users, plus it will piss off those password hacker programs

Reply With Quote
  #5  
Old August 13th, 2002, 09:13 AM
chobo4ever chobo4ever is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Vienna, Austria
Posts: 63 chobo4ever User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: Tracking unwanted visitors

I think the problem (at least for me) is how to retrieve the remote data (IP and if set the email adress of the user from the browser). I just searched on some pages, but could not find anything useful..

Reply With Quote
  #6  
Old August 13th, 2002, 10:01 AM
D1NGO D1NGO is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Perth, Australia
Posts: 221 D1NGO User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: Tracking unwanted visitors

here is a bit of a script, not sure if it works yet..havnt tested it
php Code:
Original - php Code
  1.  
  2. <?php
  3. /* Have a table with an IP, timestamp and a number of trys column */
  4.  
  5. //connect to the database
  6. mysql_connect(host, user, pass)
  7.     or die("Couldnt connect to database");
  8.     or die("Couldnt select database");
  9.  
  10. $number_trys_allowed = 3; //set the amount of trys they're allowed
  11.  
  12. $timeoutseconds = 300; //equals 5 minutes
  13.  
  14. //get the time
  15. $timestamp = time();
  16. $timeout = $timestamp-$timeoutseconds;
  17.  
  18. //delete any entries in the database that are over or equal to amount of trys allowed and have waited 5 minutes
  19. mysql_query("DELETE FROM table WHERE timestamp < $timeout AND number_of_trys >= $number_trys_allowed ")
  20.     or die(mysql_error());
  21.  
  22. //insert their IP into a database
  23. mysql_query("INSERT INTO table SET ip = '$REMOTE_ADDR', number_trys = 0")
  24.     or die(mysql_error());
  25.    
  26. //check their username and password attempt
  27. $login = mysql_query("SELECT * FROM members_table WHERE username = '{$_POST['uname']}' AND password = '{$_POST['pass']}'")
  28.     or die(mysql_error());
  29. $num_rows = mysql_num_rows($login);
  30.  
  31. if($num_rows <> 1)
  32. {
  33.     //add one to the tally of trys
  34.     mysql_query("UPDATE table SET number_of_trys = number_of_trys + 1 WHERE ip = '$REMOTE_ADDR'")
  35.         or die(mysql_error());
  36. }
  37. else
  38. {
  39.     //display login form again
  40. }
  41.  
  42. ?>


tell me if theres any probs

Reply With Quote
Reply

Viewing: Codewalkers ForumsPHP RelatedPHP Coding > Tracking unwanted visitors


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway