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
| CREATE secure_login ( | |
| `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, | |
| `email` VARCHAR(120) NOT NULL, | |
| `salt` VARCHAR(8) NOT NULL, | |
| `password` VARCHAR(40) NOT NULL, | |
| `session` VARCHAR(40) DEFAULT NULL, | |
| `disabled` TINYINT(1) UNSIGNED DEFAULT 0, | |
| # your hidden salt will be the reverse of the created_dt value | |
| `created_dt` INT(11) UNSIGNED, | |
| `modified_ts` TIMESTAMP DEFAULT CURRENT_TIMESTAMP, |
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 | |
| // sample IP | |
| $ip = '192.168.1.100'; | |
| /** | |
| * Trims the IP address and returns it in the | |
| * format XXX.XXX.XXX.0 | |
| */ | |
| function trimIP($ip) { | |
| $pos = strrpos($ip, '.'); |
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 | |
| function get_ip_address() { | |
| $ip_keys = array('HTTP_CLIENT_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_X_FORWARDED', 'HTTP_X_CLUSTER_CLIENT_IP', 'HTTP_FORWARDED_FOR', 'HTTP_FORWARDED', 'REMOTE_ADDR'); | |
| foreach ($ip_keys as $key) { | |
| if (array_key_exists($key, $_SERVER) === true) { | |
| foreach (explode(',', $_SERVER[$key]) as $ip) { | |
| // trim for safety measures | |
| $ip = trim($ip); | |
| // attempt to validate IP | |
| if (validate_ip($ip)) { |
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 | |
| class Test_Model extends Model { | |
| const HEIGHT = 100; | |
| const WIDTH = 100; | |
| const EXACT_SIZE = true; | |
| /** | |
| * Test function demonstrating how to utilize a callback function to | |
| * validate an image's height and width requirements. |
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 | |
| // you may need to add the view helper directory to your include path for autoloading | |
| set_include_path( | |
| APPLICATION_PATH . '/views/helpers' . PATH_SEPARATOR . | |
| get_include_path() | |
| ); | |
| // load the view instance, add a new helper path, and override the default escape mechanism | |
| $view = Zend_Layout::getMvcInstance()->getView(); | |
| $view->addHelperPath(APPLICATION_PATH . '/views/helpers', 'My_View_Helper'); |
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 | |
| /** | |
| * Given a string containing any combination of YouTube and Vimeo video URLs in | |
| * a variety of formats (iframe, shortened, etc), each separated by a line break, | |
| * parse the video string and determine it's valid embeddable URL for usage in | |
| * popular JavaScript lightbox plugins. | |
| * | |
| * In addition, this handler grabs both the maximize size and thumbnail versions | |
| * of video images for your general consumption. In the case of Vimeo, you must | |
| * have the ability to make remote calls using file_get_contents(), which may be |
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
| /* the following div will remain at 100% width even with padding applied */ | |
| div.padded { | |
| width: 100%; | |
| padding: 20px; | |
| } |
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 | |
| /** | |
| * The code below shows example usage of the SecureHash class for | |
| * encrypting a password. In terms of additional usage, you should | |
| * store the resulting encrypted password in addition to the salt | |
| * in your db. | |
| */ | |
| // load the class | |
| $secure = new SecureHash(); |
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
| // assumes you have a parent container with relative positioning | |
| $('a.my_tooltip').tooltip({ | |
| effect: 'fade', | |
| relative: true, | |
| predelay: 300, | |
| onBeforeShow: function() { | |
| var | |
| config = this.getConf(), | |
| $tip = this.getTip(); | |
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 | |
| function clean($value, $escape = true, $quotes = true) | |
| { | |
| $a = array( | |
| 'À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Æ', 'Ç', 'È', 'É', 'Ê', 'Ë', | |
| 'Ì', 'Í', 'Î', 'Ï', 'Ð', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', | |
| 'Ù', 'Ú', 'Û', 'Ü', 'Ý', 'ß', 'à', 'á', 'â', 'ã', 'ä', 'å', | |
| 'æ', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ñ', 'ò', | |
| 'ó', 'ô', 'õ', 'ö', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'ÿ', 'Ā', | |
| 'ā', 'Ă', 'ă', 'Ą', 'ą', 'Ć', 'ć', 'Ĉ', 'ĉ', 'Ċ', 'ċ', 'Č', |