June 27, 200818 yr Hey, could someone make a banning script for me ? I don't know how to make one, I've googled for one but they are all crap. Thanks.
June 27, 200818 yr I like it when a client goes deeply into specifics. Talking of which, it might help if you list a few few specifics like: What do you want to ban, from where and how.
June 27, 200818 yr ^ lol IN CASE you are looking to ban an IP (don't moan if this isn't what you're looking for!) <?php $ban = "127.0.0.1"; //IP to ban if($_SERVER['REMOTE_ADDR'] == $ban){ echo 'DENIED!!'; exit; } ?> Obviously, if you have tried a few already, it is more than likely you have come across something like this. Pretty crap!
June 27, 200818 yr ^ lol IN CASE you are looking to ban an IP (don't moan if this isn't what you're looking for!) <?php $ban = "127.0.0.1"; //IP to ban if($_SERVER['REMOTE_ADDR'] == $ban){ echo 'DENIED!!'; exit; } ?> Obviously, if you have tried a few already, it is more than likely you have come across something like this. Pretty crap! Nice bit of cheeky code there Shaun! ..... isnt it nearly impossible to bann most people as the majority of peeps have changing IP addresses.
June 28, 200818 yr Author Yes, this looks quite the same I've found. I don't want to ban IP ranges, only IP addresses. I want to integrate this in my ACP, and make script that allows me just to enter any IP address and it automatically bans it ( I think I know how to do this ). Then I also need to be able to remove the ban. I've found a banning script, like the one you just showed me, where you have an empty page with a line that says that you've been banned or whatever else you would like to appear on the page. But I want the whole page of the site to appear ( that looks like the rest of the site ) with a line that says "You are not allowed to visit this site" or something like that, but, as I said, I want the page to keep like the other pages, with the menu, header, footer, etc.. and this line would be at the place of the usual content. Thanks in advance, REVS.
June 30, 200818 yr If your server supports .htaccess files, it will be best to make a script that disallows them through .htaccess rather than your PHP code.
July 1, 200818 yr Author I don't know if my server accepts .htaccess files, but I was going to use it for my ACP. I think it does. I've uploaded an empty page from my site : http://www.manoelmanach.com/page.php
July 3, 200818 yr Author No I don't have this. And I want my own one . So ... is it too difficult ? Too complicated ?
July 4, 200818 yr Author <?php $ban = "127.0.0.1"; //IP to ban if($_SERVER['REMOTE_ADDR'] == $ban){ echo 'DENIED!!'; exit; } ?> Okay I will take this and modify it. But I want a particular page to appear, not just a line on an empty page, how do I do that ? I guess I have to change something here : echo 'DENIED!!' How can I include a whole page in this ?
July 5, 200818 yr You might be able to use PHPs include'file.php'; command...? Eg: <?php $ban = "127.0.0.1"; //IP to ban if($_SERVER['REMOTE_ADDR'] == $ban) { [b]include 'index.php'; [/b] echo 'DENIED!!'; exit; } ?> You can change the file name to a page on your site that suits. I think it'll still boot the user if you have the EXIT; command after the include, but someone should confirm if I'm on the right / wrong track. Jarrad
July 10, 200818 yr Author Okay so here's the next problem : I've created a page in my ACP that allows me just to enter any IP and then to click on the submit button to ban it. Everything seems to work there just I don't get banned when I enter my IP. My table in the DB is called banning. Here's what I have on the banning script : <?php mysql_connect("localhost", "root", "root"); mysql_select_db("MM"); $ban = $donnees['ip']; if($_SERVER['REMOTE_ADDR'] == $ban) { include 'banned.php'; exit; } ?> I don't know how to connect to take out the data from the table banning. In the table banning I have : id ( INT, primary, auto-increment ) and ip ( varchar ( 15 characters max. ) ). So my problem is to import the data from this table, I just don't know how. I don't know if you understand my problem. Anyways, thanks in advance.
Create an account or sign in to comment