This file contains 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
error_reporting = E_ALL & ~E_STRICT & ~E_DEPRECATED & ~E_WARNING |
This file contains 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 get_nom_image($dirname){ | |
$ext = array("jpg", "png", "jpeg", "gif", "JPG", "PNG", "GIF", "JPEG"); | |
$imageName=''; | |
if($handle = opendir($dirname)) | |
{ | |
while(false!== ($file = readdir($handle))) | |
{ | |
if(strstr($file, "." . $ext[$i])!= '.' && strstr($file, "." . $ext[$i])!= '..') | |
{ | |
break; |
This file contains 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
par mois | |
where MONTH(a.created) = '.$mois.' |
This file contains 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 get_client_language($availableLanguages, $default='en'){ | |
if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { | |
$langs=explode(',',$_SERVER['HTTP_ACCEPT_LANGUAGE']); | |
foreach ($langs as $value){ | |
$choice=substr($value,0,2); | |
if(in_array($choice, $availableLanguages)){ | |
return $choice; | |
} | |
} |
This file contains 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 | |
// Our custom error handler | |
function nettuts_error_handler($number, $message, $file, $line, $vars){ | |
$email = " | |
<p>An error ($number) occurred on line | |
<strong>$line</strong> and in the <strong>file: $file.</strong> | |
<p> $message </p>"; | |
$email .= "<pre>" . print_r($vars, 1) . "</pre>"; |
This file contains 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 | |
// Permet d'obtenir les entrés contenu dans un rayon ($within) | |
$latitude = 45.545421; | |
$longitude = -73.59288; | |
$within = 100; | |
$query = " | |
SELECT `zip_code`, (6371 * acos(cos(radians($latitude)) * cos(radians(`lat`)) * cos(radians(`long`) - radians($longitude)) + sin(radians($latitude)) * sin(radians(`lat`)))) | |
AS `distance` |
This file contains 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 cleanInput($input) { | |
$search = array( | |
'@<script[^>]*?>.*?</script>@si', // Strip out javascript | |
'@<[\/\!]*?[^<>]*?>@si', // Strip out HTML tags | |
'@<style[^>]*?>.*?</style>@siU', // Strip style tags properly | |
'@<![\s\S]*?--[ \t\n\r]*>@' // Strip multi-line comments | |
); | |
$output = preg_replace($search, '', $input); | |
return $output; |