Free php scripts


WM Media - Sell Your Website Social Bookmarking
WL Marketing - a SEO Submission Company
Article Submission
  • Register
  • Login


  • Tutorials/support/References
  • PHP/ASP/PERL Bookstore
  • Community
  • Chat
  • Tutorials
  • Free Smiley Icons
  • Web Hosting

  • Search


    Scripts
  • Chipmunk CMS
  • Forums PHP Script
  • Chipmunk Blogger Script
  • Chipmunk Topsites
  • Chipmunk Addresshost
  • Chipmunk Newsletter
  • Free Guestbook Script
  • Free Poll Script
  • Directory Script
  • Kill Monster
  • Free FFAL script
  • CMS core
  • Chat Room
  • Riddles
  • Random Links
  • Recommend Site
  • Random Quote
  • Story Lines
  • Text Counter
  • Chipmunk Live
  • Chipmunk Bloghost
  • PHP AWS script
  • pwngame
  • Books
  • Begginning PHP4
  • Professional PHP4
  • PHP Cookbook
  • Legal Stuff for scripts
  • Script Liscense


  • Top 5 hottest members
    canuckid
    Mitch
    Decenco
    Tanya
    Chipmunk


    Top 5 links
    RankSite title
    #1Webtemplates-download
    #2Layouts 4 Free.com
    #3PHP121 Web Instant Messenger
    #41Scripts
    #5United Command
    Add your site


    Quality Freelancing


    Sister Sites
  • My Blog
  • Albino Freebies
  • Java gaming
  • Flashninjaclan


  • Premium Affiliates
     
     
    IP Banning
    This tutorial will show you how to ban people by IP address with php and mysql. First you need to go into php my admin and create the follow tables:


    CREATE TABLE banip ( ID int(12) NOT NULL auto_increment, IP varchar(25) NOT NULL default '', PRIMARY KEY (ID) ) TYPE=MyISAM;


    This is the basic table structure with only two fields, a field for a ID that identifies a unique field and a field for all IP's banned. Now we'll look at the code that actually bans the IP on each. Structure each page you want IP banning this way.


    <?php include "connect.php";
    //this is the file that connect to sql
    $s=$_SERVER["REMOTE_ADDR"];
    //draws IP address of visitor
    $ipbancheck="SELECT * from banip where IP='$s'";
    $ipbancheck2=mysql_query($ipbancheck);
    while($ipbancheck3=mysql_fetch_array($ipbancheck2))
    {
    $IPBANNED=$ipbancheck3[IP];
    }
    //above lines check to see if user Ip is in banned IPs
    if ($IPBANNED)
    {
    print "You have been banned ";
    }
    else
    {
    //put content you want unbanned users to see here
    }
    ?>


    Okay, this code should be fairly simple to understand. $_SERVER["REMOTE ADDR"] draws the IP address of the user the next line select from the table of baned IP where a field matches the user's IP. If no fields match the users IP, it comes up blank. The while loop sets the variable IPBANNED equal to the banned IP if the first select statement had any matches and, if the select didn't have any matches, it doesn't set a IPBANNED variable. Then when the the next few lines says if the IPBANNED variable exists, then we shows the 'You have been banned" message, otherwise show the actual page content in the else case.

    If you have any questions please post in the Support Forums
    News Categories
  • Site News
  • Technology news
  • Programming news
  • Other Major News


  • Search Articles


    Make Money
    Free Blog promotion -- Get your blog syndicated on thousands of other blogs for free.

    Tutorial Categories
    Ad Managers(5)
    Calendars(6)
    Chat systems(5)
    CMS systems(7)
    Cookies/Sessions(4)
    Counters(8)
    E-commerce(7)
    File Manipulation(4)
    Forms(10)
    Forums(4)
    Guestbooks(5)
    HTML/CSS Tutorials(12)
    Image-related(5)
    Link indexing/ Classifieds(6)
    Mailing Lists/E-mail(5)
    Misc(17)
    MySQL Related(9)
    Navigation/Templating(6)
    PHP Basics(10)
    Polls(3)
    RSS and other feeds(5)
    Searching(4)
    Security(13)
    XML and other parsing(3)


    Resources
    Scripts/Graphics
  • Ecommerce Website Design
  • Hotscripts
  • Boxedart
  • Zero Web
  • Edorel Free Hosting
  • Javascript Reference
  • Powerful Scripts
  • Scripts Bank
  • Finestzone Designs
  • Layouts 4 free
  • Website Resources
  • 4 templates
  • Free URL redirection
  • Web Hosting
  • Website Hosting
  • Photoshop Tutorials
  • PHP and MYSQL tutorials
  • Free Templates
  • Tutorials DB
  • Pure Graphics
  • Total Tutorials
  • Myspace Pro Designs


  • Random Affiliates
        
        
        

    More affiliates