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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
| <?php
include( '../inc/dbinfos.inc.php' );
function dbconn()
{
$cnx = @mysql_connect( DBSERVER, DBLOGIN, DBPASSWORD ) or die( "could not connect to database" );
mysql_select_db( DBNAME, $cnx );
return $cnx;
}
function antiquote( $thestr )
{
$thestr = ereg_replace( "\\\\'", ''', $thestr );
$thestr = ereg_replace( "\\\\\"", '"', $thestr );
$thestr = ereg_replace( "\\\\\\\\", '\\', $thestr );
$thestr = ereg_replace( "(\r\n)|(\n)", '<br>', $thestr );
return $thestr;
}
function ar2glob( $arname )
{
global $$arname;
if (isset($$arname)){
reset ($$arname);
while (list ($key, $val) = each ($$arname)) {
$GLOBALS[$key] = is_string( $val ) ? stripslashes($val) : $val;
}
}
}
function unslashpost()
{
ar2glob( 'HTTP_POST_VARS' );
}
function unslashdata( $phpdata ){
}
if ( isset( $phpdata ) ) eval( stripslashes( $phpdata ) );{
}
function forminput( $nom, $type, $value, $attr='' )
{
$value = htmlspecialchars( $value );
return "<input name=\"$nom\" type=$type " . ($attr?"$attr ":"") . "value=\"$value\">";
}
function strfprepare( $s )
{
$s = ereg_replace('[[:cntrl:]]', '', $s);
$s = htmlspecialchars( $s );
$s = addslashes( $s );
return $s;
}
function controle($ctrl,$chaine){
$chaine_controle = stripslashes(trim($chaine));
switch($ctrl){
case("special"):
$chaine_controle = ereg("^[0-9a-zA-Z' .:+,\\-]+$ëéèàäâêù",$chaine_controle);
break;
}
if($chaine_controle) return $chaine; else return "";
}
function moulinette( $s )
{
$s = controle("special",$s);
$s = strtolower ($s);
$s = str_replace("+"," ",trim($s));
$s = str_replace("\\"," ",$s);
$s = str_replace(","," ",$s);
$s = str_replace(":"," ",$s);
return $s;
}
?> |
Partager