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'); ... |
Get Advanced PHP for Web Professionals now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.