note 60182 rejected from function.fwrite by jacques

From: Date: Thu, 29 Dec 2005 08:40:49 +0000
Subject: note 60182 rejected from function.fwrite by jacques
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-100899@lists.php.net to get a copy of this message
Note Submitter: navarr at gmail dot com ---- Script that makes and writes to files, setting chmodes and everything correctly, much like a C ./configure would. ----------------------------------------------------------------- #!/usr/bin/php <?php /* ######################################### ### PHP Compiler System ### ######################################### ## Program Information: ####################### # Title: Compiler Test # Author: Navarr T. Barnier # Version: v1.0 # Email: admin@emerald.gtaero.net # Website: http://emerald.gtaero.net # AIM: navarr6 # YIM: navarr6 # ICQ: -=::NONE::=- # MSN: -=::NONE::=- ######################################### */ //###: Necesary Variables and Function Processing $argv1 = $_SERVER['argv'][1]; $files = array(); function cline($text = '') { print $text."\r\n"; } ################################################# $files = array(); $files['test'] = "<?php\r\n print 'Test';\r\n?>"; $files['test']['chmod'] = "777"; $files['test2'] = "<?php\r\n print 'Test';\r\n?>"; $files['test2']['chmod'] = "777"; $files['test3'] = "<?php ?>"; $files['test3']['chmod'] = "777"; ################################################# //###: Start Command Processing if ($argv1 == '--help') { cline('Type ./configure to Run the Processor.'); cline(); } elseif ($argv1 == '--info') { cline('This program was made to test the compiler system programmed by Navarr T. Barnier'); cline(''); cline('For Help on how to use it, type ./configure --help'); cline(); } else {; //###: Start Processing foreach($files as $file => $contents) { $fh = fopen($file,"w+"); fclose($fh); chmod($file, 0 .$files[$file]['chmod']); $fh = fopen($file,"w+"); fwrite($fh,$contents); fclose($fh); } } ?> ------------------------------------------------------- The data is stored properly in the array $files

« previous php.notes (#100899) next »