O'Reilly logo

Advanced PHP for Web Professionals by Christopher Cosentino

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

A Simple PHPGTK Application

This next application uses GTK widgets to create a small application that encodes passwords. You enter a username and password into their respective fields, then click the “Generate…” button to create an encrypted username and password combination that can be used in some of the previous scripts in this book. The username and password are displayed in a text box in the middle of the application. When you have created as many passwords as needed, you can click the “Write To File” button to write the data to a text file. See Figure 12-8 for example output.

Script 12-6. password_gen.php
					1.  <?php
 2.    if (!class_exists('gtk')) {
 3.    if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN')
 4.      dl('php_gtk.dll');
 5.    else
 6.  dl('php_gtk.so'); ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required