/******************************************************************************** Guestbook by lyonchik: nerd@kic.kmtn.ru Contact me to report bugs, give your comments or to develop your own personalized Web applications. This is a simple guestbook. It consists only of one file. All you need to do is create a MYSQL database table and set the variables below to conform to your settings and that's it. The sample query to create a table should be: "CREATE TABLE guestbook (id int(5) NOT NULL auto_increment, name varchar(20), email varchar(20), message text, date datetime, PRIMARY KEY (id))" And the guestbook is ready to go. Enjoy! You can freely distribute this code. For any suggestions and comments write to: 'nerd@kic.kmtn.ru'. Feel free to email me URLs where this guestbook works, I would love to hear that my work is appreciated. *********************************************************************************/ // Define MYSQL server information $server = 'sql.msoctave.com'; // MYSQL server; $user = 'msoctavecom'; // User to connect to MYSQL server; $password = 'Knnr-738'; // Password; $database = 'msoctavecom'; // The name of the database; $table = 'guestbook_lucie'; // The name of your database table; // Define page layout variables $guestbook_name = "Bienvenue dans notre guestbook"; // Guestbook page name; $titlecolor = 'black'; // Title font color; $tablewidth = "90%"; // Table width in pixels or percentage; $bordersize = 2; // Table border size; $cellspacing = 0; // Table cellspacing value; $cellpadding = 5; // Table cellpadding value; $messagecellcolor = '#BBAAAA'; // message cell color; $namecolor = '#0000EE'; // name font color; $messagecolor = '#000099'; // message font color; $mainfont = '#000033'; // main text font color; $maxshow = 10; // Number of messages to display per page; ?>
Ici, tu peux nous laisser un petit message. Notre papa ou notre maman le relayeront, sois-en sûr !
"; if (isset($message)) { if ($email == "") { $email = "no_email"; } else $email = strip_html_tags($email); $message=strip_html_tags($message); $name = strip_html_tags($name); $a = strtoupper($_POST['ecris']); $b = 'LUCIE'; if ($a == 'LUCIE' || $a == 'CAMILLE' || $a == 'LAURANE') { mysql_connect ($server, $user, $password) or die ("Can't connect!"); mysql_select_db ($database) or die ("Can't open database!"); $sql = "INSERT INTO $table (name, email, message, date) VALUES ('$name', '$email', '$message', NOW())"; echo($sql ."Merci $name mais il manque mon prénom dans la dernière case :-((, mail $email, message $message
"; } if (!isset($show)) { $show = 0; } mysql_connect($server, $user, $password) or die ("Can't connect!"); mysql_select_db($database) or die ("Can't open database!"); $sql = "SELECT * FROM $table ORDER BY id DESC"; $result = mysql_db_query($database, $sql); if ($result) { $count = mysql_num_rows($result); $sqlshow = "SELECT * FROM $table ORDER BY id DESC LIMIT $show, $maxshow"; $result = mysql_db_query($database, $sqlshow); ?>Envoyé par " . htmlspecialchars($myrow["name"]) . ", le " . $myrow["date"] . " " . nl2br($myrow["message"]) . " |
Page " . $pagenow . " sur " . $pages . "
"; $next = $show + $maxshow; $previous = $show - $maxshow; if ($pages <> 1) { if ($previous < 0) { echo ""; echo ">>>
||"; } elseif ($next >= $count) { echo ""; echo "<<<
||"; } else { echo ""; echo "<<<
"; echo " | "; echo ""; echo ">>>
||"; } } echo "Pages: "; $i = 0; while ($i < $pages) { $ri = $i + 1; $showpage = $i * $maxshow; echo "" . $ri . " "; $i++; } echo "
"; ?>(*) Champs obligatoires
(*) Il y a des gens tellement bêtes qui viennent remplir mon guestbook automatiquement avec des bêtises. Il suffit donc d'écrire -> Camille <- dans cette case et le message sera enregistré.