home hardware prices news articles forums photos user reviews
Go Back   Tech Support Forums - TechIMO.com > PC Hardware and Tech > Webmastering and Programming
Ask a Tech Support Question (free)!

AH!! My PHP has gone insane!

Reply
Get bargains at  »  Dealighted.com
 
Thread Tools Search this Thread
Currently Active Users: 1168
Discussions: 200,929, Posts: 2,379,148, Members: 246,296
Old May 23rd, 2004, 08:55 PM   Digg it!   #1 (permalink)
Member
 
Join Date: May 2004
Posts: 184
Exclamation
AH!! My PHP has gone insane!

Can anyone tell me what's wrong with this code? It should display all folders within the main folder and it should be recursive.

function list_files ($root,$path_ext = "",$check_ext = "",$new_path_ext = "") {
$username = $GLOBALS["username"];
$dh = opendir("../users/$username");

while(false !== ($entry=readdir($dh))) {

if($entry != "." && $entry != ".." && is_dir($root.$path_ext.$new_path_ext."/".$entry)) {

$prev_path_ext = $new_path_ext;

if ($root == "../users/$username") {
echo "<span style='width: 10px;'></span><input type='radio' name='file' value='$root$new_path_ext/$entry'><img src='images/folder.jpg'><span style='width: 5px;'></span>$entry/<br>\n";
} else {
echo "<span style='width: ".(10 * $GLOBALS['level'])."px;'></span><input type='radio' name='file' value='$root$new_path_ext/$entry'><img src='images/folder.jpg'><span style='width: 5px;'></span>$entry/<br>\n";
}
$new_path_ext .= $entry;
$GLOBALS["level"] += 1;
list_files ($root."/".$new_path_ext, "", "", "");


} elseif($entry != "." && $entry != ".." && eregi("($check_ext)",$entry) && !is_dir($root.$path_ext.$new_path_ext."/".$entry)) {

if ($root != "../users/$username") {
echo "<span style='width: ".(10 * $GLOBALS['level'])."px;'></span><input type='radio' name='file' value='$root$new_path_ext/$entry'><img src='images/file.jpg'><span style='width: 10px'></span>$entry<br>\n";
} else {
echo "<span style='width: 10px;'></span><input type='radio' name='file' value='$root$new_path_ext/$entry'><img src='images/file.jpg'><span style='width: 10px'></span>$entry<br>\n";
}
}
}
closedir($dh);
}

Last edited by VillageIdiot906 : May 23rd, 2004 at 08:58 PM.
VillageIdiot906 is offline   Reply With Quote
Old May 23rd, 2004, 09:19 PM     #2 (permalink)
Senior Member
 
nochay's Avatar
 
Join Date: Aug 2002
Location: Las Vegas NV USA
Posts: 670
Send a message via ICQ to nochay Send a message via AIM to nochay Send a message via Yahoo to nochay
I tried it on my IIS 5.0 box, and just get a blank page. Nothing in my error logs either. does taking the .. out of the folder path do anything? what server software are you trying it on?

Dane
__________________
Back Online! http://rhd.dyndns.org <-- The History Site (Admin)
http://www.vegasfreecyclers.com/forum/index.php <---Moderator
nochay is offline   Reply With Quote
Old May 23rd, 2004, 09:38 PM     #3 (permalink)
Ultimate Member
 
willy_ph's Avatar
 
Join Date: Oct 2001
Location: Trent University
Posts: 2,414
I think nochay has targetted the problem. Nochay, it wouldn't work on your own system because it doesn't have the same directory structure.
willy_ph is offline   Reply With Quote
Old May 23rd, 2004, 09:51 PM     #4 (permalink)
Member
 
Join Date: May 2004
Posts: 184
Don't worry about the directories, these are based on my structure. I'm running Apache2 and I've already identified most of the problem. Because of the function within the function, only one folder was displayed. So don't worry about it anymore, I'll try to fix it.
VillageIdiot906 is offline   Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search

Similar Threads
Thread Thread Starter Forum Replies Last Post
new av, lookit JacobM5727 IMO Community 19 December 4th, 2003 01:45 PM
Windows "Longhorn" -no backwards compatibility? CMonster Applications and Operating Systems 48 March 5th, 2003 03:04 AM
just saying hello charmed IMO Community 16 February 13th, 2003 07:24 AM
PHP Help TaStiEzs Webmastering and Programming 11 August 25th, 2002 06:37 AM


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Most Active Discussions
Is It Just Me? (2868)
Obama the Muslim (14)
California Passes Anti-Flat-HDTV Le.. (39)
Is the PSU I received dead? (10)
windows vista security holes (9)
HIS HD5770 graphic card question (15)
Print spooler problem (13)
Foreign voltage (10)
Install XP pro and a Vista laptop ?.. (10)
Dept. of HS: NSA 'Helped' Develop V.. (15)
A good PSU? (10)
Ideal cheap graph card for PC-Gamin.. (16)
New Computer wont recognize XP disc (7)
EVGA 9800 gtx help with finding a g.. (8)
Recent Discussions
Regular Build (3)
solutions for virtical white lines on.. (0)
Ideal cheap graph card for PC-Gaming? (16)
Graphics Card Upgrade Question (0)
Fire in DVD (2)
Modern Warfare For the PC (33)
radeon x850xt platinum & shader 3 (3)
Have you switched yet? (84)
Install XP pro and a Vista laptop ?? (10)
Wireless Router+Cable Modems and Much.. (0)
Optical Audio A-B Switch (1)
windows vista security holes (9)
The NTDVM CPU has encountered an ille.. (24)
[F@H SPAM 11/16/09] ! 1/2 months to r.. (34)
Wireless speakers for PC? (11)
Print spooler problem (13)
Help getting around port 80 for camer.. (2)
Display shows 3x5 inch in middle of s.. (3)
monitor will not turn on at all, (1)
World's largest Monopoly Game using G.. (331)
Foreign voltage (10)
FiOS modem/router interfering with ne.. (7)
Browsers wont load websites (2)
Virus Doctor Popup? (1)
Dept. of HS: NSA 'Helped' Develop Vis.. (15)


All times are GMT -4. The time now is 05:01 AM.
TechIMO Copyright 2009 All Enthusiast, Inc.



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28