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
| SELECT DATE_FORMAT(CURRENT_TIMESTAMP(), '%H%i') AS _hour, IF ( DATE_FORMAT(CURRENT_TIMESTAMP(), '%H%i') BETWEEN 1300 AND 1600, 1, 0) AS _check |
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
| SELECT trim(user_name), COUNT(user_name) AS dup_count | |
| FROM dataentry_users | |
| GROUP BY trim(user_name) | |
| HAVING (COUNT(trim(user_name)) > 1) |
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
| public static function get_flash_data($key) | |
| { | |
| if (isset($_SESSION['flash'][$key])) { | |
| $flash_data = $_SESSION['flash'][$key]; | |
| unset($_SESSION['flash'][$key]); | |
| return $flash_data; | |
| } else { | |
| return null; |
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
| public static function xss_clean($array) | |
| { | |
| foreach ($array as $key => $data) { | |
| if (is_array($data)) { | |
| $array[$key] = self::xss_clean($data); | |
| } else { |
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
| public function getClassHierarchy($obj){ | |
| if(is_object($obj)){ | |
| $class = get_class($obj); | |
| } | |
| elseif(!class_exists($obj)){ | |
| throw new InvalidArgumentException("class $obj is not defined" ); | |
| } | |
| $hierarchy = array(); | |
| while($class){ | |
| $hierarchy[] = $class; |
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 | |
| $filePath = getcwd() . "\\Input\\MyFile.pdf"; | |
| $fileName = basename($filePath); | |
| $oldText = "old text here"; | |
| $newText = "new text here"; | |
| //set application information | |
| $AppSID = "77**************"; | |
| $AppKey = "89***********"; |
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
| function fb_fan_count($facebook_name){ | |
| // Example: https://graph.facebook.com/digimantra | |
| $data = json_decode(file_get_contents("https://graph.facebook.com/".$facebook_name)); | |
| echo $data->likes; | |
| } |
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
| SELECT * FROM articles | |
| WHERE MATCH (title,body) AGAINST ('database'); |
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
| SELECT * FROM articles WHERE MATCH (title,body) | |
| AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE); |
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 | |
| // https://snipt.net/public/tag/php/?page=3 | |
| $countries = array( | |
| "AF" => array("country" => "Afghanistan", "continent" => "Asia"), | |
| "AX" => array("country" => "Åland Islands", "continent" => "Europe"), | |
| "AL" => array("country" => "Albania", "continent" => "Europe"), | |
| "DZ" => array("country" => "Algeria", "continent" => "Africa"), | |
| "AS" => array("country" => "American Samoa", "continent" => "Oceania"), |