Archive | Php RSS feed for this section

Directory Lister

15 Apr

<?

/*

Change the path to your folder.

This must be the full path from the root of your
web space. If you’re not sure what it is, ask your host.

Name this file index.php and place in the directory.

*/

// Define the full path to your folder from root
$path = “/home/user/public/foldername/”;

// Open the folder
$dir_handle = @opendir($path) or die(“Unable to open $path”);

// Loop through the files
while ($file = readdir($dir_handle)) {

if($file == “.” || $file == “..” || $file == “index.php” )

continue;
echo “<a href=\”$file\”>$file</a><br />”;

}

// Close
closedir($dir_handle);

?>

Image To HTML Text Converter Class

15 Apr

<?php
/*
* Image to HTML Text Converter Class
* Version 1.5
*
* Copyright 2000 by Markus Dobel (mdobel@kawo2.rwth-aachen.de)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*
* Requirements: PHP with GD support for the desired image format
*
* Note: Tested with Netscape Communicator 4.7 (Linux, Windows)
* and MS Internet Explorer 5.0 (Windows)
* The only font-size which seems to work nicely with all of
* them at once is 12px. (with the default monospace font)
*
*
* Functions:
* LoadImage (string filename);
* LoadText (string filename);
* SetText (string text);
* ImageInfo ();
* PrintInfo ();
* PrintStylesheet ();
* PrintImage ();
*
* print a whole page with this function:
* PrintPage (string imagefilename, string textfilename);
*/

