Jump to content

CG_dude

Members
  • Posts

    33
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

CG_dude's Achievements

Member

Member (2/5)

0

Reputation

  1. I have solved this puzzle, the issue was that it needed the correct HREF link. Took me awhile, but the more I analyzed the code, I realized it had to be with the link, so made some adjustments and it is working like it should. Here is the correct code <?php // open this directory $myDirectory = opendir("/users/apache/hpws/apache/htdocs/prod_report_archives"); // get each entry while($entryName = readdir($myDirectory)) { $dirArray[] = $entryName; } // close directory closedir($myDirectory); // count elements in array $indexCount = count($dirArray); //Print ("$indexCount files<br>\n"); // sort 'em sort($dirArray); // print 'em print("<TABLE border=1 cellpadding=5 cellspacing=0 class=whitelinks>\n"); print("<TR><TH>Filename</TH><th>Filetype</th><th>Filesize</th></TR>\n"); // loop through the array of files and print them all for($index=0; $index < $indexCount; $index++) { if (substr("$dirArray[$index]", 0, 1) != "."){ // don't list hidden files print("<TR><TD><a href=http://keynes:8080/prod_report_archives/$dirArray[$index]>$dirArray[$index]</a></td>"); print("<td>"); print(filetype($dirArray[$index])); print("</td>"); print("<td>"); print(filesize($dirArray[$index])); print("</td>"); print("</TR>\n"); } } print("</TABLE>\n"); ?>
  2. Sorry if to you it was confusing, and thanks for the reply, but did not see where you suggested a change, and yes, the mydirectory points to and is opened so that the array can take place. Example; the array publishes on the screen 4 files, named file1.html, file2.html, file3.html, and file4.html. The files are in blue, so they are being linked, but when you click on the files, you get nothing. Where the file type and file size is it give me these errors For file Type Warning: lstat failed for (errno=2 - No such file or directory) in /users/apache/hpws/apache/htdocs/prod_report_archives.php on line 77 ( The line in refers to is this "print("<TR><TD><a href=\"$dirArray[$index]\">$dirArray[$index]</a></td>");" same error for file size but different line, but will be caused by the same issue.
  3. I should mention if I place the PHP script in the prod_report_archives directory instead of placing it on the webroot, it will work, however, the array catches the php script and publishes as a file along witht eh html files. I want to be able to keep the script in the webroot. Thanks,
  4. I'm not sure as I have never used the " \ " when defining the borders, but you shouldn't need them.
  5. Hello, I have a php page in the webtoot called testprodcyc.php which the webroot is /users/apache/hpws/apache/htdocs. From the testprodcyc page, there is a link to an archive page, that runs a php script from the webroot. ( The php script is located on the webroot as well). However, the script runs an array and lists all the files that are located in a directory, that is directly 1 level below the webtoot. PHP script located /users/apache/hpws/apache/htdocs/prod_report_archives.php The directory the files are located in is "/users/apache/hpws/apache/htdocs/prod_report_archives/" My problem is that the script works great except that it will not link the files in the lower directory, these files are HTML files. The array displayes the HTML files, but when you go to click on the files to view it doesn't work. My script is wrong somewhere, but I can't figure it out. Here is the script, any help will be appreciated. <?php // open this directory $myDirectory = opendir("/users/apache/hpws/apache/htdocs/prod_report_archives"); $TheFileName = "prod_report_archives.php"; // get each entry while($entryName = readdir($myDirectory)) { $dirArray[] = $entryName; } // close directory closedir($myDirectory); // count elements in array $indexCount = count($dirArray); //Print ("$indexCount files<br>\n"); // sort 'em sort($dirArray); // print 'em print("<TABLE border=1 cellpadding=5 cellspacing=0 class=whitelinks>\n"); print("<TR><TH>Filename</TH><th>Filetype</th><th>Filesize</th></TR>\n"); // loop through the array of files and print them all for($index=0; $index < $indexCount; $index++) { if (substr("$dirArray[$index]", 0, 1) != "."){ // don't list hidden files print("<TR><TD><a href=\"$dirArray[$index]\">$dirArray[$index]</a></td>"); print("<td>"); print(filetype($dirArray[$index])); print("</td>"); print("<td>"); print(filesize($dirArray[$index])); print("</td>"); print("</TR>\n"); } } print("</TABLE>\n"); ?> <style type="text/css"> <!-- h7 { color:303065; font-size:12pt; font-style:italic; } --> </style> <h7><center>Archives are available for a 18 month period</h7> I should be able to click on the html files the array gives me and view what each file has in it.
  6. Sorry, I'm not understanding that syntax or where it would go. Not familiar with "continue".
  7. Sorry, forgot to add that I only want HTML files to be shown, and say there is a perl.pl file in that directory and the array pulls it, how to hide that file.
  8. Hello All, I'm ok with PHP, but this one I can not figure out. I need to hide a file that is in an array that is being generated by pulling all files except hidden files in this directory so the user doesn't see it. I know I'm close, but just can't complete it. Here is the code. <?php // open this directory $myDirectory = opendir("/users/apache/hpws/apache/htdocs/prod_report_archives"); // get each entry while($entryName = readdir($myDirectory)) { $dirArray[] = $entryName; } // close directory closedir($myDirectory); // count elements in array $indexCount = count($dirArray); //Print ("$indexCount files<br>\n"); // sort 'em sort($dirArray); // print 'em print("<TABLE border=1 cellpadding=5 cellspacing=0 class=whitelinks>\n"); print("<TR><TH>Filename</TH><th>Filetype</th><th>Filesize</th></TR>\n"); // loop through the array of files and print them all for($index=0; $index < $indexCount; $index++) { if (substr("$dirArray[$index]", 0, 1) != "."){ // don't list hidden files print("<TR><TD><a href=\"$dirArray[$index]\">$dirArray[$index]</a></td>"); print("<td>"); print(filetype($dirArray[$index])); print("</td>"); print("<td>"); print(filesize($dirArray[$index])); print("</td>"); print("</TR>\n"); } } print("</TABLE>\n"); ?> Thanks for any help.
  9. Thanks, I actually tried that, and it's not working. I'm curious if it's a limitation with the version of PHP I am running or PHP in general. Strange, I would think I could execute the script, but not having any luck
  10. I did notice when I run require instead of shell_exec that it actually read everything in the perl script so I know it's seeing it, but I just can't figure out how to execute it. Any ideas ?
  11. Thanks for your consideration on this topic. I'm running PHP 4.2.3, I'm planning to upgrade, but not there yet. I'm running on a unix server. I'm trying to execute a perl script from my php page that is on the same server as my php and have it write the output to a txt file. I can see that hit hits the text file, but it seems that it's not executing the perl file since nothing is being written to the text file. I can execute the perl script from the command line and it works. Here is my code. I will be here most of the night and early morning trying to solve this. Thanks for any help. <?php $myfile = "/users/apache/hpws/apache/htdocs/prod_report/myresults.txt"; ?> </html> <html> <body> <!-- This table has all the job info --> <table border=1 cellspacing=2 bordercolor="#303065" align=justify WIDTH=89% bgcolor="white"> <tr bgcolor="#6699FF"><th>Line#</th> <th>Key Milestones</th> <th>End Time in PST</th> </tr> <td>18</td> <td>Transaction Handoff </td> <td> <?php $fh = fopen($myfile, 'w+'); $stringdata = shell_exec("/users/apache/hpws/apache/cgi-bin/perl_script.pl"); fwrite($fh, $stringdata); fclose($fh) ?> </td> </tr> </table> </body> </html>
  12. Yo Freaks, quick question. I have a php site on a unix server. Needing to capture the entire web page exactly how it is and archive it on a daily basis. I'm thinking of installing wget. Question is, from the unix command line, or script, will wget capture a php page ? Basically I'm going to use wget on mysite.com output the capture to another directory and call it mysite(date). Then I will be able to access the archive wget page for viewing. I'm not familiar with wget, but it looks like the thing I need to archive. Any thoughts ?
  13. Let me be more specifice. I have this site, testsite.php it's web root is /opt/hpws/apache/htdocs/testsite.php I want to run a link off the testsite.php to a php page that is located in the same path but in a directory just under the web root.(/opt/hpws/apache/htdocs/prod_report_archives/mondays_report.php) Hope this helps
  14. Hello Freaks, I'm building a php site, I have all .php extensions in the web root. I have some .txt files that php includes under the web root. My question is, can you run a php page from under the web root? If so, where can you tell php to also look under the webroot to access the page. I'm thinking maybe the ini, config, or htaccess files? but not sure, and not sure how to make the change? Any help would greatly be appreciated, thanks
  15. Hello all, Hopefully someone can point me in the right direction. I have been asked to archive a php intranet site for my company. I know it can be done with PDF file from a windows server, however, my site is running off a UNIX server and I'm not sure how to do this? I need it to be a PDF or a another site, that captures the data on a daily basis that is on the site at that particular time. It's a freeze shot in time. Any suggestions?
×
×
  • 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.