note 83211 added to function.opendir
| From: | info at myweb dot lu | Date: | Thu, 15 May 2008 15:01:23 +0000 |
| Subject: | note 83211 added to function.opendir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-139409@lists.php.net to get a copy of this message | ||
Read a Windows SMB Directory ;)
<?
function SMBMap($username, $password, $server, $dir) {
$command = "mount -t smbfs -o username=$username,password=$password //$server/$dir
/mnt/tmp";
echo system($command);
}
function SMBRelease() {
$command = "umount /mnt/tmp";
echo system($command);
}
function GetFiles($dir) {
$files = array();
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
while (($file = readdir($dh)) !== false) {
$files[] = $file."{".filetype("$dir/$file")."}";
}
closedir($dh);
}
}
return $files;
}
SMBMap("Daniel", "", "10.0.0.2", "Kram");
$any = GetFiles("/mnt/tmp");
SMBRelease();
print_r($any);
?>
----
Server IP: 212.124.37.9
Probable Submitter: 85.93.192.161
----
Manual Page -- http://www.php.net/manual/en/function.opendir.php
Edit -- https://master.php.net/note/edit/83211
Del: integrated -- https://master.php.net/note/delete/83211/integrated
Del: useless -- https://master.php.net/note/delete/83211/useless
Del: bad code -- https://master.php.net/note/delete/83211/bad+code
Del: spam -- https://master.php.net/note/delete/83211/spam
Del: non-english -- https://master.php.net/note/delete/83211/non-english
Del: in docs -- https://master.php.net/note/delete/83211/in+docs
Del: other reasons-- https://master.php.net/note/delete/83211
Reject -- https://master.php.net/note/reject/83211
Search -- https://master.php.net/manage/user-notes.php