Cela ne m'aide pas beaucoup mais je m'aperçois que je n'ai pas joint mon programme ainsi que Connection.php:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Livre d'Or</title>
<style type="text/css">
body{
background-color: bisque;
text-align:center
}
table{
background-color: burlywood;
}
td.gauche{text-align:left}
td.droite{text-align:right}
</style>
</head>
<body>
<table
style="padding: 0px; width: 90%; margin-left: auto; margin-right: auto; color: rgb(102 0, 0);"
border="0" cellpadding="2" cellspacing="2">
<tr>
<td
style="width: auto; text-align: center; color: rgb(102, 0, 0);"><a
href="index.php" style="text-decoration: none;font-size: 20px;">Accueil</a></td>
<td
style="width: auto; text-align: center; color: rgb(102, 0, 0);"><a
href="Themes.php" style="text-decoration: none;font-size: 20px;">Galerie</a></td>
<td
style="width: auto; text-align: center; color: rgb(102, 0, 0);"><a
href="Auteur.php" style="text-decoration: none;font-size: 20px;">Auteur</a></td>
<td
style="width: auto; text-align: center; color: rgb(102, 0, 0);font-size: 20px;"><a
href="liens.php" style="text-decoration: none;">Liens</a></td>
</table>
<br><br><br><br>
<?php
//ATTENTION SUR LIVRE = connexion
include("connection.php");
//Initialisation des variables
$table="tbllivredor";
$page = $_SERVER ["PHP_SELF"];
$adresseemail="[email protected]";
$name="";
$city="";
$country="";
$email="";
$url="";
$note="";
$comment="";
if (isset($_POST["txtName"])) $name=htmlspecialchars(stripslashes($_POST["txtName"]), ENT_QUOTES);
if (isset($_POST["txtCity"])) $city=htmlspecialchars(stripslashes($_POST["txtCity"]), ENT_QUOTES);
if (isset($_POST["lstCountry"])) $country=htmlspecialchars(stripslashes($_POST["lstCountry"]), ENT_QUOTES);
if (isset($_POST["txtEmail"])) $email=htmlspecialchars(stripslashes($_POST["txtEmail"]), ENT_QUOTES);
if (isset($_POST["txtUrl"])) $url=htmlspecialchars(stripslashes($_POST["txtUrl"]), ENT_QUOTES);
if (isset($_POST["txaComment"])) $comment=htmlspecialchars(stripslashes($_POST["txaComment"]), ENT_QUOTES);?>
<?php
// Si le bouton Submit a été enfoncé et que Nom et Commentaire ne sont pas vides
if (!empty($comment) && !empty($name)) {
$date = date("d/m/y"); //
//
//Sinon, envoi d'un mail au webmaster
mail($adresseemail,"Nouveau message dans le livre d'OR",$date."\nNom :".$name."\nVille :".$city."\nPays :".$country."\nMail :".$email."\nSite :".$url."\nNote :".$note."\nTexte :".$comment);
?>
<!-- -->
<p id="rep">Merci d'avoir signé le livre d'or</p>
<p>
Le message sera rajouté dès que possible
</p>
<p>
<a href="<?= $page ?>">-- Retourner sur le livre d'or --</a>
</p>
<!-- -->
<?php
}
else{
?>
<!-- -->
<h1>Bienvenue sur mon livre d'or</h1>
<p> </p>
<?php
$result = mysql_query("SELECT * FROM $table ORDER BY id_message DESC");
$total=mysql_numrows($result);
?>
<!-- -->
<table border="1" width="50%" cellspacing="0" cellpadding="5">
<tr>
<td class="gauche">[<a href="#form">Signer le Livre d'Or</a>]</td>
</tr>
</table>
<!-- -->
<?php while ($val = mysql_fetch_array($result)) { ?>
<p> </p>
<table border="0" width="50%" cellspacing="0">
<tr>
<td colspan="2" class="gauche"><b>De : </b><?= $val["nom"]; ?>
<?php if ($val["email"]) { ?> <A href="mailto:<?= $val["email"]; ?>"><small>[Écrivez moi] </small></A><?php } ?>
<?php if ($val["site"]!="http://") { ?><A href="<?= $val["site"]; ?>"><small>[Site Web] </small></A><?php } ?>
</td>
</tr>
<tr>
<td class="gauche"><?php if($val["ville"]){echo "<b>Ville : </b>".$val['ville']." "; } ?></td>
<td class="droite"><?php if($val["pays"]){echo "<b>Pays : </b>".$val['pays']."<br>"; } ?></td>
</tr>
<tr>
<td colspan="2"><b>Inscrit le : </b> <?= $val["date"]; ?></td>
</tr>
<tr>
<td colspan="2"><hr><b>Message : </b><?= str_replace("<","<",$val["commentaire"]); ?></td>
</tr>
</table>
<?php
}
?>
<!-- -->
<p><a name="form"></a> </p>
<!--Création du formulaire-->
<form method="post" action="<?= $page ?>">
<fieldset><legend>Laissez nous votre commentaire</legend>
<div style="text-align:center">
<table cellpadding="3">
<tr>
<td colspan="4">Nom <input name="txtName" value="" size="15" maxlength="30"></td>
<td colspan="4">Ville <input name="txtCity" size="15" maxlength="30"></td>
<td colspan="4">Pays <select name="lstCountry">
<option value="France" selected>France
<option value="Canada">Canada
<option value="Belgique" >Belgique
<option value="Suisse">Suisse
<option value="Luxembourg">Luxembourg
<option value="Autre">Autre
</select>
</td>
</tr>
<tr>
<td> </td>
<td colspan="5">E-mail<br><input name="txtEmail" size="20" maxlength="30"></td>
<td colspan="5">Site<br><input name="txtUrl" value="http://" size="20" maxlength="30">
</td>
<td> </td>
</tr>
<tr>
<td colspan="12"><br><textarea name="txaComment" rows="10" cols="55"></textarea>
<br><br><input type="submit" value="Signer le livre" name="bntSoumet"><input type="reset" value="Effacer"><br>
</td>
</tr>
</table>
</div>
</fieldset>
</form>
<?php
}
?>
</BODY>
</HTML>
Programme : Connection.php
<?php
$server="localhost"; // mysql server address
$dbname="bdphotos"; // mysql database name
$uid="root"; // username for that database
$pwd=""; // password for that database
$db = mysql_connect($server, $uid, $pwd);
mysql_select_db($dbname,$db)or die ("Connexion à la base impossible");
?>
Cela ne m'aide pas beaucoup mais je m'aperçois que je n'ai pas joint mon programme ainsi que Connection.php:
[php]<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Livre d'Or</title>
<style type="text/css">
body{
background-color: bisque;
text-align:center
}
table{
background-color: burlywood;
}
td.gauche{text-align:left}
td.droite{text-align:right}
</style>
</head>
<body>
<table
style="padding: 0px; width: 90%; margin-left: auto; margin-right: auto; color: rgb(102 0, 0);"
border="0" cellpadding="2" cellspacing="2">
<tr>
<td
style="width: auto; text-align: center; color: rgb(102, 0, 0);"><a
href="index.php" style="text-decoration: none;font-size: 20px;">Accueil</a></td>
<td
style="width: auto; text-align: center; color: rgb(102, 0, 0);"><a
href="Themes.php" style="text-decoration: none;font-size: 20px;">Galerie</a></td>
<td
style="width: auto; text-align: center; color: rgb(102, 0, 0);"><a
href="Auteur.php" style="text-decoration: none;font-size: 20px;">Auteur</a></td>
<td
style="width: auto; text-align: center; color: rgb(102, 0, 0);font-size: 20px;"><a
href="liens.php" style="text-decoration: none;">Liens</a></td>
</table>
<br><br><br><br>
<?php
//ATTENTION SUR LIVRE = connexion
include("connection.php");
//Initialisation des variables
$table="tbllivredor";
$page = $_SERVER ["PHP_SELF"];
$adresseemail="
[email protected]";
$name="";
$city="";
$country="";
$email="";
$url="";
$note="";
$comment="";
if (isset($_POST["txtName"])) $name=htmlspecialchars(stripslashes($_POST["txtName"]), ENT_QUOTES);
if (isset($_POST["txtCity"])) $city=htmlspecialchars(stripslashes($_POST["txtCity"]), ENT_QUOTES);
if (isset($_POST["lstCountry"])) $country=htmlspecialchars(stripslashes($_POST["lstCountry"]), ENT_QUOTES);
if (isset($_POST["txtEmail"])) $email=htmlspecialchars(stripslashes($_POST["txtEmail"]), ENT_QUOTES);
if (isset($_POST["txtUrl"])) $url=htmlspecialchars(stripslashes($_POST["txtUrl"]), ENT_QUOTES);
if (isset($_POST["txaComment"])) $comment=htmlspecialchars(stripslashes($_POST["txaComment"]), ENT_QUOTES);?>
<?php
// Si le bouton Submit a été enfoncé et que Nom et Commentaire ne sont pas vides
if (!empty($comment) && !empty($name)) {
$date = date("d/m/y"); //
//
//Sinon, envoi d'un mail au webmaster
mail($adresseemail,"Nouveau message dans le livre d'OR",$date."\nNom :".$name."\nVille :".$city."\nPays :".$country."\nMail :".$email."\nSite :".$url."\nNote :".$note."\nTexte :".$comment);
?>
<!-- -->
<p id="rep">Merci d'avoir signé le livre d'or</p>
<p>
Le message sera rajouté dès que possible
</p>
<p>
<a href="<?= $page ?>">-- Retourner sur le livre d'or --</a>
</p>
<!-- -->
<?php
}
else{
?>
<!-- -->
<h1>Bienvenue sur mon livre d'or</h1>
<p> </p>
<?php
$result = mysql_query("SELECT * FROM $table ORDER BY id_message DESC");
$total=mysql_numrows($result);
?>
<!-- -->
<table border="1" width="50%" cellspacing="0" cellpadding="5">
<tr>
<td class="gauche">[<a href="#form">Signer le Livre d'Or</a>]</td>
</tr>
</table>
<!-- -->
<?php while ($val = mysql_fetch_array($result)) { ?>
<p> </p>
<table border="0" width="50%" cellspacing="0">
<tr>
<td colspan="2" class="gauche"><b>De : </b><?= $val["nom"]; ?>
<?php if ($val["email"]) { ?> <A href="mailto:<?= $val["email"]; ?>"><small>[Écrivez moi] </small></A><?php } ?>
<?php if ($val["site"]!="http://") { ?><A href="<?= $val["site"]; ?>"><small>[Site Web] </small></A><?php } ?>
</td>
</tr>
<tr>
<td class="gauche"><?php if($val["ville"]){echo "<b>Ville : </b>".$val['ville']." "; } ?></td>
<td class="droite"><?php if($val["pays"]){echo "<b>Pays : </b>".$val['pays']."<br>"; } ?></td>
</tr>
<tr>
<td colspan="2"><b>Inscrit le : </b> <?= $val["date"]; ?></td>
</tr>
<tr>
<td colspan="2"><hr><b>Message : </b><?= str_replace("<","<",$val["commentaire"]); ?></td>
</tr>
</table>
<?php
}
?>
<!-- -->
<p><a name="form"></a> </p>
<!--Création du formulaire-->
<form method="post" action="<?= $page ?>">
<fieldset><legend>Laissez nous votre commentaire</legend>
<div style="text-align:center">
<table cellpadding="3">
<tr>
<td colspan="4">Nom <input name="txtName" value="" size="15" maxlength="30"></td>
<td colspan="4">Ville <input name="txtCity" size="15" maxlength="30"></td>
<td colspan="4">Pays <select name="lstCountry">
<option value="France" selected>France
<option value="Canada">Canada
<option value="Belgique" >Belgique
<option value="Suisse">Suisse
<option value="Luxembourg">Luxembourg
<option value="Autre">Autre
</select>
</td>
</tr>
<tr>
<td> </td>
<td colspan="5">E-mail<br><input name="txtEmail" size="20" maxlength="30"></td>
<td colspan="5">Site<br><input name="txtUrl" value="http://" size="20" maxlength="30">
</td>
<td> </td>
</tr>
<tr>
<td colspan="12"><br><textarea name="txaComment" rows="10" cols="55"></textarea>
<br><br><input type="submit" value="Signer le livre" name="bntSoumet"><input type="reset" value="Effacer"><br>
</td>
</tr>
</table>
</div>
</fieldset>
</form>
<?php
}
?>
</BODY>
</HTML>[/php]
Programme : Connection.php
[php]<?php
$server="localhost"; // mysql server address
$dbname="bdphotos"; // mysql database name
$uid="root"; // username for that database
$pwd=""; // password for that database
$db = mysql_connect($server, $uid, $pwd);
mysql_select_db($dbname,$db)or die ("Connexion à la base impossible");
?>[/php]