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
    #1Hacked By SiLeNT
    #2Hacked By SiLeNT
    #3Hacked By SiLeNT
    #4Hacked By SiLeNT
    #5Hacked By SiLeNT
    Add your site


    Quality Freelancing


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


  • Premium Affiliates
     
     
    Exec and system commands

    This tutorial will show you how to run exec commands and system commands from php using a form, you do not need a database to run these commands but you do need permission to be able to run command line commands from PHP.
    This tutorial will show you how to do this using an example with the "ping" command, in short we will go through how to ping and display the results via browser. You need to have apachee running with Linux or FreeBSD for this to work properly.
    Okay, first we need two files, for this tutorials sake, we'll called them file.php and ping.php . File.php will just be a form to ask what address to ping. Ping.php will be the action file that takes the data passed, ping the site and then results the results, lets start with the code of file.php, which is just a regular HTML form.


    <form action='ping.php' method='post'>
    URL to ping:<br>
    <input type='text' name='address' size='20'><br>
    <input type='submit' name='submit' value='submit'><br>
    </form><br>

    This is the basic html form, simply with one text input field that lets the user input what address they want to ping. Next we have code for ping.php

    <?php
    //code for actual ping
    if(isset($_POST['submit']))
    //if submit has been pressed
    {
     $address=$_POST['address'];
     //above is a security measure to make sure it pings the typed address
     exec("ping -c 5 $address",$results);
     //the actual ping execution command
     //output thrown in $results
     $count=count($results);
     //counts number of rows $in results array
     for($i=0;$i<$count;$i++)
     {
       print "$results[$i]<br>";
     }
    }
     //the loops print out all results of $results  //line by line >



    Okay I've included comment below each line to explain what each line does. First I put $address equal to its post variable, this is a security measure to discourage malicious spiders from using the script and to stop hacking to a degree. The exec() function actually executes the via within the quotes in command line and throws the results into the $results variable as an array. The count function counts the number of rows in the $result array and stores that information into the $count variable. Next we use a basic for loop to print out all the rows, on by one of the result of the exec function. Below is an example of this script If you have any questions on this tutorial, 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