Jump to content

SavaSavanovic

Members
  • Content Count

    12
  • Joined

  • Last visited

Community Reputation

0 Neutral

About SavaSavanovic

  • Rank
    Member
  1. Every month I have pdf file with 40 pages, and I upload file to folder on webserver. Every user on internal company website have his own page in that pdf file. How to display specific page to specific user, without manual embedding to user profile page? Or display it on designated page for that pdf file, but with selection for user to pick his own page from pdf? Better option would be that user can navigate whole archive of pdf and pick year, month and his page from pdf. User's page in pdf has always same page number and his own phone number becouse pdf is phone bill for company mobile phones.
  2. Script so far looks like this: <?php header('Content-Type: text/html; charset=utf-8'); $dir = '/var/www/html/Cute_browser'; $show = 5; $files = array(); dirList($dir, $files); usort( $files, create_function('$a, $b', 'return filectime( $b ) - filectime( $a );') ); for ( $i = 0; $i < $show; ++$i ) echo '<a href="', $file = $files[$i], '">', ucfirst( strtolower(substr($file, 0, strpos($file, '.'))) ), '</a> - ', date( ' d M y H:i', filectime($file) ), '<br />', "\n"; function dirList($dir, &$results, $level=0) { $files = glob($dir.'/*'); foreach ($files as $f) { if (is_dir($f)) continue; $results[] = $f; } $files = glob($dir.'/*', GLOB_ONLYDIR); foreach ($files as $f) { if (is_dir($f)) { dirList($f, $results, $level+1); } } } ?> it works nicely, just I wanted, but it shows full path of file, and it is too long to display. How can I display only filename and two directories up?
  3. I changed filemtime to filectime, so I get newest files in directory by creation.
  4. I edited previous code like this: <?php header('Content-Type: text/html; charset=utf-8'); $show = 5; $files = glob( '*.{pdf}', GLOB_BRACE ); usort( $files, create_function('$a, $b', 'return filectime( $b ) - filectime( $a );') ); for ( $i = 0; $i < $show; ++$i ) echo '<a href="', $file = $files[$i], '">', ucfirst( strtolower(substr($file, 0, strpos($file, '.'))) ), '</a> - ', date( ' d M y H:i', filectime($file) ), '<br />', "\n"; ?> I solved problem with cyrillic names, but I could not make it to scan folders recursively for new files and to show file path two folders up from file, such as folder/subfolder/filename.pdf. Any suggestion?
  5. I forgot to say that file and folder names are in cyrillic, if that can be a problem. I tried this code today: <?php $show = 5; $files = glob( '*.{pdf,txt}', GLOB_BRACE ); usort( $files, create_function('$a, $b', 'return filemtime( $a ) - filemtime( $b );') ); for ( $i = 0; $i < $show; ++$i ) echo '<a href="', $file = $files[$i], '">', ucfirst( strtolower(substr($file, 0, strpos($file, '.'))) ), '</a> - ', date( 'D, d M y H:i:s', filemtime($file) ), '<br />', "\n"; ?> but it displays only files from folder where script is placed, without files from subfolders. I think it can be used as guide. I tried it with cyrillic filenames, it shows something like "дфдћч" filenames.
  6. <?php /* CLASS AUTORSS V 1.0 Autor : Roberto Aleman Email : ventics@gmail.com This class is to automatic read and show the files in a directory as rss 2.0 version, only configure the config.php file with de globals vars and xml and rss versions, the directory path and put config, callfile and autorss in directory to show at rss channel. i apply to read a folder of images and show images gallery to rss channel with feedreader. Enjoy!! GENERAL PUBLIC LICENCE , GPL */ class autorss { public function show($document_type,$path,$xmlversion,$encoding,$rssversion,$atomversion,$title,$homelink,$description,$language,$lastupdate,$callfile,$generator,$permalink,$category) { header($document_type); // define document type header $dir=getcwd(); // get directory where is script $dr=@opendir($dir); //asign path to $dr var if(!$dr){ echo "<error/>"; //if error, stop! and exit! exit; return; } else { //begin write xml file whith vars echo "<?xml version='".$xmlversion."' encoding='".$encoding."'?> <rss version='".$rssversion."' xmlns:atom='".$atomversion."'> <channel> <atom:link href='".$path."' rel='self' type='application/rss+xml'/> <title>".$title."</title> <link>".$homelink."</link> <description>".$description."</description> <language>".$language."</language> <lastBuildDate>".$lastupdate."</lastBuildDate> <generator>".$generator."</generator>"; while (($archivo = readdir($dr)) !== false) { if($archivo!="autorss.php" AND $archivo!="." AND $archivo!=".." AND $archivo!="error_log" AND $archivo!=$callfile ) { clearstatcache() ; $info = lstat($archivo); echo " <item> <title>".$path.$archivo."</title> <link>".$path.$archivo."</link> <pubDate>".date('r' ,$info[9])."</pubDate> <description><![CDATA[<img src=".$path.$archivo."></img><br/>File Size :".$info[7]." Bytes, Modified:".date('r',$info[9])."]]></description> <guid isPermaLink='".$permalink."'>".$path.$archivo."</guid> <category domain='".$path."'>".$category."</category> </item>"; } } echo "</channel></rss>"; closedir($dr); return; } } } ?> I tried this script, but I am open to any suggestion.
  7. I think I made a mistake in previous post, my problem is a script that monitors folders for new files, I know how to setup cron to run a script without problem. Server OS is Ubuntu 14.04. For reading PDFs on website I use Cute file browser script, if it is of any help. I need solution for script that scans folders for new files.
  8. Files are uploaded from local computer via BitTorrent Sync. I would like to solve problem with some cron script, but I could not find any suitable. Do you have some recommendation please?
  9. I tried to solve problem, but without success, so I am here to seek for some help. I have folder on web server, that contains subfolders and pdf files. I need PHP script that monitors folder and subfolders and create XML for RSS feed on site homepage whe new files are added to folders. Site is on local network only, it is not accesible via Internet. I tried number of scripts but without success. Any advice please?
×
×
  • 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.