class HTMLImage {

/* background and font size */
var $stylesheet=”
<style type=\”text/css\”><!–
BODY {
background-color: #202020;
}
PRE {
font-family: monospace;
font-size: 12px;
}
//–></style>
“;

/* Do not set these variables */
var $image; // Image handle
var $imagetype; // Image type (numerical)
var $imageheight; // Dimensions of image
var $imagewidth;
var $text; // Text to print
var $textlength;

var $imagetypes=array(1=>”GIF”, 2=>”JPEG”, 3=>”PNG”);

function LoadImage($filename) {
/* Load Image, set type and size */
unset($this->imageheight);
unset($this->imagewidth);
unset($this->imagetype);
if (isset($this->image)) { ImageDestroy($this->image); }
unset($this->image);
if(is_readable($filename)) {
list($width,$height,$type)=GetImageSize($filename);
switch ($type) {
case 1:
case 2:
case 3:
if (function_exists(“ImageCreateFrom”.$this->imagetypes[$type])) {
$cleartype = $imagetypes[$type];
eval(“\$this->image=ImageCreateFrom”.$this->imagetypes[$type].”(\””.$filename.”\”);”);
$this->imageheight = $height;
$this->imagewidth = $width;
$this->imagetype = $type;
return(true);
} else {
print(“Warning: This version of PHP has no “.$this->imagetypes[$type].” Support<br>”);
return(false);
}
break;
default:
print(“Warning: Cannot determine image type of “.$filename.”\n”);
return(false);
}
} else {
print(“Warning: Cannot access “.$filename.”. (Does not exist or has wrong permissions)<br>”);
return(false);
}
}

function LoadText($filename) {
/* Load textfile into class, return true on success */
if(is_readable($filename)) {
$fp = fopen($filename,”r”);
$text = fread($fp,filesize($filename));
fclose($fp);
return($this->SetText($text));
} else {
print(“Warning: Cannot access “.$filename.”. (Does not exist or has wrong permissions)<br>”);
return(false);
}
}

function SetText($text) {
/* Set text from a variable, return true on success */
$text=preg_replace(“/\s+/”,””,$text);
$len=strlen($text);
if($len>0) {
$this->text=$text;
return(true);
} else {
unset($this->text);
print(“Warning: Text contains no printable characters<br>”);
return(false);
}
}

function PixColortoHTML($img, $x, $y) {
/* internal function to get the HTML color code for a pixel */
$rgb=imagecolorsforindex($img,imagecolorat($img,(int)$x,(int)$y));
return(sprintf(“#%02x%02x%02x”,$rgb[“red”],$rgb[“green”],$rgb[“blue”]));
}

function ImageInfo() {
if(isset($this->image)){
return($this->imagetypes[$this->imagetype].” Image (“.$this->imagewidth . “x” . $this->imageheight.” pixels)”);
} else {
return(“No image loaded”);
}
}

function PrintInfo() {
print($this->ImageInfo());
}

function PrintStylesheet() {
print($this->stylesheet);
}

function PrintImage() {
/* print image block */
/* check for existance of image and text */

if(isset($this->image) and isset($this->text)) {
/*
* Create rescaled version of the image for text output.
* Rendering the image unscaled in monospace font ends up
* with a very ugly aspect ratio.
*/
$newheight=(int)($this->imageheight * 0.5);
$scaledimg=ImageCreate($this->imagewidth,$newheight);

ImageCopyResized($scaledimg, $this->image,0,0,0,0,$this->imagewidth,$newheight,$this->imagewidth,$this->imageheight);
$pixelcount=$this->imagewidth*$newheight;
$len=strlen($this->text);
$i = 1;

/* Calculation and output of first pixel */
$oldcol=$this->PixColortoHTML($scaledimg,0,0);
print(“<pre><font color=”.$oldcol.”>”);
print(htmlspecialchars($this->text[0]));

/* Calculate and output the remaining image in a loop */
while($i<$pixelcount) {
$curcol=$this->PixColortoHTML($scaledimg,$i%$this->imagewidth,$i/$this->imagewidth);
if ($oldcol!=$curcol) {
print(“</font><font color=”.$curcol.”>”);
}
print(htmlspecialchars($this->text[$i%$len]));
$i++;
if($i%$this->imagewidth==0) {
print(“\n”);
@set_time_limit(1);
}
$oldcol=$curcol;
}
print(“</font></pre>\n”);
ImageDestroy($scaledimg);
}
}

function PrintPage($imgfile,$textfile) {
if($this->LoadImage($imgfile) and $this->LoadText($textfile)) {
print(“<html><head><title>”);
$this->PrintInfo();
print(“</title>”);
$this->PrintStylesheet();
print(“</head><body>”);
$this->PrintImage();
print(“</body></html>”);
}
}
}
?>

Dynamic Image Rotation

15 Apr

<script language=”php”>
// =============================================================
// Script: Image Rotation Script
// With Adjustable Timing and Unlimited Images
// Utilizes META REFRESH
// Function: Displays random images continuously in a slideshow
// presentation format
// PHP ver: 3.x, 4.x
// Author: Jarrod Major
// Email: jarrod@nucleus.com
// Copyright: (C)2001 Nucleus Information Service Inc.
// Licence: Free, drop me a line letting me know where you
// used the script. Please keep this header attached.
// =============================================================
// Disclaimer:
// Use of this code is at the programmer’s own risk. Damage
// to any property as a result of the script’s use is the sole
// responsibility of the programmer, no blame shall be laid on
// the author of this script or his employer.
// =============================================================

function rotate_images()
{
// open directory, images must be in a separate directory
$dir_pointer = dir( “pic” );

// make an array of filenames
while( $entryName = $dir_pointer->read() )
{
// don’t include parent/current directory listing /. /..
if( !ereg( “^\.”, $entryName ) )
$file_array[] = $entryName;

// could be done this way to simplify some code below
# $file_array[] = “directory_name/$entryName”;
}

// close directory
$dir_pointer->close();

$count_array = count( $file_array ) – 1;

// intialize random seed
srand( time() );

// get a random index number to pull from array
$random_no = rand( 0, $count_array );

// make a file pointer
$file_name = “directory_name/$file_array[$random_no]”;

// or if directory added to array element
#$file_name = $file_array[$random_no];

// get image dimensions
$image_size = getimagesize( $file_name );

// create dynamic image tag
$out = sprintf( ‘<img src=”%s” %s alt=”image.” />%s’, $file_name, $image_size[3], “\n” );

return $out;
}
</script>
<html>
<head>
<!– to adjust timing change ‘content’ value below –>
<meta http-equiv=”Refresh” content=”3″ />
<title>Test Image shuffler</title>
</head>
<body>
<?php print rotate_images(); ?>
</body>
</html>

Delete data from a mysql database

15 Apr

/*
Change the first line to whatever
you use to connect to the database.

Change tablename to the name of your
database table.

This example would delete a row from
a table based on the id of the row.
You can change this to whatever you
want.

*/

// Your database connection code
db_connect();

$query = “DELETE FROM tablename WHERE id = (‘$id’)”;

$result = mysql_query($query);

echo “The data has been deleted.”;

?>

Add data to a mysql database

15 Apr

<?php

/*
Change the first line to whatever
you use to connect to the database.

We’re using two values, title and
text. Replace these with whatever
you want to add to the database.

Finally, change tablename to the
name of your table.

*/

// Your database connection code
db_connect();

$query = “INSERT INTO tablename(title, text) VALUES(‘$title’,’$text’)”;

$result = mysql_query($query);

echo “The data has been added to the database.”;

?>

Connect to a MySQL database

15 Apr

<?php

/*
Edit the database settings to your own.
To use, just include the function and
call it using <?php db_connect(); ?>

You can then do your database queries
*/

// Edit your database settings
$db_host = “localhost”;
$db_user = “username”;
$db_pass = “password”;
$db_name = “databasename”;

function db_connect() {
global $db_host;
global $db_user;
global $db_pass;
global $db_name;
$connection = mysql_connect($db_host,$db_user,$db_pass);
if (!(mysql_select_db($db_name,$connection))) {
echo “Could not connect to the database”;
}
return $connection;
}

?>

Ftp

15 Apr

This is a a simple Web-based FTP client implemented in PHP. It supports file transfers, directory navigation, and directory creation. Version 2.2 incorporates a MAJOR security fix. Upgrade immediately.

<?php

/* $Id: ftp.php,v 2.2 2002/03/12 23:21:28 pauls Exp $ */

/* This software came from http://inebria.com/ */

/* Copyright (c) 2000
Paul Southworth. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. The name of the author may not be used to endorse or promote
products derived from this software without specific prior
written permission.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR “AS IS” AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */

/* Configuration Options */

$phpftp_host=”localhost”;
$phpftp_version=”2.2″;

/* Comment this out if you don’t want the version footer */

$show_version_footer=1;

/* How large a file will you accept? You may also need to edit your
php.ini file and change upload_max_filesize appropriately */

$max_file_size=”1000000″;

/* The temporary directory $phpftp_tmpdir must exist and be writable
by your web server.
Hint: mkdir /var/tmp/xfers && chmod 1777 /var/tmp/xfers */

$phpftp_tmpdir=”/var/tmp/xfers”;

/* $use_mime_lookup
Turning this on creates a dependency upon the
http://www.inebria.com/mime_lookup/ MIME type lookup library.
Setting this variable to “1” enables it. “0” disables.
If you turn it on, put the mime_lookup.php file in the same directory
as ftp.php and uncomment the ‘include(“mime_lookup.php”);’ statement. */

$use_mime_lookup=”0″;
/* include(“mime_lookup.php”); */

/* We enclose the top and bottom in functions because sometimes
we might not send them (ie, in a file-download situation) */

function phpftp_top() {
global $phpftp_version;
?>
<!– function phpftp_top –>
<html>
<head>
<title>PHP FTP Client <?php echo $phpftp_version; ?></title>
</head>
<body bgcolor=”#ffffff”>
<?php
}

function phpftp_bottom() {
global $phpftp_version;
global $show_version_footer;
?>
<!– function phpftp_bottom –>
<?php
if (isset($show_version_footer)) {
?>
<p><font size=-2>This is <a href=”http://inebria.com/phpftp/”>PHP FTP</a>
version <?php echo $phpftp_version; ?></font></p>
<?php
}
?>
</body>
</html>
<?php
}

/* This is the form used for initially collecting username/passwd */

function phpftp_login() {
phpftp_top();
?>
<!– function phpftp_login –>
<p>
<form action=”ftp.php” method=post>
<p><table border=0>
<tr><td>
Login:
</td><td>
<input name=”phpftp_user” type=”text”>
</td></tr>
<tr><td>
Password:
</td><td>
<input name=”phpftp_passwd” type=”password”>
</td></tr>
<tr><td>
Directory:
</td><td>
<input name=”phpftp_dir” type=”text”>
</td></tr>
</table>
</p><p>
<input type=”hidden” name=”function” value=”dir”>
<input type=”submit” value=”connect”>
</p>
</form>
<p>
<?php
phpftp_bottom();
}

/* This function does not return TRUE/FALSE – it returns the value of
$ftp, the current FTP stream. */

function phpftp_connect($phpftp_user,$phpftp_passwd) {
global $phpftp_host;
$ftp = ftp_connect($phpftp_host);
if ($ftp) {
if (ftp_login($ftp,$phpftp_user,urldecode($phpftp_passwd))) {
return $ftp;
}
}
}

function phpftp_list($phpftp_user,$phpftp_passwd,$phpftp_dir) {
global $phpftp_host;
phpftp_top();
?>
<!– function phpftp_list –>
<?php
$ftp = @phpftp_connect($phpftp_user,$phpftp_passwd);
if (!$ftp) {
?>
<strong>FTP login failed!</strong>
<a href=”ftp.php”>Start over?</a>
<?php
phpftp_bottom();
} else {
if (!$phpftp_dir) {
$phpftp_dir=ftp_pwd($ftp);
}
if (!@ftp_chdir($ftp,$phpftp_dir)) {
?>
<font color=”#ff0000″><strong>Can’t enter that directory!</strong></font><p><p>
<?php
$phpftp_dir=ftp_pwd($ftp);
}
echo “<strong>Current host:</strong> ” . $phpftp_host . “<br>\n”;
echo “<strong>Current directory:</strong> ” . $phpftp_dir . “<br>\n”;
if ($phpftp_dir == “/”) {
$phpftp_dir=””;
}

if ($contents = ftp_rawlist($ftp,””)) {
$d_i=0;
$f_i=0;
$l_i=0;
$i=0;
while ($contents[$i]) {
$item[] = split(“[ ]+”,$contents[$i],9);
$item_type=substr($item[$i][0],0,1);
if ($item_type == “d”) {
/* it’s a directory */
$nlist_dirs[$d_i]=$item[$i][8];
$d_i++;
} elseif ($item_type == “l”) {
/* it’s a symlink */
$nlist_links[$l_i]=$item[$i][8];
$l_i++;
} elseif ($item_type == “-“) {
/* it’s a file */
$nlist_files[$f_i]=$item[$i][8];
$nlist_filesize[$f_i]=$item[$i][4];
$f_i++;
} elseif ($item_type == “+”) {
/* it’s something on an anonftp server */
$eplf=split(“,”,implode(” “,$item[$i]),5);
if ($eplf[2] == “r”) {
/* it’s a file */
$nlist_files[$f_i]=trim($eplf[4]);
$nlist_filesize[$f_i]=substr($eplf[3],1);
$f_i++;
} elseif ($eplf[2] == “/”) {
/* it’s a directory */
$nlist_dirs[$d_i]=trim($eplf[3]);
$d_i++;
}
} /* ignore all others */
$i++;
}
?>
<table border=0 cellspacing=20>
<?php
if (count($nlist_dirs)>0) {
?>
<tr><td align=left valign=top>
<strong>Directories</strong><br>
<form action=”ftp.php” method=post>
<input type=”hidden” name=”function” value=”cd”>
<input type=”hidden” name=”phpftp_user” value=”<?php echo $phpftp_user; ?>”>
<input type=”hidden” name=”phpftp_passwd” value=”<?php echo $phpftp_passwd; ?>”>
<input type=”hidden” name=”phpftp_dir” value=”<?php echo $phpftp_dir; ?>”>
<select name=”select_directory” size=”10″ width=”100″>
<?php
for ($i=0; $i < count($nlist_dirs); $i++) {
echo “<option value=\”” . $nlist_dirs[$i] . “\”>” . $nlist_dirs[$i] . “</option>\n”;
}
?>
</select><br>
<input type=”submit” value=”Enter Directory”>
</form>
</td>
<?php
}

if (count($nlist_files)>0) {
?>
<td align=left valign=top>
<strong>Files</strong><br>
<form action=”ftp.php” method=post>
<input type=”hidden” name=”function” value=”get”>
<input type=”hidden” name=”phpftp_user” value=”<?php echo $phpftp_user; ?>”>
<input type=”hidden” name=”phpftp_passwd” value=”<?php echo $phpftp_passwd; ?>”>
<input type=”hidden” name=”phpftp_dir” value=”<?php echo $phpftp_dir; ?>”>
<select name=”select_file” size=”10″>
<?php
for ($i=0; $i < count($nlist_files); $i++) {
echo “<option value=\”” . $nlist_files[$i] . “\”>” . $nlist_files[$i] .” ($nlist_filesize[$i] bytes)”. “</option>\n”;
}
?>
</select><br>
<input type=”submit” value=”Download File”>
</form>
</td></tr>
<?php
}
} else {
?>
<p><font color=”#ff0000″><strong>Directory empty or not readable</strong></font><p>
<?php
}
?>
</table>
<p>
<form action=”ftp.php” method=post>
<?php
$cdup=dirname($phpftp_dir);
if ($cdup == “”) {
$cdup=”/”;
}
?>
<input type=”hidden” name=”function” value=”dir”>
<input type=”hidden” name=”phpftp_user” value=”<?php echo $phpftp_user; ?>”>
<input type=”hidden” name=”phpftp_passwd” value=”<?php echo $phpftp_passwd; ?>”>
<input type=”hidden” name=”phpftp_dir” value=”<?php echo $cdup; ?>”>
<input type=”submit” value=”Go up one directory”>
</form>
<p>
<form enctype=”multipart/form-data” action=”ftp.php” method=post>
<input type=”hidden” name=”max_file_size” value=”<?php echo $max_file_size ?>”>
<input type=”hidden” name=”phpftp_user” value=”<?php echo $phpftp_user; ?>”>
<input type=”hidden” name=”phpftp_passwd” value=”<?php echo $phpftp_passwd; ?>”>
<input type=”hidden” name=”phpftp_dir” value=”<?php echo $phpftp_dir; ?>”>
<input type=”hidden” name=”function” value=”put”>
<input type=”submit” value=”Upload this:”>
<input name=”userfile” type=”file”>
</form>
<p>
<form action=”ftp.php” method=post>
<input type=”hidden” name=”function” value=”mkdir”>
<input type=”hidden” name=”phpftp_user” value=”<?php echo $phpftp_user; ?>”>
<input type=”hidden” name=”phpftp_passwd” value=”<?php echo $phpftp_passwd; ?>”>
<input type=”hidden” name=”phpftp_dir” value=”<?php echo $phpftp_dir; ?>”>
<input type=”submit” value=”Make subdirectory:”>
<input name=”new_dir” type=”text”>
<?php
ftp_quit($ftp);
phpftp_bottom();
}
}

function phpftp_cd($phpftp_user,$phpftp_passwd,$phpftp_dir,$select_directory) {
?>
<!– function phpftp_cd –>
<?php
$new_directory=$phpftp_dir . “/” . $select_directory;
phpftp_list($phpftp_user,$phpftp_passwd,$new_directory);
}

function phpftp_mkdir($phpftp_user,$phpftp_passwd,$phpftp_dir,$new_dir) {
?>
<!– function phpftp_mkdir –>
<?php
$ftp = @phpftp_connect($phpftp_user,$phpftp_passwd);
if ($phpftp_dir == “”) {
$phpftp_dir=”/”;
}
if (!$ftp) {
@ftp_quit($ftp);
phpftp_top();
?>
<font color=”#ff0000″><strong>FTP login failed!</strong></font><p><p>
<a href=”ftp.php”>Start over?</a>
<?php
phpftp_bottom();
} else {
$dir_path = $phpftp_dir . “/” . $new_dir;
@ftp_mkdir($ftp,$dir_path);
@ftp_quit($ftp);
phpftp_list($phpftp_user,$phpftp_passwd,$phpftp_dir);
}
};

function phpftp_get($phpftp_user,$phpftp_passwd,$phpftp_dir,$select_file) {
$ftp = @phpftp_connect($phpftp_user,$phpftp_passwd);
if ($phpftp_dir == “”) {
$phpftp_dir=”/”;
}
if ((!$ftp) || (!@ftp_chdir($ftp,$phpftp_dir))) {
@ftp_quit($ftp);
phpftp_top();
?>
<font color=”#ff0000″><strong>FTP login failed!</strong></font><p><p>
<a href=”ftp.php”>Start over?</a>
<?php
phpftp_bottom();
} else {
srand((double)microtime()*1000000);
$randval = rand();
$tmpfile=$phpftp_tmpdir . “/” . $select_file . “.” . $randval;
if (!ftp_get($ftp,$tmpfile,$select_file,FTP_BINARY)) {
ftp_quit($ftp);
phpftp_top();
?>
<font color=”#ff0000″><strong>FTP get failed!</strong></font><p><p>
<a href=”ftp.php”>Start over?</a>
<?php
phpftp_bottom();
} else {
ftp_quit($ftp);
global $use_mime_lookup;
if ($use_mime_lookup == “1”) {
$file_mime_type=mime_lookup(substr(strrchr($select_file,”.”),1));
}
if (!$file_mime_type) {
$file_mime_type=”application/octet-stream”;
}
header(“Content-Type: ” . $file_mime_type);
header(“Content-Disposition: attachment; filename=” . $select_file);
readfile($tmpfile);
}
@unlink($tmpfile);
}
}

function phpftp_put($phpftp_user,$phpftp_passwd,$phpftp_dir,$userfile,$userfile_name) {
srand((double)microtime()*1000000);
$randval = rand();
$tmpfile=$phpftp_tmpdir . “/” . $userfile_name . “.” . $randval;
if (!@move_uploaded_file($userfile,$tmpfile)) {
phpftp_top();
?>
<font color=”#ff0000″><strong>Upload failed! Can’t create temp file?</strong></font>
<p><p>
<a href=”ftp.php”>Start over?</a>
<?php
phpftp_bottom();
} else {
if (!$ftp = @phpftp_connect($phpftp_user,$phpftp_passwd)) {
unlink($tmpfile);
phpftp_top();
?>
<font color=”#ff0000″><strong>FTP login failed!</strong></font><p><p>
<a href=”ftp.php”>Start over?</a>
<?php
phpftp_bottom();
} else {
ftp_chdir($ftp,$phpftp_dir);
ftp_put($ftp,$userfile_name,$tmpfile,FTP_BINARY);
ftp_quit($ftp);
unlink($tmpfile);
phpftp_list($phpftp_user,$phpftp_passwd,$phpftp_dir);
}
}
}

switch($function) {
case “dir”;
phpftp_list($phpftp_user,$phpftp_passwd,$phpftp_dir);
break;
case “cd”;
phpftp_cd($phpftp_user,$phpftp_passwd,$phpftp_dir,$select_directory);
break;
case “get”;
phpftp_get($phpftp_user,$phpftp_passwd,$phpftp_dir,$select_file);
break;
case “put”;
phpftp_put($phpftp_user,$phpftp_passwd,$phpftp_dir,$userfile,$userfile_name);
break;
case “mkdir”;
phpftp_mkdir($phpftp_user,$phpftp_passwd,$phpftp_dir,$new_dir);
break;
case “”;
phpftp_login();
break;
}

?>