Jump to content

hellonoko

Members
  • Posts

    213
  • Joined

  • Last visited

Everything posted by hellonoko

  1. All better. Talked to someone on the server and now it works. Not sure what would cause it but something in with PHP not my code. Thanks!
  2. Doesn't breaking out PHP in a loop typically mess things up? Try echo "<img src="/images/userprofiles/".$Image." width="150px" height="200px">"; Maybe? Maybe I am way off.
  3. I wondered about that. In the index.php it is checkLoggedIn() and in the actual function it is checkLoggedIn() It is correct and identical in both places. Why would PHP error reporting be showing it as all lower case?
  4. I am receiving the following error: Fatal error: Call to undefined function checkloggedin() in /home2/sharingi/public_html/REPOSITORY/index.php on line 7 checkLoggedIn() is included in a config.php file that is included on line 6 and is defined. I made no changes to this previously working script. Any ideas?
  5. Corbin Thanks! Works. Must be something to do with my host.
  6. When I take out the if (is_dir) statment in this code it echo's the directories. When I put it in to check if they are directories it only display . and .. <?php $users_directory = "/home2/sharingi/public_html/subdomains"; if ($dir_handle = opendir($users_directory)) { while (false !== ($file = readdir($dir_handle))) { if( is_dir($file) ) { echo $file; echo "<br>"; } } } closedir($dir_handle); ?>
  7. My below code displays a directory contents listing. I am trying to make it separate the files into blocks based on the day value of the modified date of the file. While looping through the files. If the date of the last file displayed is different than the current file the script inserts a second <br> For some reason though I can not get it to put the double breaks in the correct place. http://www.sharingizcaring.com/REPOSITORY/ <?php include '../menu.php'; echo '<br>'; include '../count2.php'; $arr = array(); foreach (glob("*.*") as $filename) { $arr[$filename] = filemtime($filename); //echo $filename . " was last modified on " . date('M d Y, h:i:m', filemtime($filename)) . "<br>"; } /// //asort($arr); //echo "<br>"; //foreach($arr as $key => $value) //{ // echo "$key was last modified on " . date('M d Y, h:i:m', $value) . "<br>"; //} /// arsort($arr); echo "<br>"; $olddate = 0; foreach($arr as $key => $value) { if ( $key !== "filelist3.php" && $key !== "index.php" ) { echo $date = date("d", filemtime($key)); if ( $date !== $olddate ) { echo "<br><br>"; } else { echo "<br>"; } print "<object type=\"application/x-shockwave-flash\" data=\"http://www.sharingizcaring.com/button/musicplayer.swf?&song_url=http://www.sharingizcaring.com/REPOSITORY/$key&b_colors=,,ff0000,&\" width=\"17\" height=\"17\""; print "<param name=\"movie\" value=\"http://www.sharingizcaring.com/button/musicplayer.swf?&song_url=http://www.sharingizcaring.com/REPOSITORY/$key&b_colors=,,ff0000,&\"</object>"; //print "<img src=\"noflash.gif\" width=\"17\" height=\"17\" alt=\"\" />"; print "<span class=small_font><a href=\"http://www.sharingizcaring.com/REPOSITORY/$key\" class=".color()."> $key</a></span>"; $olddate = $date; //echo "<br>"; } } function color() { $color = rand( 1,7); if ($color == 1) { return "red"; } if ($color == 2) { return "green"; } if ($color == 3) { return "blue"; } if ($color == 4) { return "yellow"; } if ($color == 5) { return "babyblue"; } if ($color == 6) { return "purple"; } if ($color == 7) { return "grey"; } } ?> </body> </html>
  8. I have a simple script that list a directories contents. I am trying to cause it to insert double <br> tags whenever it detects files of a different day. Thus grouping the files by day modified. $olddate = 0; foreach($arr as $key => $value) { if ( $key !== "filelist3.php" && $key !== "index.php" ) { print "<object type=\"application/x-shockwave-flash\" data=\"http://www.sharingizcaring.com/button/musicplayer.swf?&song_url=http://www.sharingizcaring.com/REPOSITORY/$key&b_colors=,,ff0000,&\" width=\"17\" height=\"17\""; print "<param name=\"movie\" value=\"http://www.sharingizcaring.com/button/musicplayer.swf?&song_url=http://www.sharingizcaring.com/REPOSITORY/$key&b_colors=,,ff0000,&\"</object>"; //print "<img src=\"noflash.gif\" width=\"17\" height=\"17\" alt=\"\" />"; print "<span class=small_font><a href=\"http://www.sharingizcaring.com/REPOSITORY/$key\" class=".color()."> $key</a></span>"; echo $date = date("d", filemtime($key)); echo "<br>"; if ( $date !== $olddate && $olddate !== 0 ) { echo "<br>"; } $olddate = $date; } } It compares the modified day of the current file to that of the last one and if it finds a difference it causes a second <br> For some reason I can't get the second <br> to appear in the correct spot though. It is always one line too low. http://www.sharingizcaring.com/REPOSITORY/ Any ideas?
  9. Haha thought you might have meant those. Thanks.
  10. DarkWater: What? No it would/did fail. Wildteen88: WORKS! Thanks so much. Single quotes = don't parse right? Ken: thanks also!
  11. After I cleaned up some quotes... <?php $dir = "/home2/sharingi/public_html/subdomains"; $dh = opendir($dir); while (false !== ($filename = readdir($dh))) { if ($filename !== "." && $filename !== "..") { $files['$filename'] = count(glob("/home2/sharingi/public_html/subdomains/" . $filename . "/filez/" . "*.mp3")); } } ksort($files); foreach($files as $file => $count) echo $file . ":" . $count . "<br>"; ?> Returns $filename:2 Thats all. ?
  12. Returns r: r r I have tried similar for each loops with no success. Am I entering my data into my array correctly? In the code above that part where I echo each piece of data as it is entered it displays correctly. -ian
  13. My script below enters the name of a directory and the count of its contents into an array. I think I captures the information correctly. However I am not sure how to get it to echo it back out. <?php $dir = "/home2/sharingi/public_html/subdomains"; $dh = opendir($dir); while (false !== ($filename = readdir($dh))) { if ($filename !== "." && $filename !== "..") { $files['name'] = $filename; $files['count'] = count(glob("/home2/sharingi/public_html/subdomains/" . $filename . "/filez/" . "*.mp3")); echo $files['name']; echo '<br>'; echo $files['count']; echo '<br>'; } } Basically I am trying display a sorted list of the directories and their count. Folder1 10 Folder2 6 Folder3 2 Thanks, ian
  14. I think I see how this works but isn't it still going to not work for me since I need a count of files not the size. If use A had 10 files all totaling 1meg and user B had 2 files each 10megs then I still need to sort user A first. Here is my newest code that reads all the info into an array. I think it works correct but I am not sure how to get it to display the info. <?php $dir = "/home2/sharingi/public_html/subdomains"; $dh = opendir($dir); while (false !== ($filename = readdir($dh))) { if ($filename !== "." && $filename !== "..") { $files['name'] = $filename; $files['count'] = count(glob("/home2/sharingi/public_html/subdomains/" . $filename . "/filez/" . "*.mp3")); echo $files['name']; echo '<br>'; echo $files['count']; echo '<br>'; } }
  15. no idea how this works but returns: () /home2/sharingi/public_html/subdomains/raphael/cgi-bin (4) /home2/sharingi/public_html/subdomains/raphael/tmp (4) /home2/sharingi/public_html/subdomains/iana/cgi-bin (4) /home2/sharingi/public_html/subdomains/test/tmp (4) /home2/sharingi/public_html/subdomains/iana/tmp (4) /home2/sharingi/public_html/subdomains/test/cgi-bin (4) /home2/sharingi/public_html/subdomains/iana/filez (4264) /home2/sharingi/public_html/subdomains/iana (4304) /home2/sharingi/public_html/subdomains/raphael/filez (14692) /home2/sharingi/public_html/subdomains/raphael (14732) /home2/sharingi/public_html/subdomains/test/filez (131628) /home2/sharingi/public_html/subdomains/test (131668) /home2/sharingi/public_html/subdomains (150708) was hoping for something more like. test 13 raphael 2 iana 1
  16. I am trying to display a list of directories an the count of their file contents sorted by volume. Have been playing around with a few things but I can't quite get it to work. <?php $dir = "/home2/sharingi/public_html/subdomains"; $dh = opendir($dir); while (false !== ($filename = readdir($dh))) { if ($filename !== "." && $filename !== "..") { //$files[] = $filename; //$files[] = count(glob("/home2/sharingi/public_html/subdomains/" . $filename . "/filez/" . "*.mp3")); $files['user'][$x] = $filename; $files['count'][$x] = $files[] = count(glob("/home2/sharingi/public_html/subdomains/" . $filename . "/filez/" . "*.mp3")); $x++; } } sort ($files); //for $i = 0; $i < sizeof($files); $i++; //{ // echo $files['user'][$value]; // echo '<br>'; // echo $files['count'][$value]; // echo '<br>'; // i++; //} foreach ( $files as $value) { echo $files['user'][$value]; echo '<br>'; echo $files['count'][$value]; echo '<br>'; } //unset $value; //print_r($files); ?> Any suggestions?
  17. I have a directory /subdomains/ And inside of that directory is a user folder /mike/ /bob/ /tim/ etc. I have written a simple scrip to count the files inside the user folder: <?php session_start(); echo "<title>count</title>"; $dir = "subdomains/" . $_SESSION['login'] . "/filez/"; $count = count(glob($dir . "*.mp3")); echo $_SESSION['login']; echo '<br>'; echo $count; ?> What I am now trying to do is put this script inside a script that can go through each directory and count the number of files and then sort them by most to least. So I can return: Mike 10 Bob 8 Jim 5 and so on. I think I need to place it all in a loop that places each directory count into a array as it goes through the directories in /subdomains/ but I am not sure how to work with directories in that way. Thanks in advance, ian
  18. Ahh. I see how it works now but it still only works for one processing of the loop and does not display the file name http://www.sharingizcaring.com/filelist3.php
  19. sprintf() does not do anything. when i un-escape my quotes it fails. sprintf( "<object type="application/x-shockwave-flash" data="http://www.sharingizcaring.com/button/musicplayer.swf?&song_url=http://www.sharingizcaring.com/REPOSITORY/$key" width="17" height="17">"); sprintf( "<param name="movie" value="http://www.sharingizcaring.com/button/musicplayer.swf?&song_url=http://www.sharingizcaring.com/REPOSITORY/$key"/>"); sprintf( "<img src="noflash.gif" width="17" height="17" alt="" />"); sprintf( "$key<br>");
  20. My below code displays a list of mp3s in a directory each with a mini mp3 player to listen to it. Depending on how I work the quotes for it either only the first flash music player shows up. Or all the songs shows up but the flash players are broken. Any suggestions? <?php $arr = array(); foreach (glob("*.*") as $filename) { $arr[$filename] = filemtime($filename); } arsort($arr); echo "<br>"; foreach($arr as $key => $value) { if ( $key !== "filelist3.php") { echo '<object type=\"application/x-shockwave-flash\" data=\"http://www.sharingizcaring.com/button/musicplayer.swf?&song_url=http://www.sharingizcaring.com/REPOSITORY/$key\" width=\"17\" height=\"17\">'; echo '<param name=\"movie\" value=\"http://www.sharingizcaring.com/button/musicplayer.swf?&song_url=http://www.sharingizcaring.com/REPOSITORY/$key\"/>'; echo '<img src=\"noflash.gif\" width=\"17\" height=\"17\" alt=\"\" />'; echo "$key<br>"; } } ?>
  21. Blade. Tried it but it just lists numbers now. The part of the script that displays a list of files works fine. It just when I add in the flash music player functionality that it fails.
  22. Escaped the quotes and does not have any errors but still only displays one song. And not the first one. www.sharingizcaring.com/REPOSITORY/filelist3.php <?php $arr = array(); foreach (glob("*.*") as $filename) { $arr[$filename] = filemtime($filename); //echo $filename . " was last modified on " . date('M d Y, h:i:m', filemtime($filename)) . "<br>"; } /// //asort($arr); //echo "<br>"; //foreach($arr as $key => $value) //{ // echo "$key was last modified on " . date('M d Y, h:i:m', $value) . "<br>"; //} /// arsort($arr); echo "<br>"; foreach($arr as $key => $value) { if ( $key !== "filelist3.php") { echo "<object type=\"application/x-shockwave-flash\" data=\"http://www.sharingizcaring.com/button/musicplayer.swf?&song_url=http://www.sharingizcaring.com/REPOSITORY/$key\" width=\"17\" height=\"17\">"; echo "<param name=\"movie\" value=\"http://www.sharingizcaring.com/button/musicplayer.swf?&song_url=http://www.sharingizcaring.com/REPOSITORY/$key\"/>"; echo "<img src=\"noflash.gif\" width=\"17\" height=\"17\" alt=\"\" />"; echo "$key<br>"; } } ?> Tried it with soft quotes on the outside '<object..... And that does not break the loop but breaks the Flash. That is how it is now.
  23. full code: <?php $arr = array(); foreach (glob("*.*") as $filename) { $arr[$filename] = filemtime($filename); //echo $filename . " was last modified on " . date('M d Y, h:i:m', filemtime($filename)) . "<br>"; } /// //asort($arr); //echo "<br>"; //foreach($arr as $key => $value) //{ // echo "$key was last modified on " . date('M d Y, h:i:m', $value) . "<br>"; //} /// arsort($arr); echo "<br>"; foreach($arr as $key => $value) { if ( $key !== "filelist3.php") { echo "<object type="application/x-shockwave-flash" data="http://www.sharingizcaring.com/button/musicplayer.swf?&song_url=http://www.sharingizcaring.com/REPOSITORY/$key" width="17" height="17">"; echo "<param name="movie" value="http://www.sharingizcaring.com/button/musicplayer.swf?&song_url=http://www.sharingizcaring.com/REPOSITORY/$key"/>"; echo "<img src="noflash.gif" width="17" height="17" alt="" />"; echo "$key<br>"; } } ?>
  24. thorpe. your version returns: Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home2/sharingi/public_html/REPOSITORY/filelist3.php on line 32 blade that is what i also though he meant but that did not work either.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.