To encrypt the password, I use the OpenSSL library. To use this library you should activate this extension from php.ini (;extension=php_openssl.dll) and then download the DLL files required by this extension (libeay32.dll and ssleay32.dll), which should be in the PHP and Windows/System32 folders. PHP 5.x and 6.x have the file in the extras/openssl directory.
This code creates a key file called private.pem that uses 1024 bits.
$ openssl genrsa -out private.pem 1024
Theprivate.pem file actually has both private and public keys, so you should extract the public one from it.
The 1.html HTML page (see Listing 2) implements the Ajax mechanism and reveals an HTML form that interacts with the getuser.php PHP script to read from the jobs database and output the chosen value from the select component.
In this article you learned two approaches for writing a PHP login application: one using the aSSL library and the other using simple Ajax and the OpenSSL library.
About the Author
Octavia Andreea Anghel is a senior PHP developer currently working as a primary trainer for programming teams that participate at national and international software-development contests. She consults on developing educational projects at a national level. She is a coauthor of the book "XML Technologies: XML in Java" (Albastra, ISBN 978-973-650-210-1), for which she wrote the XML portions. In addition to PHP and XML, she's interested in software architecture, web services, UML, and high-performance unit tests. to e-mail her.