1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
<?php
$b=$_SERVER['SERVER_NAME'];
if ( $b=="www.xxxxxxxxxxxxx.com")
{
try
{
$bdd = new PDO('mysql:host=localhost;dbname=XXXXXXXXXXX', 'BDDDDDDDDD', 'azerty');
$bdd->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$bdd->exec("SET CHARACTER SET utf8");
$localoui="SITE";
/* voir EXEPTION mieux que WARNING http://php.net/manual/fr/pdo.error-handling.php */
}
catch(Exception $e)
{
die('Erreur : '.$e->getMessage());
}
}
else
{
try
{
$bdd = new PDO('mysql:host=127.0.0.1;dbname=jplyne', 'root', '');
$bdd->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$bdd->exec("SET CHARACTER SET utf8");
}
catch(Exception $e)
{
die('Erreur : '.$e->getMessage());
}
}
function secur($a)
{
$a=str_replace("<","",$a);
$a=str_replace(">","",$a);
$a=str_replace("&&","",$a);
$a=str_replace("||","",$a);
$a=str_replace("","' ",$a);
$a=str_replace("\\","",$a);
$a=str_replace("/","",$a);
$a=str_replace(" "," ",$a);
$a=str_replace(" AND ","",$a);
$a=str_replace(" and ","",$a);
$a=str_replace(" OR ","",$a);
$a=str_replace(" or ","",$a);
$a=str_replace("","OE",$a);
$a=str_replace("","oe",$a);
$a=str_replace(" \0","",$a);
$a=str_replace("\0","",$a);
$a=str_replace("\n\n","\n",$a);
$a=str_replace("\r","",$a);
$a=str_replace("''","'",$a);
return $a;
}
?> |
Partager