CVS update: php3/doc/chapters

From: Date: Sat, 26 Dec 1998 12:59:42 +0000
Subject: CVS update: php3/doc/chapters
Groups: php.dev 
Request: Send a blank email to php-dev+get-3047@lists.php.net to get a copy of this message
Date: Saturday December 26, 1998 @ 7:59 Author: eschmid Update of /repository/php3/doc/chapters In directory asf:/u/temp/cvs-serv28528 Modified Files: features.sgml Log Message: Cleanup some linke breakings and add Empress. Index: php3/doc/chapters/features.sgml diff -c php3/doc/chapters/features.sgml:1.20 php3/doc/chapters/features.sgml:1.21 *** php3/doc/chapters/features.sgml:1.20 Wed Dec 9 21:07:27 1998 --- php3/doc/chapters/features.sgml Sat Dec 26 07:59:41 1998 *************** *** 4,9 **** --- 4,10 ---- <sect1 id="feature-httpauth"> <title>HTTP authentication with PHP</title> + <simpara> The HTTP Authentication hooks in PHP are only available when it is running as an Apache module. In an Apache module PHP script, it *************** *** 18,26 **** <para> An example script fragment which would force client authentication on a page would be the following: <example> <title>HTTP Authentication example</title> ! <programlisting role=php> &lt;?php if(!isset($PHP_AUTH_USER)) { Header(&quot;WWW-Authenticate: Basic realm=\&quot;My Realm\&quot;&quot;); --- 19,28 ---- <para> An example script fragment which would force client authentication on a page would be the following: + <example> <title>HTTP Authentication example</title> ! <programlisting role=php> &lt;?php if(!isset($PHP_AUTH_USER)) { Header(&quot;WWW-Authenticate: Basic realm=\&quot;My Realm\&quot;&quot;); *************** *** 32,38 **** echo &quot;You entered $PHP_AUTH_PW as your password.&lt;P&gt;&quot;; } ?> ! </programlisting></example> <para> Instead of simply printing out the $PHP_AUTH_USER and $PHP_AUTH_PW, you would probably want to check the username and --- 34,42 ---- echo &quot;You entered $PHP_AUTH_PW as your password.&lt;P&gt;&quot;; } ?> ! </programlisting> ! </example> ! <para> Instead of simply printing out the $PHP_AUTH_USER and $PHP_AUTH_PW, you would probably want to check the username and *************** *** 50,78 **** traditional external mechanism, the PHP_AUTH variables will not be set if external authentication is enabled for that particular page. In this case, the $REMOTE_USER variable can be used to ! identify the externally-authenticated user. <simpara> Note, however, that the above does not prevent someone who controls a non-authenticated URL from stealing passwords from authenticated URLs on the same server. <simpara> ! Both Netscape and Internet Explorer will clear the local browser window's ! authentication cache for the realm upon receiving a server response of 401. This ! can effectively "log out" a user, forcing them to re-enter their username and ! password. Some people use this to "time out" logins, or provide a "log-out" ! button. ! <simpara> ! This behavior is not required by the HTTP Basic authentication standard, so you ! should never depend on this. Testing with Lynx has shown that Lynx does not clear ! the authentication credentials with a 401 server response, so pressing back and ! then forward again will open the resource (as long as the credential requirements ! haven't changed). <simpara> ! Also note that this does not work using Microsoft's IIS server ! and the CGI version of PHP due to a limitation of IIS. <sect1 id="feature-images"> <title>GIF creation with PHP</title> <simpara> PHP is not limited to creating just HTML output. It can also be used to create GIF image files, or even more convenient GIF image --- 54,85 ---- traditional external mechanism, the PHP_AUTH variables will not be set if external authentication is enabled for that particular page. In this case, the $REMOTE_USER variable can be used to ! identify the externally-authenticated user. <simpara> Note, however, that the above does not prevent someone who controls a non-authenticated URL from stealing passwords from authenticated URLs on the same server. <simpara> ! Both Netscape and Internet Explorer will clear the local browser ! window's authentication cache for the realm upon receiving a ! server response of 401. This can effectively "log out" a user, ! forcing them to re-enter their username and password. Some people ! use this to "time out" logins, or provide a "log-out" button. ! <simpara> ! This behavior is not required by the HTTP Basic authentication ! standard, so you should never depend on this. Testing with Lynx ! has shown that Lynx does not clear the authentication credentials ! with a 401 server response, so pressing back and then forward ! again will open the resource (as long as the credential ! requirements haven't changed). <simpara> ! Also note that this does not work using Microsoft's IIS server and ! the CGI version of PHP due to a limitation of IIS. + <sect1 id="feature-images"> <title>GIF creation with PHP</title> + <simpara> PHP is not limited to creating just HTML output. It can also be used to create GIF image files, or even more convenient GIF image *************** *** 80,88 **** image functions for this to work. </simpara> <para> ! <example> ! <title>GIF creation with PHP</title> ! <programlisting role=php> &lt;?php Header("Content-type: image/gif"); $string=implode($argv," "); --- 87,95 ---- image functions for this to work. </simpara> <para> ! <example> ! <title>GIF creation with PHP</title> ! <programlisting role=php> &lt;?php Header("Content-type: image/gif"); $string=implode($argv," "); *************** *** 93,99 **** ImageGif($im); ImageDestroy($im); ?> ! </programlisting></example> This example would be called from a page with a tag like: &lt;img src=&quot;button.php3?text&quot;&gt; The above button.php3 script --- 100,107 ---- ImageGif($im); ImageDestroy($im); ?> ! </programlisting> ! </example> This example would be called from a page with a tag like: &lt;img src=&quot;button.php3?text&quot;&gt; The above button.php3 script *************** *** 105,134 **** dynamically generated. </para> <sect1 id="feature-fileupload"> <title>File upload support</title> <simpara> ! PHP is capable of receiving file uploads from any RFC-1867 compliant ! browser (which includes Netscape Navigator 3 or later, Microsoft ! Internet Explorer 3 with a patch from Microsoft, or later without a ! patch). This feature lets people upload both text and binary files. ! With PHP's authentication and file manipulation functions, you have ! full control over who is allowed to upload and what is to be done with ! the file once it has been uploaded. </simpara> <para> A file upload screen can be built by creating a special form which looks something like this: ! <example> ! <title>File Upload Form</title> ! <programlisting> ! &lt;FORM ENCTYPE=&quot;multipart/form-data&quot; ACTION=&quot;_URL_&quot; METHOD=POST&gt; ! &lt;INPUT TYPE=&quot;hidden&quot; name=&quot;MAX_FILE_SIZE&quot; value=&quot;1000&quot;&gt; ! Send this file: &lt;INPUT NAME=&quot;userfile&quot; TYPE=&quot;file&quot;&gt; ! &lt;INPUT TYPE=&quot;submit&quot; VALUE=&quot;Send File&quot;&gt; ! &lt;/FORM&gt; ! </programlisting></example> The _URL_ should point to a php html file. The MAX_FILE_SIZE hidden field must precede the file input field and its value is --- 113,145 ---- dynamically generated. </para> + <sect1 id="feature-fileupload"> <title>File upload support</title> + <simpara> ! PHP is capable of receiving file uploads from any RFC-1867 ! compliant browser (which includes Netscape Navigator 3 or later, ! Microsoft Internet Explorer 3 with a patch from Microsoft, or ! later without a patch). This feature lets people upload both text ! and binary files. With PHP's authentication and file manipulation ! functions, you have full control over who is allowed to upload and ! what is to be done with the file once it has been uploaded. </simpara> <para> A file upload screen can be built by creating a special form which looks something like this: ! <example> ! <title>File Upload Form</title> ! <programlisting> ! &lt;FORM ENCTYPE=&quot;multipart/form-data&quot; ACTION=&quot;_URL_&quot; METHOD=POST&gt; ! &lt;INPUT TYPE=&quot;hidden&quot; name=&quot;MAX_FILE_SIZE&quot; value=&quot;1000&quot;&gt; ! Send this file: &lt;INPUT NAME=&quot;userfile&quot; TYPE=&quot;file&quot;&gt; ! &lt;INPUT TYPE=&quot;submit&quot; VALUE=&quot;Send File&quot;&gt; ! &lt;/FORM&gt; ! </programlisting> ! </example> The _URL_ should point to a php html file. The MAX_FILE_SIZE hidden field must precede the file input field and its value is *************** *** 184,199 **** logic, you should either delete the file from the temporary directory or move it elsewhere. <simpara> ! The file will be deleted from the temporary directory at the end of ! the request if it has not been moved away or renamed. <simpara> Please note that the CERN httpd seems to strip off everything starting at the first whitespace in the content-type mime header it gets from the client. As long as this is the case, CERN httpd will not support the file upload feature. <sect1 id="feature-cookies"> <title>HTTP cookie support</title> <para> PHP transparently supports HTTP cookies. Cookies are a mechanism for storing data in the remote browser and thus tracking or --- 195,212 ---- logic, you should either delete the file from the temporary directory or move it elsewhere. <simpara> ! The file will be deleted from the temporary directory at the end ! of the request if it has not been moved away or renamed. <simpara> Please note that the CERN httpd seems to strip off everything starting at the first whitespace in the content-type mime header it gets from the client. As long as this is the case, CERN httpd will not support the file upload feature. + <sect1 id="feature-cookies"> <title>HTTP cookie support</title> + <para> PHP transparently supports HTTP cookies. Cookies are a mechanism for storing data in the remote browser and thus tracking or *************** *** 210,224 **** the <function>setcookie</function> function. </sect1> <sect1 id="feature-databases"> <title>Database support</title> <para> ! PHP supports a number of different databases in both native mode and ! through ODBC, including: <simplelist columns=2> <member>Adabas D</member> <member>dBase</member> <member>FilePro</member> <member>Informix</member> <member>InterBase</member> --- 223,240 ---- the <function>setcookie</function> function. </sect1> + <sect1 id="feature-databases"> <title>Database support</title> + <para> ! PHP supports a number of different databases in both native mode ! and through ODBC, including: <simplelist columns=2> <member>Adabas D</member> <member>dBase</member> + <member>Empress</member> <member>FilePro</member> <member>Informix</member> <member>InterBase</member> *************** *** 231,270 **** <member>Velocis</member> <member>Unix dbm</member> </simplelist> - </para> <sect1 id="feature-regexps"> <title>Regular expressions</title> <para> ! Regular expressions are used for complex string manipulation in PHP. The functions ! that support regular expressions are: ! <itemizedlist> <listitem> ! <simpara><function>ereg</function> ! </listitem> <listitem> ! <simpara><function>ereg_replace</function> ! </listitem> <listitem> ! <simpara><function>eregi</function> ! </listitem> <listitem> ! <simpara><function>eregi_replace</function> ! </listitem> <listitem> ! <simpara><function>split</function> ! </listitem> ! </itemizedlist> ! These functions all take a regular expression string as their first argument. PHP uses ! the POSIX extended regular expressions as defined by POSIX 1003.2. For a full description ! of POSIX regular expressions see the regex man pages included in the regex directory in ! the PHP distribution. ! </para> <para> ! <example> ! <title>Regular expression examples</title> ! <programlisting> ereg(&quot;abc&quot;,$string); /* Returns true if &quot;abc&quot; is found anywhere in $string. */ --- 247,290 ---- <member>Velocis</member> <member>Unix dbm</member> </simplelist> + <sect1 id="feature-regexps"> <title>Regular expressions</title> + <para> ! Regular expressions are used for complex string manipulation in ! PHP. The functions that support regular expressions are: ! ! <itemizedlist> <listitem> ! <simpara><function>ereg</function> ! </listitem> <listitem> ! <simpara><function>ereg_replace</function> ! </listitem> <listitem> ! <simpara><function>eregi</function> ! </listitem> <listitem> ! <simpara><function>eregi_replace</function> ! </listitem> <listitem> ! <simpara><function>split</function> ! </listitem> ! </itemizedlist> ! ! These functions all take a regular expression string as their ! first argument. PHP uses the POSIX extended regular expressions ! as defined by POSIX 1003.2. For a full description of POSIX ! regular expressions see the regex man pages included in the regex ! directory in the PHP distribution. ! <para> ! <example> ! <title>Regular expression examples</title> ! <programlisting> ereg(&quot;abc&quot;,$string); /* Returns true if &quot;abc&quot; is found anywhere in $string. */ *************** *** 295,302 **** ereg_replace("\n","",$string); /* Get rid of any carriage return characters in $string. */ ! </programlisting></example> ! </para> <sect1 id="feature-error-handling"> <title>Error handling</title> --- 315,323 ---- ereg_replace("\n","",$string); /* Get rid of any carriage return characters in $string. */ ! </programlisting> ! </example> ! <sect1 id="feature-error-handling"> <title>Error handling</title> -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#3047) next »