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 locDistance($lat1, $lon1, $lat2, $lon2) { | |
| $theta = $lon1 - $lon2; | |
| $dist = sin(deg2rad($lat1)) * sin(deg2rad($lat2)) + cos(deg2rad($lat1)) * cos(deg2rad($lat2)) * cos(deg2rad($theta)); | |
| $dist = acos($dist); | |
| $dist = rad2deg($dist); | |
| $miles = $dist * 60 * 1.1515; | |
| return ($miles * 1.609344 * 1000); |
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 readCookie(name) { | |
| var nameEQ = name + "="; | |
| var ca = document.cookie.split(';'); | |
| for(var i=0;i < ca.length;i++) { | |
| var c = ca[i]; | |
| while (c.charAt(0)==' ') c = c.substring(1,c.length); | |
| if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); | |
| } | |
| 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
| <?php | |
| define ('SECRET', 'Your_secret_here'); | |
| if (isset($_GET['challenge'])) { | |
| echo $_GET['challenge']; | |
| } else { | |
| $raw_data = file_get_contents('php://input'); | |
| if ($raw_data) { | |
| $json = json_decode($raw_data); | |
| if (is_object($json)) { |
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 format_phone($phone = '', $convert = false, $trim = true) { | |
| if (empty($phone)) return ''; | |
| $phone = preg_replace("/[^0-9A-Za-z]/", "", $phone); | |
| if ($convert == true) { | |
| $replace = array('2'=>array('a','b','c'),'3'=>array('d','e','f'),'4'=>array('g','h','i'),'5'=>array('j','k','l'),'6'=>array('m','n','o'),'7'=>array('p','q','r','s'),'8'=>array('t','u','v'), '9'=>array('w','x','y','z')); | |
| foreach($replace as $digit=>$letters) { | |
| $phone = str_ireplace($letters, $digit, $phone); | |
| } | |
| } |
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 | |
| $bom = pack('H*','EFBBBF'); | |
| $json = preg_replace("/^$bom/", '', $json); |
OlderNewer