[PHP] Problème de syntaxe
Max
-
berday1701 -
berday1701 -
Bonjour,
j'ai trouvé un script sur internet pour permettre à l'administrateur d'un site de modifier une page web sans avoir a utiliser les fonctions html...
Le seul problème est que lorsqu'il tape des accents exemple "é", tous ce qui suit celui ci disparaît
Prenons par exemple le cas ou l'administrateur taperé :" j'ai allumé du feu " Sur la page concerné par cette modification apparaîtra " jai allum " ---> " é du feu " aura disparu.
Voila donc si quelqu'un conné la solution merci de repondre à ce post.
Voici mon code:
<?php
require_once '../config.php';
require_once '../fonctions.php';
$mode = 'ajouter_valid';
$datenow = date("d-m-Y",time());
if (isset($_POST['ajouter_valid'])) {
$nom = mysql_real_escape_string($_POST['nom']);
$clic = mysql_real_escape_string($_POST['clic']);
$url = mysql_real_escape_string($_POST['url']);
$desc = mysql_real_escape_string($_POST['description']);
$datefr = mysql_real_escape_string($_POST['datefr']);
$date = datefrenus($datefr);
$sql = "INSERT INTO ".DB_TABLE_DL." (nom, url,
description, clic, date) VALUES ('".$nom."', '".$url."',
'".$desc."', '".$clic."', '".$date."')";
mysql_query($sql);
} else if (isset($_POST['modifier_valid']) &&
is_numeric($_POST['idtelech'])) {
$nom = mysql_real_escape_string($_POST['nom']);
$clic = mysql_real_escape_string($_POST['clic']);
$url = mysql_real_escape_string($_POST['url']);
$desc = mysql_real_escape_string($_POST['description']);
$datefr = mysql_real_escape_string($_POST['datefr']);
$date = datefrenus($datefr);
$sql = "UPDATE ".DB_TABLE_DL."
SET nom='".$nom."', url='".$url."',
description='".$desc."',clic='".$clic."',date='".$date."'
WHERE id = '".$_POST['idtelech']."'";
mysql_query($sql);
} else if (is_numeric($_GET['modifier'])) {
$mode = 'modifier_valid';
$sql = "SELECT id, nom, url, description, clic,
DATE_FORMAT(date,'%d-%m-%Y') AS datefr
FROM ".DB_TABLE_DL."
WHERE id = '".$_GET['modifier']."'";
$req = mysql_query($sql);
if ($req) $telech = mysql_fetch_array($req);
$desc = stripslashes($telech['description']);
$nom = stripslashes($telech['nom']);
$url = stripslashes($telech['url']);
$datefr = stripslashes($telech['datefr']);
$id = $telech['id'];
$clic = $telech['clic'];
} else if (is_numeric($_GET['supprimer'])) {
$sql = "DELETE FROM ".DB_TABLE_DL."
WHERE id = '".$_GET['supprimer']."'";
mysql_query($sql);
}
echo '<?xml version="1.0" encoding="iso-8859-1"?>';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="admin.css" />
</head>
<body>
<h1></h1>
<!-- Le bloc du formulaire d'ajout / modification -->
<div id="formulaire">
<h2>
<?php
if ($mode == 'modifier_valid') echo 'Modifier ';
else echo 'Ajouter ';
?>un Sujet
</h2>
<form method="post" action="">
<table width="500" border="0" class="encadre">
<tr>
<th>Nom : </th>
<td>
<?php
echo '<input type="text" name="nom" size="30" value="';
if ($mode == 'modifier_valid') echo trim(htmlentities(stripslashes($nom)));
echo '" />';
?> </td>
</tr>
<tr>
<th>Lien : </th>
<td>
<?php
echo '<input type="text" name="url" value="';
if ($mode == 'modifier_valid') echo $url;
echo '" />';
?>
</td>
</tr>
<tr>
<th>Nombre de clic : </th>
<td>
<?php
echo '<input type="text" name="clic" value="';
if ($mode == 'modifier_valid') echo $clic;
else echo "0";
echo '" />';
?>
</td>
</tr>
<tr>
<th>Date d'ajout : </th>
<td>
<?php
echo '<input type="text" name="datefr" value="';
if ($mode == 'modifier_valid') echo $datefr;
else echo $datenow;
echo '" />';
?>
</td>
</tr>
<tr>
<th>Description : </th>
<td>
<?php
echo '<textarea rows=4 COLS=15 name="description">';
if ($mode == 'modifier_valid') echo trim(htmlentities(stripslashes($desc)));
echo '</textarea>';
?>
</td>
</tr>
<tr>
<td> </td>
<td>
<?php
echo '<input type="hidden" name="idtelech" value="';
if ($mode == 'modifier_valid') echo $id;
echo '" />';
echo '<input type="submit" name="';
echo $mode;
echo '" value="Valider" />';
?>
</td>
</tr>
</table>
</form>
</div>
<!-- Le bloc de la liste -->
<div id="listing">
<h2>Liste des Sujets</h2>
<p>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">
LA JE NE SAIS PAS A QUOI SA SERT SI QUELQU'UN POUVAIT M' EXPLIQUER </a>
</p>
<?php
$sql = "SELECT id, nom, url, description, clic,
DATE_FORMAT(date,'%d-%m-%Y') AS datefr
FROM ".DB_TABLE_DL." ORDER BY nom ASC";
$req = mysql_query($sql);
while ($telech = mysql_fetch_array($req))
{
$nom = stripslashes($telech['nom']);
$url = stripslashes($telech['url']);
$desc = stripslashes($telech['description']);
$id = $telech['id'];
echo '<a href="'.$url.'" ';
// visite du Sujet dans une nouvelle fenêtre
// target n'est pas utilisable en xhtml strict
echo 'onclick="window.open(this.href);return false;">';
echo $nom;
echo '</a> ';
echo '<a href="?modifier='.$id.'">[éditer]</a> ';
echo '<a href="?supprimer='.$id.'" onClick="return ';
echo 'confirm(\'Êtes vous sûr de vouloir ';
echo 'supprimer?\');">[supprimer]</a>';
echo '<br/>';
}
?>
</div>
</body>
</html>
P.S: Quelqu'un sait il comment je peut faire pour rajouter un petit boutton qui me permetera de suprimer plusieur fichier en même temps (fichiers selectionés).
Merci pour votre aide.
j'ai trouvé un script sur internet pour permettre à l'administrateur d'un site de modifier une page web sans avoir a utiliser les fonctions html...
Le seul problème est que lorsqu'il tape des accents exemple "é", tous ce qui suit celui ci disparaît
Prenons par exemple le cas ou l'administrateur taperé :" j'ai allumé du feu " Sur la page concerné par cette modification apparaîtra " jai allum " ---> " é du feu " aura disparu.
Voila donc si quelqu'un conné la solution merci de repondre à ce post.
Voici mon code:
<?php
require_once '../config.php';
require_once '../fonctions.php';
$mode = 'ajouter_valid';
$datenow = date("d-m-Y",time());
if (isset($_POST['ajouter_valid'])) {
$nom = mysql_real_escape_string($_POST['nom']);
$clic = mysql_real_escape_string($_POST['clic']);
$url = mysql_real_escape_string($_POST['url']);
$desc = mysql_real_escape_string($_POST['description']);
$datefr = mysql_real_escape_string($_POST['datefr']);
$date = datefrenus($datefr);
$sql = "INSERT INTO ".DB_TABLE_DL." (nom, url,
description, clic, date) VALUES ('".$nom."', '".$url."',
'".$desc."', '".$clic."', '".$date."')";
mysql_query($sql);
} else if (isset($_POST['modifier_valid']) &&
is_numeric($_POST['idtelech'])) {
$nom = mysql_real_escape_string($_POST['nom']);
$clic = mysql_real_escape_string($_POST['clic']);
$url = mysql_real_escape_string($_POST['url']);
$desc = mysql_real_escape_string($_POST['description']);
$datefr = mysql_real_escape_string($_POST['datefr']);
$date = datefrenus($datefr);
$sql = "UPDATE ".DB_TABLE_DL."
SET nom='".$nom."', url='".$url."',
description='".$desc."',clic='".$clic."',date='".$date."'
WHERE id = '".$_POST['idtelech']."'";
mysql_query($sql);
} else if (is_numeric($_GET['modifier'])) {
$mode = 'modifier_valid';
$sql = "SELECT id, nom, url, description, clic,
DATE_FORMAT(date,'%d-%m-%Y') AS datefr
FROM ".DB_TABLE_DL."
WHERE id = '".$_GET['modifier']."'";
$req = mysql_query($sql);
if ($req) $telech = mysql_fetch_array($req);
$desc = stripslashes($telech['description']);
$nom = stripslashes($telech['nom']);
$url = stripslashes($telech['url']);
$datefr = stripslashes($telech['datefr']);
$id = $telech['id'];
$clic = $telech['clic'];
} else if (is_numeric($_GET['supprimer'])) {
$sql = "DELETE FROM ".DB_TABLE_DL."
WHERE id = '".$_GET['supprimer']."'";
mysql_query($sql);
}
echo '<?xml version="1.0" encoding="iso-8859-1"?>';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
<title></title>
<link rel="stylesheet" type="text/css" href="admin.css" />
</head>
<body>
<h1></h1>
<!-- Le bloc du formulaire d'ajout / modification -->
<div id="formulaire">
<h2>
<?php
if ($mode == 'modifier_valid') echo 'Modifier ';
else echo 'Ajouter ';
?>un Sujet
</h2>
<form method="post" action="">
<table width="500" border="0" class="encadre">
<tr>
<th>Nom : </th>
<td>
<?php
echo '<input type="text" name="nom" size="30" value="';
if ($mode == 'modifier_valid') echo trim(htmlentities(stripslashes($nom)));
echo '" />';
?> </td>
</tr>
<tr>
<th>Lien : </th>
<td>
<?php
echo '<input type="text" name="url" value="';
if ($mode == 'modifier_valid') echo $url;
echo '" />';
?>
</td>
</tr>
<tr>
<th>Nombre de clic : </th>
<td>
<?php
echo '<input type="text" name="clic" value="';
if ($mode == 'modifier_valid') echo $clic;
else echo "0";
echo '" />';
?>
</td>
</tr>
<tr>
<th>Date d'ajout : </th>
<td>
<?php
echo '<input type="text" name="datefr" value="';
if ($mode == 'modifier_valid') echo $datefr;
else echo $datenow;
echo '" />';
?>
</td>
</tr>
<tr>
<th>Description : </th>
<td>
<?php
echo '<textarea rows=4 COLS=15 name="description">';
if ($mode == 'modifier_valid') echo trim(htmlentities(stripslashes($desc)));
echo '</textarea>';
?>
</td>
</tr>
<tr>
<td> </td>
<td>
<?php
echo '<input type="hidden" name="idtelech" value="';
if ($mode == 'modifier_valid') echo $id;
echo '" />';
echo '<input type="submit" name="';
echo $mode;
echo '" value="Valider" />';
?>
</td>
</tr>
</table>
</form>
</div>
<!-- Le bloc de la liste -->
<div id="listing">
<h2>Liste des Sujets</h2>
<p>
<a href="<?php echo $_SERVER['PHP_SELF']; ?>">
LA JE NE SAIS PAS A QUOI SA SERT SI QUELQU'UN POUVAIT M' EXPLIQUER </a>
</p>
<?php
$sql = "SELECT id, nom, url, description, clic,
DATE_FORMAT(date,'%d-%m-%Y') AS datefr
FROM ".DB_TABLE_DL." ORDER BY nom ASC";
$req = mysql_query($sql);
while ($telech = mysql_fetch_array($req))
{
$nom = stripslashes($telech['nom']);
$url = stripslashes($telech['url']);
$desc = stripslashes($telech['description']);
$id = $telech['id'];
echo '<a href="'.$url.'" ';
// visite du Sujet dans une nouvelle fenêtre
// target n'est pas utilisable en xhtml strict
echo 'onclick="window.open(this.href);return false;">';
echo $nom;
echo '</a> ';
echo '<a href="?modifier='.$id.'">[éditer]</a> ';
echo '<a href="?supprimer='.$id.'" onClick="return ';
echo 'confirm(\'Êtes vous sûr de vouloir ';
echo 'supprimer?\');">[supprimer]</a>';
echo '<br/>';
}
?>
</div>
</body>
</html>
P.S: Quelqu'un sait il comment je peut faire pour rajouter un petit boutton qui me permetera de suprimer plusieur fichier en même temps (fichiers selectionés).
Merci pour votre aide.
A voir également:
- [PHP] Problème de syntaxe
- Easy php - Télécharger - Divers Web & Internet
- Expert php pinterest - Télécharger - Langages
- Trouver erreur de syntaxe fichier txt pix ✓ - Forum Windows
- Trouver erreur de syntaxe fichier txt ✓ - Forum PHP
- Impossible d'ouvrir un fichier txt avec Python ✓ - Forum Python