Hello, for my site (temporary URl until I get real hosting plan),link in sig(mass-share) which is a file host, I have rules that if broken result in a ban for the person's IP. How so I get the person's IP, print it, and possibly ban it if needed? I would have to manually add it to a ban list or something, which is fine. PHP or HTML please... Thanks! /offtopic PS: Also Can you give me some feedback on the site, such as CSS and the rest of it...
You can easily get someone's IP address with PHP: $visitorIP = $_SERVER['REMOTE_ADDR']; Code (markup): You can then add that IP to a MySQL table and whenever someone visits the site with that IP address, redirect them to a special "banned" page. This is FAR from foolproof, though. First of all, they can have a dynamic IP address, which means it will be different every time they come to your site. Secondly, most visitors who are breaking rules are probably savvy hackers, who can spoof any IP address they want.
Well, you'll have to do some reading on how to insert the data into a MySQL table, but redirecting to a new URL in php is very easy. If you have not sent any info to the browser yet, use this: header('Location: http://www.yoursite.com/banned.php'); Code (markup): and if you have, use output buffering: // PUT THIS AT TOP OF PAGE ob_start(); // THEN FOR REDIRECT ob_end_clean(); header('Location: http://www.yoursite.com/banned.php'); exit; Code (markup):
I see that the ip addresses are stored in the option field of the vb_database file but there is also a lot of other data contained in that field. Any direction of where to read how to add ip addresses to the option field would be appreciated.