ban ip/device?
Started on the old forum in July 2009 · view the original in the archive · old links redirect here
Dude, im kinda new at this php and sql... Itz a php script .. But u can check loverzone.wen.ru
🙂
Edit and use this.
<?php /* usage 1.create database 2.connect to database 3.use the table "current" to store the current ip's of visitors - automatic insert - this table allow unique ip's only 4.use table "bann" to insert what ip's you want to bann/block - for this make manual insert - this table allow unique ip's only */ /* database -- phpMyAdmin SQL Dump -- version 2.7.0-pl1 -- [phpMyAdmin](http://www.phpmyadmin.net) -- -- Host: localhost -- Generation Time: Dec 06, 2004 at 04:05 PM -- Server version: 5.0.17 -- PHP Version: 5.1.1 -- -- Database: `bann` -- -- -------------------------------------------------------- -- -- Table structure for table `bann` -- CREATE TABLE `bann` ( `id` int(11) NOT NULL auto_increment, `ip` text NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `ip` (`ip`(15)) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ; -- -- Dumping data for table `bann` -- INSERT INTO `bann` VALUES (2, '127.0.0.5'); INSERT INTO `bann` VALUES (3, '127.0.0.2'); INSERT INTO `bann` VALUES (4, '127.0.0.1'); -- -------------------------------------------------------- -- -- Table structure for table `current` -- CREATE TABLE `current` ( `id` int(11) NOT NULL auto_increment, `ip` text NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `ip` (`ip`(15)) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=2 ; -- -- Dumping data for table `current` -- INSERT INTO `current` VALUES (1, '127.0.0.1'); */ // connect to database $link = mysql_connect("localhost", "root", ""); if(!$link) { echo "Not Connected To SQL" .mysql_error(); } $ip = $_SERVER['REMOTE_ADDR']; // select database $select_db = mysql_select_db('bann', $link); if(!$select_db) { echo "Not Connected To DB" .mysql_error(); } // insert the current ip $insert = "INSERT INTO `current` ( `id` , `ip` ) VALUES (NULL , '$ip')"; @mysql_query($insert); // select ip for bann processing $select_accept = "SELECT * FROM bann INNER JOIN current ON bann.ip = current.ip"; $result_accept = mysql_query($select_accept); if(mysql_num_rows($result_accept)) { echo 'ip not ok, banned'; } else { echo "ip ok, not banned, continue with the script"; } mysql_close(); ?>Similar topics
WURFL - PHP API (v1.0 2009-03-09) - How To Use "is_wireless_device"8 replieswhatsmylocation.mobi script, detects neraby locations, for touch devices7 repliesflirty9.com - free online dating app for ios/iphone and android devices7 repliesMobile device detect with PHP5 repliesblocking a device2 replies