PHP Knowledge Base Update -- July 8th, 1999

From: Date: Fri, 09 Jul 1999 15:45:38 +0000
Subject: PHP Knowledge Base Update -- July 8th, 1999
Groups: php.kb 
Request: Send a blank email to php-kb+get-12@lists.php.net to get a copy of this message
Dave Sklar today announced: I modified the PX so that if you have some PHP code that doesn't lend itself to pasting into a textbox, you can instead (or in addition) submit a URL where the code lives. That URL will get displayed instead of a link to display the code. http://px.sklar.com/ Cheers, Nathan ------------------------------------------------------------ Can I use a name anchor and get variables in the same URL? Why won't client side image maps work when I have a name anchor and get variables in the URL? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/456 ------------------------------------------------------------ Nuutti-Iivari Merilainen, Mike Robinson A URL like this should work properly: http://www.foobar.com/foo.phtml#13.5?article_num=13 There have been reports that this does not work properly with client side image maps in Netscape. ------------------------------------------------------------ Is there an Integrated Development Environment (IDE) available for PHP? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/458 ------------------------------------------------------------ Dave Cramer There is no true IDE currently available for PHP. Most people use text editors with syntax highlighting to do their PHP coding. ------------------------------------------------------------ Does PHP support C-syntax if statements without braces? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/459 ------------------------------------------------------------ Rasmus Lerdorf if(condition) statement; else statement; works fine in PHP. ------------------------------------------------------------ How can I run a Java program from my PHP script? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/460 ------------------------------------------------------------ Hentosh http://www.twmacinta.com/software/babelj/ It is supposed to let one call Java from PHP. I assume you don't want to run your java program as an applet on the person's browser. ------------------------------------------------------------ What is required to use the Oracle functions in PHP? Do I need the Oracle client libraries installed to use the PHP Oracle functions? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/461 ------------------------------------------------------------ Steffen Rögner You have to install client libs and headers to compile Oracle Support into PHP. Thats not a problem on Linux - you just have to install the free Ora Server ( or just its Client part ) Its also useful for testing querys, having a local sqlplus... ------------------------------------------------------------ Why are my images produced by GD so big? Why does using the image functions increase the size of my image? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/463 ------------------------------------------------------------ Alex Belits, Samuel Liddicott, Rasmus Lerdorf Because of patent troubles with Unisys (boo!) gifs that are produced by gd are compressed using RLE compression instead of LZW compression. You can always plug back in the LZW compression if you want to. Try and reduce your colours and have lots of repeated horizontal colour areas and it will compress well. That means left to right gradients are bad, top to bottom are fine. You could also upgrade to GD-1.5 where at GD compile-time you can tell it to use LZW. http://rpmfind.net/linux/RPM/contrib/libc6/i386/gd-1.5-1.i386.html download it while you can (and all good mirrors). ------------------------------------------------------------ How can I check if the user has Javascript enabled in their browser? Can I find out in PHP if the user has Javascript turned on? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/465 ------------------------------------------------------------ Teodor Cimpoesu You can check if the user has Javascript from PHP only if you get them to send you a page. This is because PHP runs on the server. Here is a PHP script to check it: <html><body> <!-- other stuff --> <form name="tester" action="<%=$PHP_SELF%>" method="post"> <input type="hidden" name="JS_SWITCH" value="JS_OFF"> <!-- any other fields --> <input type="submit" value="click to continue!..."> </form> <script><!-- document.tester.JS_SWITCH.value="JS_ON"; //--> </script> </body></html> If JS works, it will turn on the switch, else you'll get the same JS_OFF. ------------------------------------------------------------ How can I use edit PHP code in Dreamweaver? What is phpweave? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/467 ------------------------------------------------------------ Keith Greene Check the mailinglist archives. Someone wrote an "extension" to Dreamweaver 2 that allows the use of PHP. Just do a search for dreamweaver or phpweave (that's what it's called). ------------------------------------------------------------ What do the square brackets around function arguments in the manual mean? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/469 ------------------------------------------------------------ Rasmus Lerdorf The square brackets in the function prototype description just tells you that the argument the brackets are around is an optional argument. ------------------------------------------------------------ Why doesn't my PHP shell script work? Why will only print and echo work in my shell script? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/470 ------------------------------------------------------------ Chad Cunningham, John Coggeshall You may have forgotten the #!/path/to/php.binary at the top... Mainly because echo "some text" is valid shell script, but the other stuff isn't... Also check that you are using the CGI Version of PHP3. If you are, then you should be able to execute any PHP3 Script (minus ones with functions that are apache-specific like the virtural(); function) as-is without a problem... i.e. myshellscript.php3 #!/usr/bin/php3 -q <?php // my code ?> ------------------------------------------------------------ Why does my Oracle SQL get committed even if I don't call commit? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/472 ------------------------------------------------------------ Mark Britton Oracle will do an automatic commit at the end of your php3 script if you don't do a rollback before then. This is Oracle behavior, not php. This is the same behaviour you would see in SQL*PLus. If you run your procedure from SQL*Plus and then exit, your changes will be committed even though you never explicitly committed. ------------------------------------------------------------ How can I force all requests to a certain directory to use SSL? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/473 ------------------------------------------------------------ James Thompson, Zak Greant, Kim Shrier If you are using mod_rewrite for Apache you can use: Redirect /some/dir https://www.example.com/some/dir which redirects normal URL get requests to the secure connection. If you are using mod_ssl then you could use the SSLRequireSSL directive. If you want to do the check in PHP, then at the top of the file that needs to be accessed via the secure connection test against the environment variable $SERVER_PORT. Something like this should work: yourfile.php3 if ($SERVER_PORT != 443) // or your SSL port { header("Location: https://foo.bar.com/yourfile.php3"); } // rest of page ------------------------------------------------------------ What is the maximum length of a URL string? What is the longest URL that Apache can handle? Is there a maximum number of GET arguments that can be used? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/474 ------------------------------------------------------------ Chad Cunningham, Sander Pilon There is theoretically no limit. The HTTP spec doesn't specify, so it will vary from server to server (possibly browser to browser as well). Someone reported a while ago that apache could handle something like up to 8k... Well, I *think* there was a 256 character limit on some browser. (Read that in some HTML book :) Could've been lifted by now, but if it's more then 256 characters you're better off with cookies or POSTing the data anyway. ------------------------------------------------------------ How can I clear the contents of an array? Why does my array in a loop contain data from previous loops? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/477 ------------------------------------------------------------ D. Dante Lorenso, Chad Cunningham You can clear the contents of an array by unsetting it: http://www.php.net/manual/function.unset.php3 unset($a); or by resetting it to be an empty array: $a = array(); You may need to clear the contents of an array when reusing the same variable to hold different array data (say in a loop). If you don't clear the contents then the contents from the previous loop iteration may be left in the array (if the previous array data was longer than the current array data). ------------------------------------------------------------ How can I send the output of a PHP script to a different frame? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/479 ------------------------------------------------------------ Chad Cunningham You just specify the name of the desired frame as the target for the link or form action: <form action="script.php3" target=frame2> ------------------------------------------------------------ How can I find out which option a user selected in a SELECT form? http://e-gineer.com/e-gineer/phpkb/view.phtml/qid/480 ------------------------------------------------------------ Troels Arvin Try playing around with this script to see how things work: <html><head><title>Option test</title></head> <body> <form action="<?php print $PHP_SELF ?>"> <select name="var"> <!-- Note: Variable name defined here --> <option value="">Please select</option> <option>a</option> <option>b</option> <option>c</option> </select> <input type="submit" name="submit"> </form> <?php // If the user did not submit the form then output no more if ($submit) { print "<hr>Value of <code>var</code>: "; if (empty($var)) print "(empty)"; else print $var; } ?> </body></html>

« previous php.kb (#12) next »