Re: [PHP] Random number generation...
?php srand((double)microtime()*100); $number = rand(1,20); echo $number; ? Regards, Avetis [EMAIL PROTECTED] wrote: Hi there, A potentially dumb question here. Is there an easy way to display a random number between 1 and 20? I have looked on line, but either I am looking inall teh wrong places, or there isn't this script on-line. Can anyone point me in the right direction? Cheers, Tris... ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- [EMAIL PROTECTED] ICT Specialist UNDP, Armenia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] .inc location security
You can consider also Files *.inc Order allow,deny Deny from all /Files Files sections are processed in the order they appear in the configuration file, after the Directory sections and .htaccess files are read, but before Location sections. Note that Files can be nested inside Directory sections to restrict the portion of the filesystem they apply to. Regards, Avetis Jason Dulberg wrote: I have about 20 virtual hosts on my server and all of them have shtml and some php files that look to a directory /includes/ which is aliased (in the srm.conf file) over to a main includes directory under the root dir. Alias /includes/ /usr/local/etc/httpd/htdocs/includes/ If I change this alias to a directory above the root dir, I can still view all of my .inc files in a browser even if I rename them to .inc.php These .inc files are just plain text that get included into all .shtml files on the virtual hosts. I tried to do the deny *.inc but doing so just made it so the browser can't even include them. So that won't do the trick. Is there any way that I can make these .inc files not readable by viewing them directly in the browser and still be able to include them into documents? Same goes for the php config stuff. If I put a config.php script above the root, how can I get the php script to read it -- is it the same 'ol /usr/etc/httpd/ sort of thing like cgi? My main concern is to get this stuff more secure while still allowing all of the virtual hosts to use the files. The contents of the files isn't exactly top secret, its just a matter of a piece of mind. Any ideas to sort this out are greatly appreciated! Thanks. __ Jason Dulberg Extreme MTB http://extreme.nas.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- [EMAIL PROTECTED] ICT Specialist UNDP, Armenia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] if... then... else with HTML
Something like this: ?php if (condition) { ? output this html-block ?php } else { ? output that html-block ?php } ? Regards, Avetis Martin Thoma wrote: Hello ! I want to do something like if (condition) output this html-block else output that html-block Without printig or echoing the html-block out (because the block has a lot of , which I all would have to slash out...) How can I do that ? Martin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- [EMAIL PROTECTED] ICT Specialist UNDP, Armenia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] replace function in a file.
Hello, something like this: $filename="your_file_name.txt"; $fp = fopen($filename, "r+") or die ("Could not open file"); $content = fread ($fp, filesize($filename)); $new_content = str_replace("old_word", "new_word", $content); rewind($fp); fwrite($fp, $new_content); ftruncate($fp, ftell($fp)); fclose($fp); Regards, Avetis Mark Lo wrote: Hi, Is there any function exists which to open a specific file, then find a specific word, if found, then replace that word with something else. re: I know fopen is to open, read, and write to specific file, but not finding and replacing.. Thank you Mark -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]