Profil supprimé | Code :
- <?php
- require etc...
- authentification etc ...
- ?>
- <?php
- mysql_select_db($database_NDO, $NDO);
- $query_rsNews = "SELECT * FROM news";
- $rsNews = mysql_query($query_rsNews, $NDO) or die(mysql_error());
- $row_rsNews = mysql_fetch_assoc($rsNews);
- $totalRows_rsNews = mysql_num_rows($rsNews);
- ?>
- <?php
- function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "" )
- {
- $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;
- switch ($theType) {
- case "text":
- $theValue = ($theValue != "" ) ? "'" . $theValue . "'" : "NULL";
- break;
- case "long":
- case "int":
- $theValue = ($theValue != "" ) ? intval($theValue) : "NULL";
- break;
- case "double":
- $theValue = ($theValue != "" ) ? "'" . doubleval($theValue) . "'" : "NULL";
- break;
- case "date":
- $theValue = ($theValue != "" ) ? "'" . $theValue . "'" : "NULL";
- break;
- case "defined":
- $theValue = ($theValue != "" ) ? $theDefinedValue : $theNotDefinedValue;
- break;
- }
- return $theValue;
- }
- if ((isset($_GET['ID'])) && ($_GET['ID'] != "" )) {
- $deleteSQL = sprintf("DELETE FROM news WHERE ID=%s",
- GetSQLValueString($_GET['ID'], "int" ));
- mysql_select_db($database_NDO, $NDO);
- $Result1 = mysql_query($deleteSQL, $NDO) or die(mysql_error());
- $deleteGoTo = "suppr_news.php";
- if (isset($_SERVER['QUERY_STRING'])) {
- $deleteGoTo .= (strpos($deleteGoTo, '?')) ? "&" : "?";
- $deleteGoTo .= $_SERVER['QUERY_STRING'];
- // SUPPRESSION DE LIMAGE DE LA NEWS : on recupere les varialbes d'URL $IMG et $GAL (nom image et nom galerie)
- $photo_news = '../images/news/'.$_GET['PHOTO']; // chemin de la grande Image
- unlink($photo_news);
- // FIN SUPPRESSION
- }
- header(sprintf("Location: %s", $deleteGoTo));
- }
- mysql_select_db($database_NDO, $NDO);
- $query_rsAfficherNews = "SELECT * FROM news ORDER BY `date` DESC";
- $rsAfficherNews = mysql_query($query_rsAfficherNews, $NDO) or die(mysql_error());
- $row_rsAfficherNews = mysql_fetch_assoc($rsAfficherNews);
- $totalRows_rsAfficherNews = mysql_num_rows($rsAfficherNews);
- ?>
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
- <html><!-- InstanceBegin template="../Templates/admin.php" codeOutsideHTMLIsLocked="false" -->
- <head>
- <title>NDO ::: Administration :::</title>
- <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
- <link href="admin.css" rel="stylesheet" type="text/css">
- </head>
- <body>
- <br />
- <table width="160" border="0" cellspacing="0" cellpadding="3">
- <tr>
- <td height="9" valign="top">
- <select name="News" class= "inputLinks" onChange="if (this.options[this.selectedIndex].value!=0) window.open(this.options[this.selectedIndex].value, '_self')" HSPACE="0" VSPACE="0">
- <option value="0" class= "inputLinksRub">:: News ::</option><OPTION></OPTION><OPTION VALUE="ajout_news.php" class ="inputLinks">Ajouter News</option><OPTION VALUE="modif_news.php" class ="inputLinks">Modifier News</option><OPTION VALUE="suppr_news.php" class ="inputLinks">Supprimer News</option>
- </select>
- </td>
- </tr>
- <tr>
- <td height="9" valign="top">
- <select name="Images" class= "inputLinks" onChange="if (this.options[this.selectedIndex].value!=0) window.open(this.options[this.selectedIndex].value, '_self')" HSPACE="0" VSPACE="0">
- <option value="0" class= "inputLinksRub">:: Galerie ::</option><OPTION></OPTION><OPTION VALUE="ajout_img.php" class ="inputLinks">Ajouter Image</option><OPTION VALUE="modif_img.php" class ="inputLinks">Modifier Image</option><OPTION VALUE="suppr_img.php" class ="inputLinks">Supprimer Image</option><OPTION VALUE="suppr_gal.php" class ="inputLinks">Supprimer Galerie</option>
- </tr>
- </table>
- <br />
- <!-- InstanceBeginEditable name="EditRegion1" --><table width=650 border=2 align="center" bordercolor="#973636" bgcolor="#973636" cellspacing="0">
- <tr>
- <td width=15 bordercolor="#973636" bgcolor="#973636"><img src="icohlp.gif"></td>
- <td bordercolor="#973636" bgcolor="973636"><div align="left"><font color="#ffffff"><b> SUPPRIMER une News </b>(Cliquez sur le Numéro ID correspondant à la nouvelle pour la SUPPRIMER)</font></div></td>
- </tr>
- <tr>
- <td width=30 bordercolor="#973636" bgcolor="973636"></td>
- <td bgcolor="#F1EDEC">
- <table border="1" class="php" width="100%">
- <tr class="titre" bgcolor="#ABA27F">
- <td><H4>ID</H4></td>
- <td><H4>date</H4></td>
- <td><H4>titre</H4></td>
- <td><H4>contenu</H4></td>
- </tr>
- <?php $x = 1; do { ?>
- <tr>
- <td><?php echo '<a href=suppr_news.php?ID='.$row_rsAfficherNews['ID'].'&PHOTO='.$row_rsAfficherNews['photo'].">"; echo $row_rsAfficherNews['ID']; ?></a></td>
- <td><?php echo convert_date($row_rsAfficherNews['date']); ?></td>
- <td><?php echo $row_rsAfficherNews['titre']; ?></td>
- <td><?php echo $row_rsAfficherNews['contenu']; ?></td>
- </tr>
- <?php $x++; ?>
- <?php } while ($row_rsAfficherNews = mysql_fetch_assoc($rsAfficherNews)); ?>
- </table>
- </td>
- </tr>
- </table><!-- InstanceEndEditable --></center>
- </body>
- <!-- InstanceEnd --></html>
- <?php
- mysql_free_result($rsAfficherNews);
- ?>
|
Message édité par Profil supprimé le 20-01-2005 à 13:20:57
|