This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Escapes HTML attributes using JavaScript | |
| */ | |
| function escapeHtmlAttr(attr) { | |
| var cdiv = document.createElement('div'); | |
| cdiv.setAttribute('abc', attr); | |
| return cdiv.outerHTML | |
| .substr(10, cdiv.outerHTML.length - 18); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| * https://github.com/jmhobbs/K3-Encryption/blob/master/classes/kohana/encryption.php | |
| * http://blog.djekldevelopments.co.uk/?p=334 | |
| * https://gist.github.com/meghuizen/5147425 | |
| * https://bugs.php.net/bug.php?id=62453&edit=1 | |
| * http://php.net/manual/en/function.hash-pbkdf2.php | |
| * http://www.itnewb.com/tutorial/Encrypting-Passwords-with-PHP-for-Storage-Using-the-RSA-PBKDF2-Standard | |
| * http://timoh6.github.io/2013/11/05/Secure-random-numbers-for-PHP-developers.html | |
| * https://github.com/ircmaxell/random_compat |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Random key generator example. | |
| * | |
| * See: http://timoh6.github.io/2013/11/05/Secure-random-numbers-for-PHP-developers.html | |
| * https://github.com/ircmaxell/random_compat | |
| * | |
| * Code a simplified and modified version of the RandomLib of https://github.com/ircmaxell/RandomLib | |
| * From the File RandomLib/lib/RandomLib/Generator.php the function generateString |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * See for more info: http://blog.ircmaxell.com/2013/02/preventing-csrf-attacks.html | |
| */ | |
| abstract class CsrfToken { | |
| private static $_currentToken; | |
| private static $_tokenLifetime = 3600; // could be a nice addition | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| mt_srand(1361152757.2); | |
| for ($i=1; $i < 25; $i++) { | |
| echo mt_rand(), PHP_EOL; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Secure htaccess | |
| ### If you run a webserver other than Apache, consider: | |
| ### github.com/h5bp/server-configs | |
| # Install APC for caching | |
| # command line: pecl install apc | |
| # For installing a debugger/profiler: | |
| # command line: pecl install xdebug-beta |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $iterations = 10000; | |
| $msg = " | |
| Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc at dolor eget quam vehicula gravida. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Aenean et lectus vitae dui viverra euismod. Vivamus eu magna eros, at accumsan est. Sed massa est, sodales vitae eleifend sed, placerat eu diam. Quisque vel risus nibh, at euismod massa. | |
| Morbi sed augue neque. Suspendisse id tristique odio. Praesent bibendum scelerisque dolor ut placerat. Proin ut augue et dui hendrerit gravida eu a dolor. Pellentesque at enim elit. Mauris ac mauris elit. Maecenas tempor augue et libero dictum eu imperdiet nunc pharetra. Aliquam tempus euismod felis eget hendrerit. Curabitur eu fringilla neque. Aenean ut nisl magna, ac tincidunt tellus. Morbi erat turpis, egestas ac blandit nec, consectetur ut mauris. Nulla id ipsum eu diam vestibulum posuere sed vitae ante. Donec urna nunc, tincidunt id aliquet ut, |
NewerOlder