92 lines
2.3 KiB
PHP
Executable File
92 lines
2.3 KiB
PHP
Executable File
<html>
|
|
|
|
<head>
|
|
<meta http-equiv="Content-Language" content="fr">
|
|
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
|
|
<title>Ajouter un Article</title>
|
|
<meta name="Microsoft Theme" content="sumipntg 011, default">
|
|
</head>
|
|
|
|
<body background="_themes/sumipntg/sumtextb.jpg" bgcolor="#FFFFFF" text="#000066" link="#3333CC" vlink="#666699" alink="#990099"><!--mstheme--><font face="Verdana, Arial, Helvetica">
|
|
<CENTER>
|
|
<?php
|
|
include("conf.php");
|
|
include("mysql_compat.php");
|
|
|
|
function getDateForMysqlDateField() {
|
|
$date = getDate();
|
|
foreach($date as $item=>$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:]/]", "<a href=\"\\0\">\\0</a>", $text);
|
|
$DATE_COURANTE = getDateForMysqlDateField();
|
|
$id_art=$_POST['id_art'];
|
|
print "<BR>AJOUT DANS LA BASE id_art = $id_art et title = $title_art<BR>";
|
|
|
|
|
|
|
|
//$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);
|
|
}
|
|
/**********************************************************************/
|
|
|
|
?>
|