$value) {
if ($value < 10)
$date[$item] = "0".$value;
}
return $date['year']."-".$date['mon']."-".$date['mday']." ".$date['hours'].":".$date['minutes'].":".$date['seconds'];
}
$BASETABLE =" kb";
$s='\'';
$db=mysql_connect('o2000', 'jmevel', 'jmevel01');
mysql_select_db("tournois_tennis_v2", $db);
$text=htmlescape($text_art);
$text2 = ereg_replace("[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]", "\\0", $text);
$DATE_COURANTE = getDateForMysqlDateField();
$id_art=$_POST['id_art'];
print "
AJOUT DANS LA BASE id_art = $id_art et title = $title_art
";
//$sql="SELECT id_art from articles WHERE name=$s$category$s";
//$result=mysql_query($sql,$db);
//$item = mysql_fetch_array($result);
//$catnum=$item["id"];
$sql="INSERT INTO $BASETABLE (id_art, title, text, date) values ($id_art, $s$title_art$s, $s$text2$s, $s$DATE_COURANTE$s)";
$result=mysql_query($sql,$db);
if ($result == 0)
{
print "Problem. Veuillez consulter l'administrateur de ce charmant outil";
}
else
{
print "L'article a été posté";
}
?>
function htmlescape ($input) {
$output = '';
while(1) {
if($input == '')
break;
$ch = substr($input,0,1);
$templen = strlen($input) - 1;
$input = substr($input,1,$templen);
if($ch == "\\xA9") $ch = '©';
if($ch == "\\xA8") $ch = '®';
if($ch == '&') $ch = '&';
if($ch == '"') $ch = '"';
if($ch == '<') $ch = '<';
if($ch == '>') $ch = '>';
#if(ord($ch) > 126) $ch = '';
#if(ord($ch) < 9) $ch = '';
#if(ord($ch) == 11) $ch = '';
#if(ord($ch) > 14 && ord($ch) < 32) $ch = '';
$output = $output . $ch;
}
return($output);
}
/**********************************************************************/
?>