Most viewed PHP recipes http://code.activestate.com/recipes/langs/php/views/2014-09-01T14:55:56-07:00ActiveState Code RecipesPass Javascript arrays to PHP (PHP) 2005-05-16T11:45:33-07:00Noah Spurrierhttp://code.activestate.com/recipes/users/103276/http://code.activestate.com/recipes/414334-pass-javascript-arrays-to-php/ <p style="color: grey"> PHP recipe 414334 by <a href="/recipes/users/103276/">Noah Spurrier</a> (<a href="/recipes/tags/session/">session</a>). </p> <p>This is a Javascript function that will convert a Javascript array to a string in PHP serialized format. You can pass this string to a PHP script and easily unserialize it to a PHP array.</p> Microsoft Access Database Connectivity (DSN-Less) (PHP) 2006-08-29T03:08:29-07:00Erick Guanlaohttp://code.activestate.com/recipes/users/670494/http://code.activestate.com/recipes/163447-microsoft-access-database-connectivity-dsn-less/ <p style="color: grey"> PHP recipe 163447 by <a href="/recipes/users/670494/">Erick Guanlao</a> (<a href="/recipes/tags/database/">database</a>). Revision 4. </p> <p>An example of connecting to a Microsoft Access database, executing an SQL query, and displaying the results in HTML using PHP and COM (Windows only).</p> <p>NOTE: This works with PHP 4.x. I have been unsuccessful with getting this to work with PHP 5.1.6 and Apache 2.0.59 on Windowx XP Professional.</p> LDAP Authentication (PHP) 2001-12-07T11:00:34-08:00Shane Caraveohttp://code.activestate.com/recipes/users/98233/http://code.activestate.com/recipes/101525-ldap-authentication/ <p style="color: grey"> PHP recipe 101525 by <a href="/recipes/users/98233/">Shane Caraveo</a> (<a href="/recipes/tags/security/">security</a>). </p> <p>A simple LDAP Authentication script.</p> Print Directly from web application to POS/EPS thermal printer (PHP) 2014-09-01T14:55:56-07:00imam feriantohttp://code.activestate.com/recipes/users/633541/http://code.activestate.com/recipes/578925-print-directly-from-web-application-to-poseps-ther/ <p style="color: grey"> PHP recipe 578925 by <a href="/recipes/users/633541/">imam ferianto</a> (<a href="/recipes/tags/kasir/">kasir</a>, <a href="/recipes/tags/network/">network</a>, <a href="/recipes/tags/over/">over</a>, <a href="/recipes/tags/php/">php</a>, <a href="/recipes/tags/pos/">pos</a>, <a href="/recipes/tags/printer/">printer</a>, <a href="/recipes/tags/tiketing/">tiketing</a>). Revision 2. </p> <p>this php script will printout barcode label directly from the web by phpscript</p> Microsoft Access Database Connectivity (PHP) 2002-04-28T10:39:45-07:00Daniel Hendrickshttp://code.activestate.com/recipes/users/386772/http://code.activestate.com/recipes/123709-microsoft-access-database-connectivity/ <p style="color: grey"> PHP recipe 123709 by <a href="/recipes/users/386772/">Daniel Hendricks</a> (<a href="/recipes/tags/database/">database</a>). </p> <p>This is an example of how you can pull data from a Microsoft Access database through ADO.</p> PHP MySQL Search Class (PHP) 2003-10-28T19:57:45-08:00Stephen Bartholomewhttp://code.activestate.com/recipes/users/350445/http://code.activestate.com/recipes/125901-php-mysql-search-class/ <p style="color: grey"> PHP recipe 125901 by <a href="/recipes/users/350445/">Stephen Bartholomew</a> (<a href="/recipes/tags/database/">database</a>). Revision 10. </p> <p>This class can perform a full text search over multiple columns of a MySQL database table, matching entries containing all search terms parsed to it.</p> PHP Login page (PHP) 2010-04-17T13:31:03-07:00Jonathan Fenechhttp://code.activestate.com/recipes/users/4169413/http://code.activestate.com/recipes/576680-php-login-page/ <p style="color: grey"> PHP recipe 576680 by <a href="/recipes/users/4169413/">Jonathan Fenech</a> (<a href="/recipes/tags/login/">login</a>, <a href="/recipes/tags/page/">page</a>). Revision 2. </p> <p>this is a small php login script.</p> PHP Tic Tac Toe (PHP) 2004-04-06T08:28:47-07:00Premshree Pillaihttp://code.activestate.com/recipes/users/1424728/http://code.activestate.com/recipes/276962-php-tic-tac-toe/ <p style="color: grey"> PHP recipe 276962 by <a href="/recipes/users/1424728/">Premshree Pillai</a> . </p> <p>This is a web-based Tic Tac Toe game written in PHP.</p> php htaccess (PHP) 2002-04-25T13:33:27-07:00Sven Wagenerhttp://code.activestate.com/recipes/users/182412/http://code.activestate.com/recipes/108479-php-htaccess/ <p style="color: grey"> PHP recipe 108479 by <a href="/recipes/users/182412/">Sven Wagener</a> (<a href="/recipes/tags/security/">security</a>). Revision 2. </p> <p>The htaccess class manages the htaccess functions of Apache Webservers. Without knowing much knowledge of Apache, users can be added or deleted, groups can be created anddeleted, .htaccess files can be created with this class etc.</p> Generate a salt (PHP) 2012-07-10T19:52:17-07:00Xavier L.http://code.activestate.com/recipes/users/4171602/http://code.activestate.com/recipes/576894-generate-a-salt/ <p style="color: grey"> PHP recipe 576894 by <a href="/recipes/users/4171602/">Xavier L.</a> (<a href="/recipes/tags/crypt/">crypt</a>, <a href="/recipes/tags/generation/">generation</a>, <a href="/recipes/tags/generator/">generator</a>, <a href="/recipes/tags/hash/">hash</a>, <a href="/recipes/tags/pass/">pass</a>, <a href="/recipes/tags/password/">password</a>, <a href="/recipes/tags/salt/">salt</a>, <a href="/recipes/tags/secure/">secure</a>, <a href="/recipes/tags/security/">security</a>, <a href="/recipes/tags/string/">string</a>). Revision 6. </p> <p>This function will generate a salt for use with passwords ranging using characters in range a to z, A to Z, 0 to 9 and !@#$%&amp;<em>?. The characters are sorted in a random value and can appear more than one time in the string. This way, this function is more powerful than the *shuffle()</em> function. This means that the salt could also be longer than the character list.</p> PHP - Background Colour Changer (PHP) 2009-03-05T05:22:31-08:00Jonathan Fenechhttp://code.activestate.com/recipes/users/4169413/http://code.activestate.com/recipes/576679-php-background-colour-changer/ <p style="color: grey"> PHP recipe 576679 by <a href="/recipes/users/4169413/">Jonathan Fenech</a> (<a href="/recipes/tags/background/">background</a>, <a href="/recipes/tags/changer/">changer</a>, <a href="/recipes/tags/colour/">colour</a>). Revision 2. </p> <p>this is a script that changes the colour of the background to the day of the week, the code uses if and elseif...</p> Implementation of a single linked list in PHP (PHP) 2008-09-11T12:44:41-07:00sameer boratehttp://code.activestate.com/recipes/users/4167072/http://code.activestate.com/recipes/576498-implementation-of-a-single-linked-list-in-php/ <p style="color: grey"> PHP recipe 576498 by <a href="/recipes/users/4167072/">sameer borate</a> (<a href="/recipes/tags/linked_list/">linked_list</a>, <a href="/recipes/tags/php/">php</a>). </p> <p>Implementation of a single linked list in PHP with Unit Test</p> main - python-like if __name__ == __main__ (PHP) 2004-09-09T00:49:19-07:00Mirek Rusinhttp://code.activestate.com/recipes/users/2028384/http://code.activestate.com/recipes/303971-main-python-like-if-__name__-__main__/ <p style="color: grey"> PHP recipe 303971 by <a href="/recipes/users/2028384/">Mirek Rusin</a> . </p> <p>How to determine if we're in the (directly) launched script.</p> Check email format (PHP) 2002-04-20T16:41:36-07:00Steve Belangerhttp://code.activestate.com/recipes/users/299290/http://code.activestate.com/recipes/121796-check-email-format/ <p style="color: grey"> PHP recipe 121796 by <a href="/recipes/users/299290/">Steve Belanger</a> . </p> <p>This is a function i used in order to check if an email submitted by the user is in the proper email format. (does not check if the email exists though). If the email has proper format, will return true, otherwise will return false.</p> Single Linked List (PHP) 2006-10-09T11:52:45-07:00Andre Wanderley de Souzahttp://code.activestate.com/recipes/users/2634005/http://code.activestate.com/recipes/498103-single-linked-list/ <p style="color: grey"> PHP recipe 498103 by <a href="/recipes/users/2634005/">Andre Wanderley de Souza</a> (<a href="/recipes/tags/datastructures/">datastructures</a>). Revision 10. </p> <p>As `throw new Exception' is just avaliable in php 5, for use php 4 use that call shoud be replaced.</p> DB_eSession PHP class facilitates having sessions stored in a MySQL database. (PHP) 2004-11-28T22:16:52-08:00Lawrence Ohttp://code.activestate.com/recipes/users/2180633/http://code.activestate.com/recipes/347808-db_esession-php-class-facilitates-having-sessions-/ <p style="color: grey"> PHP recipe 347808 by <a href="/recipes/users/2180633/">Lawrence O</a> (<a href="/recipes/tags/session/">session</a>). </p> <p>DB_eSession is a feature packed PHP class that stores session data in a MySQL database rather than flat files. It is powerful, designed with security in mind, and yet easy to utilize. The web site has a full package download containing example scripts too.</p> Protect PHP File that must be include (PHP) 2003-06-24T17:41:18-07:00imam feriantohttp://code.activestate.com/recipes/users/633541/http://code.activestate.com/recipes/207176-protect-php-file-that-must-be-include/ <p style="color: grey"> PHP recipe 207176 by <a href="/recipes/users/633541/">imam ferianto</a> (<a href="/recipes/tags/security/">security</a>). </p> <p>This Section is describe how we can protect php module that can calling in with include function, but is not secure and its have big risk. For the solution is we can make this module file cannot execute or calling when it's not include, the code simple with test file name. Some study case: we hosting in sites that we cannot protection in dir, regulary we add .htacces in folder /inc/ I was putin .htacces so if we calling <a href="http://localhost/inc/" rel="nofollow">http://localhost/inc/</a> is displayed forbidden but if I try if we calling <a href="http://localhost/inc/connect-module.php" rel="nofollow">http://localhost/inc/connect-module.php</a> it will be succesfull and maybe some accident will happen here</p> Converting MySQL queries to XML (PHP) 2008-09-11T13:16:40-07:00sameer boratehttp://code.activestate.com/recipes/users/4167072/http://code.activestate.com/recipes/576499-converting-mysql-queries-to-xml/ <p style="color: grey"> PHP recipe 576499 by <a href="/recipes/users/4167072/">sameer borate</a> (<a href="/recipes/tags/mysql/">mysql</a>, <a href="/recipes/tags/php/">php</a>, <a href="/recipes/tags/xml/">xml</a>). </p> <p>Converting MySQL queries to XML</p> Youtube Downloader (PHP) 2008-12-03T17:37:28-08:00yeni setiawanhttp://code.activestate.com/recipes/users/4168289/http://code.activestate.com/recipes/576579-youtube-downloader/ <p style="color: grey"> PHP recipe 576579 by <a href="/recipes/users/4168289/">yeni setiawan</a> (<a href="/recipes/tags/download/">download</a>, <a href="/recipes/tags/php/">php</a>, <a href="/recipes/tags/youtube/">youtube</a>, <a href="/recipes/tags/youtube_downloader/">youtube_downloader</a>). </p> <p>This is a series of function that you can use to download video(s) from <a href="http://Youtube.com" rel="nofollow">Youtube.com</a></p> COM based email (PHP) 2001-12-07T10:55:16-08:00Shane Caraveohttp://code.activestate.com/recipes/users/98233/http://code.activestate.com/recipes/101523-com-based-email/ <p style="color: grey"> PHP recipe 101523 by <a href="/recipes/users/98233/">Shane Caraveo</a> (<a href="/recipes/tags/distributed/">distributed</a>). </p> <p>One way to work around the lack of a full implementation of sendmail in PHP is to use the Microsoft Collaboration Data Objects (CDO) Library.</p> <p>Here is a short example of its usage:</p>