note 72413 added to ref.ftp
| From: | admin at originxt dot com | Date: | Wed, 17 Jan 2007 22:46:15 +0000 |
| Subject: | note 72413 added to ref.ftp | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-121852@lists.php.net to get a copy of this message | ||
This code logs into $ftp_server with $ftp_user and $ftp_pass (change them!) and CHMODs all the files
and folders in $chmod_dir to $chmod_val. I used this to temporarily CHMOD all the files in my HTML
folder so I can run a PHP script editing them. Use it wisely and strategically to save time! I had
literally thousands of files to CHMOD and this did the job.
<!-- FTP-powered file-chmodder: see http://originxt.com/node/15528 --><ol><?php
$ftp_server = "ftp.originxt.com";
$ftp_user = "origin";
$ftp_pass = "---";
$chmod_dir = "/public_html/data";
$chmod_val = "0666";
// set up a connection or die
$conn_id = ftp_connect($ftp_server) or die("Couldn't connect to $ftp_server");
// try to login
if (@ftp_login($conn_id, $ftp_user, $ftp_pass))
{
$arr = ftp_nlist($conn_id, $chmod_dir);
foreach($arr as $k=>$v)
{
echo "<li>Successfully CHMOD'ed $chmod_dir/$v to $chmod_val</li>\n";
ftp_site($conn_id, "CHMOD $chmod_val $chmod_dir/$v");
}
}
else
{
echo "Couldn't connect as $ftp_user\n";
}
?></ol>
----
Server IP: 64.71.164.2
Probable Submitter: 67.164.66.46
----
Manual Page -- http://www.php.net/manual/en/ref.ftp.php
Edit -- https://master.php.net/note/edit/72413
Del: integrated -- https://master.php.net/note/delete/72413/integrated
Del: useless -- https://master.php.net/note/delete/72413/useless
Del: bad code -- https://master.php.net/note/delete/72413/bad+code
Del: spam -- https://master.php.net/note/delete/72413/spam
Del: non-english -- https://master.php.net/note/delete/72413/non-english
Del: in docs -- https://master.php.net/note/delete/72413/in+docs
Del: other reasons-- https://master.php.net/note/delete/72413
Reject -- https://master.php.net/note/reject/72413
Search -- https://master.php.net/manage/user-notes.php