PHP
  Home arrow PHP arrow Page 6 - Stream Me Up, Scotty! (part 1)
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Moblin 
JMSL Numerical Library 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Stream Me Up, Scotty! (part 1)
By: Vikram Vaswani, (c) Melonfire
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 2 stars2 stars2 stars2 stars2 stars / 4
    2000-11-07

    Table of Contents:
  • Stream Me Up, Scotty! (part 1)
  • Out With The Old...
  • ...In With The New
  • Where Am I?
  • GETting It Right
  • Start Me Up!
  • Lights! Camera! Action!
  • Well-Formed Ideas
  • Appendix: Code Listing

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Stream Me Up, Scotty! (part 1) - Start Me Up!


    (Page 6 of 9 )

    Now, that covers the various FTP functions that PHP provides - but, just by itself, it isn't enough. The true power of these functions becomes visible only when they're combined into a single application which provides file transfer and file management capabilities. Since we're talking about FTP functions, it seems obvious that the best application for such a demonstration would be a Web-based FTP client - which is exactly what's coming up next!

    Before we get into a code listing, I should make it clear that the example below is meant only to illustrate the various functions you've just learned. While it is functional and can be used as a "real" FTP client, I've omitted many basic error checking routines to make it easier to explain, and you should consider this use-at-your-own-risk software if you decide to implement it in a live environment. And cigarette smoking causes cancer. You have been warned.

    The application code is separated across three different files:

    index.html - the log in screen

    actions.php4 - the code for all FTP transactions

    include.php4 - the main interface, which displays file listings and control buttons

    A complete code listing (with comments) is available at the end of the article - I'll simply be highlighting the important areas here.

    Let's begin at the top, with "index.html":

    <table border=0 align=center> <form action="actions.php4" method=post> <input type=hidden name=action value=CWD> <tr> <td> Server </td> <td> <input type=text name=server> </td> </tr> <tr> <td> User </td> <td> <input type=text name=username> </td> </tr> <tr> <td> Password </td> <td> <input type=password name=password> </td> </tr> <tr> <td colspan=2 align=center> <input type="submit" value="Beam Me Up, Scotty!"> </td> </tr> </form> </table>
    This is the log-in form, with fields for the FTP server name, the FTP user name and the password; these are stored in the variables $server, $username and $password respectively. Once the form is submitted, it calls the PHP script "actions.php4", which then takes over to initiate the FTP connection.

    Note the hidden field, which sends the directive "action=CWD" to "actions.php4" - you'll see what role this plays on the next page.

    This article copyright Melonfire 2000. All rights reserved.

    More PHP Articles
    More By Vikram Vaswani, (c) Melonfire


     

       

    PHP ARTICLES

    - Validating Web Forms with the Code Igniter P...
    - Output Buffering
    - Paginating Database Records with the Code Ig...
    - HTTP Headers in Web Development
    - Project Management: Administration
    - Building a Database-Driven Application with ...
    - User Authentication for a Project Management...
    - Introduction to the CodeIgniter PHP Framework
    - Adding Users for a Project Management Applic...
    - Migrating Class Code for a MIME Email to PHP...
    - Login and Logout Authentication for a Projec...
    - Composing Messages in HTML for MIME Email wi...
    - Project Management: Authentication
    - A Better Way to Determine MIME Types for MIM...
    - Project Management Overview





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway