Баба inurl guestbook php new message. «Дешевый сиалис inurl guestbook php. Гостевая книга на PHP

  • 18.02.2022

Recently while working on a free-lance project, a Marriage Website for one of my friend, I happened to create a Guestbook for that website. After which, I decided to write a tutorial on how to create a guestbook in case someone might need it. If you do not know what a guestbook is, in real life a guestbook is basically a diary kept at various places and for various occasions where people can leave their wishes or feedback for any event. In a similar way, an online guestbook is a service, which enables you to allow your visitors to leave comments and feedback for any event or any product, which is visible to the public.

Well, developing a Guestbook is not a difficult task. It is pretty simple if you know what you are required to do! (Basically, for any problem, if you know what you are supposed to do, it’s pretty easy!). Let me “pen down” the basic steps involved in development of a guestbook.

  • A user is displayed a form, which he or she must fill out.
  • A confirmation message is displayed to the user when the comment is saved in the database.
  • A user can browse through all the comments posted till now on the website.

To solve this simple problem, we will make use of PHP and as always, I would be using my favorite text editor, Notepad++. If you don’t use Notepad++, I highly advise you to use it. Read more about it here. Also, we will be required to use a database to store the comments and information about the user. We will use a MySQL Database.

Guestbook in PHP

Let’s get started with the process of building our very own guestbook.

Guestbook Form

In this code, we basically redirect the form to a PHP page on our server named “addcomment.php ” and then we do the main programming part there.

  • Create a new HTML page, and in the body tag of the page, add the following code. Name: Email: Message:
  • Now, if you want to add a validation check for the name and email fields, add the following JavaScript code to your head tag. // =x.length) { alert("Not a valid e-mail address"); return false; } else return true; } // ]]>
  • Then add the following attribute to the form tag. onsubmit="return Validate();"
  • The complete Form Tag will now look somewhat like this.
  • The SQL Part

    We now need to create a MySQL table in a database to save our data entered by the user. To do this, we need to run the following query on our MySQL Server. On our server, we had to use phpMyAdmin to create a table in our database.

    CREATE TABLE guestbook(id int(5) NOT NULL auto_increment, name varchar(60) NOT NULL default " ", email varchar(60) NOT NULL default " ", message text NOT NULL, Primary key(id));

    The PHP Files

    Now let’s get creating our PHP files. We need one file which will add the comment to the user and then display a confirmation or error message and one file which will display all the comments stored in our database. First let’s make the addcomment.php file.

  • Create a new PHP file and paste the following code in there.
  • Save this file as addcomment.php in the same folder as the above created HTML file.
  • Now, again create a new PHP file, which will display the comments and the names of the people to the public. Name this file “guestbook.php “.
  • Add the following code to the file.

  • Be sure to change the variables (host, username, password, database, and table) in both the above created PHP files.
  • Well, that’s it. You are ready to fire it up with some CSS and set it live on your website. This was a quick and easy tutorial for beginners. I hope I enabled you to create a Guestbook for your website. Keep subscribed to Slash Coding for more such updates. You can subscribe via RSS Feeds, Liking our Facebook Page or by Following us on Twitter. It’s your pick! 😉

    Did you enjoy this article?

    » DRBGuestbook

    Гостевая книга DRBGuestbook – это бесплатный, простой PHP скрипт, который не требует БД MySql. Не смотря на это, вы можете управлять программой, удалять сообщения, одобрять сообщения, банить пользователей по IP адресу, через защищенную паролем панель администратора. Скрипт так же включает себя анти-спам проверку, такую как image verification, блокировку URL и модерирование всех сообщение в книге. Можно установить функцию, что каждый раз, когда кто-то оставляет сообщение, вы будете получать уведомление на e-mail.

    Преимущества скрипта.
    • Быстрая и лёгкая установка.
    • Не требует БД MySQL. Все сообщения хранятся в файле.
    • Можно удалить множество сообщений за один раз.
    • Содержит анти-спам проверку.
    • Можно забанить IP адрес, чтобы не смогли оставлять сообщения.
    • Поддерживает модерацию сообщений, так, что только одобренные сообщения будут публиковаться.
    • Получайте уведомление на почту, каждый раз, когда кто-то подписал вашу гостевую книгу.
    • Проверка сообщение: список «запрещенных» (матерных) слов к публикации.
    • Функция анти-флуд. Чтобы пользователи не публиковали сообщения так часто.
    • Скрипт предотвращает публикацию HTML кодов или ссылок (URL) в теле сообщения, в качестве анти-спам предосторожности.
    • Настройка минимум и максимум букв в одном сообщении.
    • Скрипт можно легко настроить: сообщения об ошибке, предупреждения, дата и время.
    • Дата и часовой пояс легко настраивается.
    • Генерируемые страницы содержат синтаксис XHTML и прекрасно работают в браузерах IE и Firefox.
    • Вход в панель администратора через веб – интерфейс.
    Системные требования
    • PHP версия 4.4 или выше
    • GD library
    • Apache HTTP Server с файлом.htaccess с функцией Override Allowed (рекомендовано)
    • Linux, Windows, Unix, Mac OSX, Sun Solaris, IIS

    В данном уроке мы создадим гостевую книгу на PHP с использованием AJAX. Записи будут храниться в базе данных. Таблица будет содержать следующую информацию: имя отправителя, адрес email, IP адрес и дата-время последней записи. Будет использоваться jQuery (для реализации AJAX). Также будет реализована простая защита от спама - можно размещать не более одной записи каждые 10 минут.

    Шаг 1. SQL

    Для работы нашего приложения требуется создать таблицу:

    CREATE TABLE IF NOT EXISTS `s178_guestbook` (`id` int(10) unsigned NOT NULL auto_increment, `name` varchar(255) default "", `email` varchar(255) default "", `description` varchar(255) default "", `when` int(11) NOT NULL default "0", `ip` varchar(20) default NULL, PRIMARY KEY (`id`)) ENGINE=MyISAM DEFAULT CHARSET=utf8;

    Шаг 2. PHP

    Основной файл будет содержать следующий код:

    guestbook.php

    Гостевая книга Добавьте ваш отзыв здесь function submitComment(e) { var name = $("#name").val(); var email = $("#email").val(); var text = $("#text").val(); if (name && email && text) { $.post("guestbook.php", { "name": name, "email": email, "text": text }, function(data){ if (data != "1") { $("#records_list").fadeOut(1000, function () { $(this).html(data); $(this).fadeIn(1000); }); } else { $("#warning2").fadeIn(2000, function () { $(this).fadeOut(2000); }); } }); } else { $("#warning1").fadeIn(2000, function () { $(this).fadeOut(2000); }); } };

    Ваше имя:
    Ваш email:
    Отзыв:
    Заполните все обязательные поля Вы не можете размещать более одного отзыва в течении 10 минут (защита от спама)