Files
resatennis_tyroltenn/www/site_inscription/edit_article.php

121 lines
2.9 KiB
PHP
Executable File

<?php
include("mysql_compat.php");
$db=mysql_connect('o2000', 'jmevel', 'jmevel01');
mysql_select_db("tournois_tennis_v2", $db);
$s='\'';
<html>
<head>
<meta http-equiv="Content-Language" content="fr">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>pour consulter la base</title>
</head>
<body background="_themes/sumipntg/sumtextb.jpg" bgcolor="#FFFFFF" text="#000066" link="#3333CC" vlink="#666699" alink="#990099"><!--mstheme--><font face="Verdana, Arial, Helvetica">
<?php
include("mysql_compat.php");
# grab information about current article
$sql = "SELECT * FROM kb where id_art=$id_art;";
$result=mysql_query($sql,$db);
while ($item = mysql_fetch_array($result))
{
$title=$item["title"];
$content=$item["text"];
$date=$item["date"];
printf("<option VALUE=\"%s\">%s", $item["name"], $item["name"]);
}
# retrouve category_name en fonction de category_num
$sql = "SELECT name FROM categories where id=$cat_selected_num";
$result=mysql_query($sql,$db);
$item = mysql_fetch_array($result);
$cat_selected=$item["name"];
?>
<form name="monform"
method="POST"
action="result_edit.php?id=<?echo $id ?>">
<p><H1>Edition d'Article</H1></p>
<TABLE width="100%" border=0>
<TR><TD align=right>Rubrique :</TD><TD><B><? print $cat_selected; ?></TD></TR>
<TR><TD align=right></b>Changer la rubrique: </TD>
<TD><select NAME="category_selected">
<?php
include("mysql_compat.php");
$sql = "SELECT * FROM categories;";
$result=mysql_query($sql,$db);
while ($item = mysql_fetch_array($result))
{
if ($category_selected == NULL) { $category_selected = $item["name"];}
if ($item["name"] != $cat_selected) { printf("<option VALUE=\"%s\">%s", $item["name"], $item["name"]);}
else { printf("<option SELECTED VALUE=\"%s\">%s", $item["name"], $item["name"]);}
}
?> </select>
</TD></TR>
<TR><TD align=right>Titre de l'article :</TD><TD><input type="text" name="title" value=<? print "$s$title$s"; ?> size=101 maxlength=255></TD></TR>
<TR><TD align=right>Contenu de l'article : </TD>
<TD><input TYPE="hidden" NAME="text" VALUE="0">
<textarea rows="10" name="text" cols="76"><? print htmlescape($content); ?></textarea></TD></TR>
</TABLE>
<p>
<align="center"><input type="submit" value="Envoyer" name="B1">
</form>
</p>
</CENTER>
<p>&nbsp;</p>
</font></body>
</html>
<?php
include("mysql_compat.php");
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 = '&copy;';
if($ch == "\\xA8") $ch = '&reg;';
if($ch == '&') $ch = '&amp;';
if($ch == '"') $ch = '&quot;';
if($ch == '<') $ch = '&lt;';
if($ch == '>') $ch = '&gt;';
#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);
}
/**********************************************************************/