Jump to content
xisto Community

Search the Community

Showing results for tags 'ip'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Help & Support
    • Alerts, News & Announcements
    • Web Hosting Support
    • Introductions
  • Computers & Tech
    • Science and Technology
    • Software
    • The Internet
    • Search Engines
    • Graphics, Design & Animation
    • Computer Gaming
    • Websites and Web Designing
    • Mobile Phones
    • Operating Systems
    • Programming
    • Online Advertising
    • Hardware Workshop
    • Computer Networks
    • Security issues & Exploits
  • Others
    • General Discussion
    • Business Forum
    • Photography
    • Health & Fitness
    • Dating And Relationships
    • The Vent
    • Art & Creativity
    • Home & Garden

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Location


Interests

Found 1 result

  1. I got this code from this form.. from developer... who posted but he is nt replying me anything for any update so i like to do open discussion so it can make workable code.. please... First of all when i setup everything correct..... while using admin: admin and password : password and i hit login... nothing hppns stays same page, now when i enter ip and click yes to block i recievied this error "Could not Block Ip, MySql Error" ok.... after this was nt working i went to mysql db and entered ip and time by manually in that table.. now i visited .. the ipadmin.php again.. now same problem.. except.. in blocked ip list... i can see the ip added. hence my db is working connected to ... now when i select 1 ip and try to remove.. again it doesnt do anything.. ip remains der.. please some1 try this code... its very easy .. but very useful... and help me to fix the issue.. thank you the First thing we are going to do is make the form that is actually blocking the site. Note: You Must have this in a PHP file to work, it must be at the VERY TOP!!!!! klist.php ][color=#666600]<?[/color][color=#000000]php[/color][color=#000000]$vip [/color][color=#666600]=[/color][color=#000000] $_SERVER[/color][color=#666600][[/color][color=#008800]'REMOTE_ADDR'[/color][color=#666600]];[/color][color=#000000]include [/color][color=#008800]"config.php"[/color][color=#666600];[/color][color=#880000]##############################[/color][color=#880000]# See if the Ip is in the blocked list #[/color][color=#880000]##############################[/color][color=#000000]$get_info [/color][color=#666600]=[/color][color=#000000] mysql_query[/color][color=#666600]([/color][color=#008800]"SELECT * FROM blocked WHERE ip = '$vip'"[/color][color=#666600]);[/color][color=#000000]$do_block [/color][color=#666600]=[/color][color=#000000] mysql_fetch_array[/color][color=#666600]([/color][color=#000000]$get_info[/color][color=#666600]);[/color][color=#880000]############################################[/color][color=#880000]# Now we are just checking to see if we need to block the user #[/color][color=#880000]############################################[/color][color=#000000] [/color][color=#000088]if[/color][color=#666600]([/color][color=#000000] $do_block[/color][color=#666600][[/color][color=#008800]'ip'[/color][color=#666600]][/color][color=#000000] [/color][color=#666600]==[/color][color=#000000] [/color][color=#008800]"$vip"[/color][color=#000000] [/color][color=#666600]){[/color][color=#000000] [/color][color=#000088]die[/color][color=#666600]([/color][color=#008800]"Sorry! Your Ip has been blocked from viewing our sites content"[/color][color=#666600]);[/color][color=#666600]}[/color][color=#666600]?>[/color] The above just save it however you want to... I would recommend ipblochp before that works we need to create the table inside of a database that will have the ip's stored inside of them So in phpMyAdmin or your MySql Query Window type in USE 'databasename'; Excute it... CREATE TABLE blocked( id int not null auto_increment primary key, ip varchar(15), added datetime); Excute... Now you are set up! Ok, Good Job on the MySql Database set up... Now, we need to create a config file which will store how we are connecting and what database we are using [color=#666600]<?[/color][color=#000000]php[/color][color=#880000]#########################[/color][color=#880000]# Config File #[/color][color=#880000]#########################[/color][color=#000000]$dbhost [/color][color=#666600]=[/color][color=#000000] [/color][color=#008800]"localhost"[/color][color=#666600];[/color][color=#000000] [/color][color=#880000]// This is your database host name usally localhost[/color][color=#000000]$dbuser [/color][color=#666600]=[/color][color=#000000] [/color][color=#008800]"user"[/color][color=#666600];[/color][color=#000000] [/color][color=#880000]// This is your database user name...[/color][color=#000000]$dbpass [/color][color=#666600]=[/color][color=#000000] [/color][color=#008800]"pass"[/color][color=#666600];[/color][color=#000000] [/color][color=#880000]// this is your password used to login to the database[/color][color=#000000]$dbname [/color][color=#666600]=[/color][color=#000000] [/color][color=#008800]"database"[/color][color=#666600];[/color][color=#000000] [/color][color=#880000]// this is your database name.[/color][color=#880000]##########################[/color][color=#880000]# Edit the above to suit your needs ##[/color][color=#880000]##########################[/color][color=#000000] $conn [/color][color=#666600]=[/color][color=#000000] mysql_connect[/color][color=#666600]([/color][color=#008800]"$dbhost"[/color][color=#666600],[/color][color=#008800]"$dbuser"[/color][color=#666600],[/color][color=#008800]"$dbpass"[/color][color=#666600]);[/color][color=#000000] mysql_select_db[/color][color=#666600]([/color][color=#008800]"$dbname"[/color][color=#666600],[/color][color=#000000] $conn [/color][color=#666600]);[/color][color=#666600]?>[/color] Then Your Done... I would save this as config.php because thats what we imported into our ip checker file (e.g. inlcude "config.php"; ) Ok, as I said you need to put this line of code on your first line after <?php or if you are using session_start(); after that it's should like this [color=#666600]<?[/color][color=#000000]phpinclude [/color][color=#008800]"ipblocklist.php"[/color][color=#666600];[/color][color=#880000]// The rest of your code[/color][color=#666600]?>[/color][color=#282828][font=helvetica, arial, sans-serif]Now, it's time to make a admin type area so you can add or remove blocked Ip's...[/font][/color][color=#666600]<?[/color][color=#000000]phpsession_start[/color][color=#666600]();[/color][color=#880000]#####################[/color][color=#880000]# Get the Config File #[/color][color=#880000]#####################[/color][color=#000000]include [/color][color=#008800]"config.php"[/color][color=#666600];[/color][color=#880000]#########################[/color][color=#880000]# Set the admin credentials # [/color][color=#880000]#########################[/color][color=#000000]$admin [/color][color=#666600]=[/color][color=#000000] [/color][color=#008800]'admin'[/color][color=#666600];[/color][color=#000000]$pass [/color][color=#666600]=[/color][color=#000000] [/color][color=#008800]'password'[/color][color=#666600];[/color][color=#000000]$s_user [/color][color=#666600]=[/color][color=#000000] $_POST[/color][color=#666600][[/color][color=#008800]"admin"[/color][color=#666600]];[/color][color=#000000]$s_pass [/color][color=#666600]=[/color][color=#000000] $_POST[/color][color=#666600][[/color][color=#008800]"pass"[/color][color=#666600]];[/color][color=#000088]if[/color][color=#666600]([/color][color=#000000] $ses_user [/color][color=#666600]<=[/color][color=#000000] [/color][color=#008800]" "[/color][color=#000000] [/color][color=#666600]){[/color][color=#880000]#########################[/color][color=#880000]# Admin Login Form #[/color][color=#880000]#########################[/color][color=#000000]echo [/color][color=#008800]"<form action='ipadmin.php' method='post'>"[/color][color=#666600];[/color][color=#000000]echo [/color][color=#008800]"Admin: <input type='text' name='admin'><br>"[/color][color=#666600];[/color][color=#000000]echo [/color][color=#008800]"Pass: <input type='password' name='pass'><br>"[/color][color=#666600];[/color][color=#000000]echo [/color][color=#008800]"<input type='submit' value='Login'>"[/color][color=#666600];[/color][color=#000000]echo [/color][color=#008800]"</form>"[/color][color=#666600];[/color][color=#666600]}[/color][color=#000000] [/color][color=#000088]if[/color][color=#666600]([/color][color=#000000] $s_user [/color][color=#666600]==[/color][color=#000000] $admin [/color][color=#000088]and[/color][color=#000000] $s_pass [/color][color=#666600]==[/color][color=#000000] $pass [/color][color=#666600]){[/color][color=#000000] $ses_user [/color][color=#666600]=[/color][color=#000000] $_SESSION[/color][color=#666600][[/color][color=#008800]'admin'[/color][color=#666600]][/color][color=#000000] [/color][color=#666600]=[/color][color=#000000] $s_pass[/color][color=#666600];[/color][color=#000000] $go [/color][color=#666600]=[/color][color=#000000] [/color][color=#006666]1[/color][color=#666600];[/color][color=#666600]}[/color][color=#000088]if[/color][color=#666600]([/color][color=#000000] $go [/color][color=#666600]=[/color][color=#000000] [/color][color=#006666]1[/color][color=#000000] [/color][color=#666600]){[/color][color=#000000]echo [/color][color=#008800]"Add a Ip to the Blocked List"[/color][color=#666600];[/color][color=#000000]echo [/color][color=#008800]"<form action='ipadmin.php' method='post'>Ip: <input type='text' name='ip'><input type=submit value='Block Ip'></form>"[/color][color=#666600];[/color][color=#666600]}[/color][color=#000088]if[/color][color=#666600]([/color][color=#000000] $_POST[/color][color=#666600][[/color][color=#008800]"ip"[/color][color=#666600]][/color][color=#000000] [/color][color=#666600]>[/color][color=#000000] [/color][color=#008800]" "[/color][color=#000000] [/color][color=#666600]){[/color][color=#000000]$ip2 [/color][color=#666600]=[/color][color=#000000] $_POST[/color][color=#666600][[/color][color=#008800]"ip"[/color][color=#666600]];[/color][color=#000000]echo [/color][color=#008800]"Are you sure you want to block $ip2"[/color][color=#666600];[/color][color=#000000]echo [/color][color=#008800]"<form action='ipadmin.php' method='post'><input type='hidden' name='ip2' value='$ip2'><input type='submit' name='block' value='yes'>"[/color][color=#666600];[/color][color=#666600]}[/color][color=#000088]if[/color][color=#666600]([/color][color=#000000] $_POST[/color][color=#666600][[/color][color=#008800]"block"[/color][color=#666600]][/color][color=#000000] [/color][color=#666600]==[/color][color=#000000] [/color][color=#008800]"yes"[/color][color=#000000] [/color][color=#666600]){[/color][color=#000000] mysql_query[/color][color=#666600]([/color][color=#008800]"INSERT INTO blocked SET ip = '$ip2' added = NOW()"[/color][color=#666600])[/color][color=#000000] [/color][color=#000088]or[/color][color=#000000] [/color][color=#000088]die[/color][color=#666600]([/color][color=#008800]"Could not Block Ip, MySql Error"[/color][color=#666600]);[/color][color=#666600]}[/color][color=#000000]echo [/color][color=#008800]"<center>Remove Blocked Ips<br><br>"[/color][color=#666600];[/color][color=#000000]echo [/color][color=#008800]"<form action='ipadmin.php' method='post'><select name='remove'><option value=''>Select One</option>"[/color][color=#666600];[/color][color=#000000]$ips [/color][color=#666600]=[/color][color=#000000] mysql_query[/color][color=#666600]([/color][color=#008800]"SELECT * FROM blocked"[/color][color=#666600]);[/color][color=#000088]while[/color][color=#666600]([/color][color=#000000] $showips [/color][color=#666600]=[/color][color=#000000] mysql_fetch_array[/color][color=#666600]([/color][color=#000000]$ips[/color][color=#666600])){[/color][color=#000000]$ip_value [/color][color=#666600]=[/color][color=#000000] $showips[/color][color=#666600][[/color][color=#008800]'ip'[/color][color=#666600]];[/color][color=#000000]echo [/color][color=#008800]"<option value='$ip_value'>$ip_value</option>"[/color][color=#666600];[/color][color=#666600]}[/color][color=#000000]echo [/color][color=#008800]"<input type='submit' value='RemoveIp' name='Remove Ip'>"[/color][color=#666600];[/color][color=#000000]echo [/color][color=#008800]"</form>"[/color][color=#666600];[/color][color=#000088]if[/color][color=#666600]([/color][color=#000000] $_POST[/color][color=#666600][[/color][color=#008800]"Remove Ip"[/color][color=#666600]][/color][color=#000000] [/color][color=#666600]==[/color][color=#000000] [/color][color=#008800]"RemoveIp"[/color][color=#000000] [/color][color=#666600]){[/color][color=#000000]$del_ip [/color][color=#666600]=[/color][color=#000000] $_POST[/color][color=#666600][[/color][color=#008800]'remove'[/color][color=#666600]];[/color][color=#000000]mysql_query[/color][color=#666600]([/color][color=#008800]"DELETE FROM blocked WHERE ip = '$del_ip' LIMIT 1"[/color][color=#666600]);[/color][color=#000000]echo [/color][color=#008800]"The Ip $del_ip has been removed from the blocked list!"[/color][color=#666600];[/color][color=#666600]}[/color][color=#666600]?>[/color] OK now save that above as ipadmin.php Everything Should work succesfully any question
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.