查看: 1438|回复: 8
|
PHP+IIS文件系统浏览问题
[复制链接]
|
|
各位PHP达人:
这里有两个PHP的难题,在google找了几天都找不到一个满意的答案,所以想来这里请教。我的系统是 PHP5+IIS 5
1。请问PHP能浏览IIS server根目录以外的文件系统吗?我写了一个file browsing的功能,不过opendir只能够在根目录里生效,不过如果是根目录以外或virtual directory都没有办法打开。总之在根目录里可以为所欲为,不过以外或根目录里的virtual directory就有问题了。有什么设定可以除掉这些限制?(当然,安全问题暂时不考虑)。
2。也是文件系统问题,我在根目录里创建了一个A文件夹然后再里面放了一个文件fileA,然后在A里面再创建了一个副文件夹B。当我用opendir时,发现到return回来的只有fileA,PHP找不到文件夹B。之后有尝试reset该文件夹的安全设定,不过没用,还是只能return file-level的文件。。请问谁有碰过这个问题?
[ 本帖最后由 苦瓜汤 于 24-10-2005 05:08 PM 编辑 ] |
|
|
|
|
|
|
|
发表于 25-10-2005 12:22 AM
|
显示全部楼层
试过了 php 的 example,
$dir = "../../../windows/system32";
$dir = "c:/windows/system32";
$dir = "d:/bak";
都可以读到里面的 file / folders
以下是从 php help file copy & paste 来的。
- <?php
- $dir = "../../../windows/system32";
- $dir = "c:/windows/system32";
- $dir = "d:/bak";
- // Open a known directory, and proceed to read its contents
- if (is_dir($dir)) {
- if ($dh = opendir($dir)) {
- while (($file = readdir($dh)) !== false) {
- echo "filename: $file : filetype: " . filetype($dir . $file) . "\n<br>";
- }
- closedir($dh);
- }
- }
- ?>
复制代码 |
|
|
|
|
|
|
|
发表于 25-10-2005 12:52 AM
|
显示全部楼层
WIDDOW 缺乏了像 LINUX 般的SYMLINK. |
|
|
|
|
|
|
|
发表于 25-10-2005 01:08 AM
|
显示全部楼层
原帖由 exiang 于 25-10-2005 12:52 AM 发表
WIDDOW 缺乏了像 LINUX 般的SYMLINK.
的确,用 shortcut 不能当作 symlink 那样使用。 |
|
|
|
|
|
|
|
发表于 25-10-2005 01:40 AM
|
显示全部楼层
Configure PHP with MySQL
<?php
//connect to the database server, remember to edit the username and password
$db = mysql_connect("localhost", "root", "password");
//report the connection failure or success
if (!$db) {
echo "There was a problem connecting to the database.";
exit;
}
if ($db) {
echo "Database connection successfully!";
exit;
}
?>
请问要改去什么username和password! |
|
|
|
|
|
|
|

楼主 |
发表于 25-10-2005 08:43 AM
|
显示全部楼层
原帖由 flashang 于 25-10-2005 12:22 AM 发表
试过了 php 的 example,
$dir = "../../../windows/system32";
$dir = "c:/windows/system32";
$dir = "d:/bak";
都可以读到里面的 file / folders
以下是从 php help ...
我用的方法和例子里面的是一样的,不过就是出现了这些奇奇怪怪的问题。
等我回家后在试试看。多谢了
[ 本帖最后由 苦瓜汤 于 25-10-2005 08:50 AM 编辑 ] |
|
|
|
|
|
|
|

楼主 |
发表于 25-10-2005 08:45 AM
|
显示全部楼层
原帖由 CHiA 于 25-10-2005 01:40 AM 发表
<?php
//connect to the database server, remember to edit the username and password
$db = mysql_connect("localhost", " ...
什么跟什么?? 为什么突然飚出一个问题????
不就是mysql数据库的username和password嘛 |
|
|
|
|
|
|
|
发表于 25-10-2005 01:02 PM
|
显示全部楼层
原帖由 苦瓜汤 于 25-10-2005 08:45 AM 发表
什么跟什么?? 为什么突然飚出一个问题????
不就是mysql数据库的username和password嘛
那是我configure php和mysql时最后一个步骤,可是我没有setting过什么username和password,我test mysql php时,它跑去第一个if statement,很奇怪。
你知道我们可不可以在localhost试email function吗?
mail(.....);
不成功哦,哈...要继续找solution... |
|
|
|
|
|
|
|
发表于 25-10-2005 03:47 PM
|
显示全部楼层
原帖由 CHiA 于 25-10-2005 01:02 PM 发表
那是我configure php和mysql时最后一个步骤,可是我没有setting过什么username和password,我test mysql php时,它跑去第一个if statement,很奇怪。
你知道我们可不可以在localhost试email function吗?
...
请参考MySQL Manual for setting the user and password.
暂时用 :
$db=mysql_connect("localhost","","");
....
mail function need set the 'sendmail' program |
|
|
|
|
|
|
| |
本周最热论坛帖子
|