Maq Posted October 10, 2008 Share Posted October 10, 2008 haha yeah it def is. Link to comment https://forums.phpfreaks.com/topic/127729-ip-ban-script-not-working/page/2/#findComment-661634 Share on other sites More sharing options...
sith717 Posted October 10, 2008 Author Share Posted October 10, 2008 I didnt use a db since I dont know how to do it. Link to comment https://forums.phpfreaks.com/topic/127729-ip-ban-script-not-working/page/2/#findComment-662257 Share on other sites More sharing options...
Maq Posted October 10, 2008 Share Posted October 10, 2008 I'm sorry but is this topic solved yet? Click TOPIC SOLVED please. If not, ask a question. Link to comment https://forums.phpfreaks.com/topic/127729-ip-ban-script-not-working/page/2/#findComment-662260 Share on other sites More sharing options...
sith717 Posted October 10, 2008 Author Share Posted October 10, 2008 How do I do it so I can use a database to store the banned people. Link to comment https://forums.phpfreaks.com/topic/127729-ip-ban-script-not-working/page/2/#findComment-662261 Share on other sites More sharing options...
Maq Posted October 10, 2008 Share Posted October 10, 2008 Do you have a database set up? Link to comment https://forums.phpfreaks.com/topic/127729-ip-ban-script-not-working/page/2/#findComment-662263 Share on other sites More sharing options...
sith717 Posted October 10, 2008 Author Share Posted October 10, 2008 Yes, how do I do it so I can add something to the table like a persons ip, like form that adds it to the database. Link to comment https://forums.phpfreaks.com/topic/127729-ip-ban-script-not-working/page/2/#findComment-662264 Share on other sites More sharing options...
sith717 Posted October 10, 2008 Author Share Posted October 10, 2008 Understand what I mean? Link to comment https://forums.phpfreaks.com/topic/127729-ip-ban-script-not-working/page/2/#findComment-662273 Share on other sites More sharing options...
AndyB Posted October 10, 2008 Share Posted October 10, 2008 Understand what I mean? This is not your personal chat line!! If you want to learn, you need to start by doing something on your own instead of holding out your hands. Spend time at www.tizag.com then come back and post some code you have created. Ask a relevant, coherent question and you'll probably get an answer. This thread is getting very close to being locked. Link to comment https://forums.phpfreaks.com/topic/127729-ip-ban-script-not-working/page/2/#findComment-662290 Share on other sites More sharing options...
sith717 Posted October 10, 2008 Author Share Posted October 10, 2008 Ok... Link to comment https://forums.phpfreaks.com/topic/127729-ip-ban-script-not-working/page/2/#findComment-662331 Share on other sites More sharing options...
redarrow Posted October 10, 2008 Share Posted October 10, 2008 I done this for you mate..................... 1. Copy the database info paste it into mysql..... 2. Save the curent page as ban_users.php Each time a user goes on your web site there ip will go into the database and the date they were added...... if they are in the database there get a error message..... use a include("ip_ban.php"); function to add this script to your index.php page....... good luck.............. I EXSPECT YOU TO READ ALL THE PHP SIMPLE FUNCTIONS I HAVE USED AND THE MYSQL FUNCTIONS............... <?php # mysql info..... copy and past this in mysql console......... /* create database ban_ip; use ban_ip; create table ip_bad(id int not null auto_increment primary key, users_ip int not null, date_added int not null); */ // provided form redarrow // simple ip ban script............. ?> <?php //database connection...... $db=mysql_connect("localhost","username","password"); $res=mysql_createdb("database_name",$db); // current users ip....... $users_ip=$_SERVER['REMOTE_ADDR']; // post users ip....... $users_ip=mysql_real_esape_string($_POST['users_ip']); //current date...... $date_added=time(); // post the date...... $date_added=mysql_real_esape_string*($_POST['date_added']); // if a ip exists start a condition... if($user_ip){ // select the database.............. // see if the ip already in it if so echo a message.... $sql1="SELECT * FROM `ip_ban` WHERE `users_ip`='$users_ip'"; $res1=mysql_query($sql1)or die(mysql_error()); if(mysql_num_row($res1)){ echo "SORRY YOUR BAN FROM MY WEB SITE!"; EXIT; }else{ //if the ip is not in the database put it in........ sql2="INSERT INTO ip_ban(id,users_ip,date_added)VALUES('$id','$users_ip','$date_added'"; $res2=mysql_query($sql2)or die(mysql_error()); } } ?> Link to comment https://forums.phpfreaks.com/topic/127729-ip-ban-script-not-working/page/2/#findComment-662364 Share on other sites More sharing options...
sith717 Posted October 11, 2008 Author Share Posted October 11, 2008 hu? I have no idea what you mean... Please pm me. Link to comment https://forums.phpfreaks.com/topic/127729-ip-ban-script-not-working/page/2/#findComment-662396 Share on other sites More sharing options...
Recommended Posts