Contacts

Fish Inurl GuestBook Php Form. Guestbook on PHP

In this lesson, we will create a guestbook on PHP using AJAX. Entries will be stored in the database. The table will contain the following information: the sender's name, email address, IP address and date-time of the last entry. JQuery will be used (for the implementation of AJAX). Easy spam protection will also be implemented - you can post no more than one record every 10 minutes.

Step 1. SQL

To work our application, you need to create a table:

Create Table If Not EXists `S178_Guestbook` (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 \u003d Myisam Default Charset \u003d UTF8;

Step 2. PHP.

The main file will contain the following code:

guestBook.php.

\u003d ") \u003d\u003d 1) error_reporting (e_all & ~ e_notice & ~ e_deprecated); else error_reporting (e_all & ~ e_notice); Require_ONCE (" classes / cmysql.php "); // including service class to work with database // Get IP visitor function getvisitorip () ($ ip \u003d "0.0.0.0"; if ((iSset ($ _ server ["http_x_forwarded_for"])) && (! Empty ($ _ server ["http_x_forwarded_for"]))) ($ ip \u003d $ _Server ["http_x_forwarded_for"];) elseif ((ISSET ($ _ Server ["http_client_ip"])) && (! Empty ($ _ server ["http_client_ip"]))) ($ ip \u003d Explode (".", $ _ Server [ "Http_client_ip"]); $ ip \u003d $ ip. "." $ Ip. "." $ Ip. "." $ Ip;) elseif ((! Isset ($ _ Server ["http_x_forward_for"])) | | (Empty ($ _ server ["http_x_forwarded_for"]))) (if ((! isset ($ _ server ["http_client_ip"])) && (Empty ($ _ Server ["http_client_ip"]))) ($ ip \u003d $ _Server ["REMOTE_ADDR"];)) Return $ ip;) // Get the latest entries in the guest book Function GetLastRecords ($ ilimit \u003d 3) ($ SRECORDS \u003d ""; $ ARECORDS \u003d $ Globals ["MySQL"] -\u003e GetAll ( "SELECT * from` s178_guestbook` Order by ID` DESC L Imit ($ ilimit) "); Foreach ($ ARECORDS AS $ i \u003d\u003e $ Ainfo) ($ swhen \u003d date ("f j, y h: i", $ Ainfo ["WHEN"]); $ srecords. \u003d<<

($ Ainfo ["Description"])

EOF; ) Return $ SRECORDS; ) if ($ _post) (// We accept new records $ sip \u003d getvisitorip (); $ Sname \u003d $ Globals ["MySQL"] -\u003e escape (strip_tags ($ _ post ["name"])); $ semail \u003d $ Globals ["MySQL"] -\u003e escape (strip_tags ($ _ post ["name"])); $ sdesc \u003d $ globals ["mysql"] -\u003e escape (strip_tags ($ _ post ["text"])); if ($ Sname && $ Semail && SDESC && $ SIP) (// Spam Protection $ oldid \u003d $ Globals ["MySQL"] -\u003e Getone ("Select` ID` From `s178_guestbook` Where` ip` \u003d" ($ SIP) "And` when`\u003e \u003d unix_timestamp () - 600 Limit 1 "); if (! $ Oldid) (// You can add a comment of $ globals [" MySQL "] -\u003e Res (" Insert Into` S178_GuestBook` set` NAME` \u003d "($ Sname)", `email` \u003d" ($ semail) ",` description` \u003d "($ sdesc)", `when` \u003d unix_timestamp (),` ip` \u003d "($ sip)" ") ; // Display the last 10 records $ Sout \u003d GetLastRecords (); Echo $ Sout; EXIT;)) ECHO 1; EXIT;) // Display the last 10 records $ SRECORDS \u003d GetLastRecords (); OB_START (); ? \u003e.

Guest book

Add your feedback here

Guestbook on PHP



When you open the page, you will see a notebook. The last three records are displayed on the left side, and the right is the form for posting a new review. When the form is sent, the script sends the POST data (the same PHP page), then saves the data obtained in the database and returns three last records. Using the effect of manifestation, records are displayed on the left side of the book.

Also used PHP file

cLASSES / CMYSQL.PHP.

This file contains class code to work with the database. It requires you to configure three variables to connect to the server.

$ this-\u003e sdbname \u003d "database_name"; $ this-\u003e sdbuser \u003d "username"; $ this-\u003e sdbpass \u003d "password";

Step 3. CSS.

And now I will form the appearance of the guestbook:

cSS / Main.css.

* (margin: 0; padding: 0;) Body (color: #fff; color: #fff; font: 14px / 1.3 arial, sans-serif;) Footer (background-color: # 212121; bottom: 0; Box-shadow: 0 -1px 2px # 111111; Display: Block; Height: 70px; Left: 0; position: fixed; width: 100%; z-index: 100;) Footer H2 (Font-Size: 22px; Font- Weight: Normal; Left: 50%; margin-left: -400px; padding: 22px 0; position: absolute; width: 540px;) Footer A.Stuts, A.Stuts: visited (Border: None; Text-Decoration: None ; Color: #FCFCFC; font-size: 14px; left: 50%; line-height: 31px; margin: 23px 0 0 110px; Position: absolute; top: 0;) Footer .stuts span (Font-Size: 22px; font-weight: bold; margin-left: 5px;) .Container (Background: Transparent URL (../ images / book_open.jpg) NO-REPEAT TOP Center; Color: # 000000; Height: 600px; margin: 20px auto; Overflow: Hidden; Padding: 35px 100px; position: relative; width: 600px;) # col1, # col2 (float: left; margin: 0 10px; overflow: hidden; text-align: center; width: 280px;) # col1 (-WebKit-Transform: Rotate (3DEG); -MOZ-TRANSFORM: ROTATE (3DEG); -MS-Transform: Rotate (3DEG); -O-transform: rotate (3DEG); ) #records Form (Margin: 10px 0; padding: 10px; text-align: left;) #records table td.label (Color: # 000; font-size: 13px; padding-right: 3px; text-align: right ;) #records table label (font-size: 12px; vertical-align: middle;) #records table td.field input, #records table td.field Textarea (Background-color: RGBA (255, 255, 255, 0.4) ; Border: 0px Solid # 96A6C5; font-face: verdana, arial, sans-serif; font-size: 13px; margin-top: 2px; padding: 6px; width: 190px;) #records table td.field input (background -Color: RGBA (200, 200, 200, 0.4); Cursor: Pointer; Float: Right; width: 100px;) #records Table TD.Field Input: Hover (Background-color: RGBA (200, 200, 200, 0.8 );) #records_list (text-align: left;) #records_list .record (Border Top: 1px Solid # 000000; font-size: 13px; padding: 10px;) #records_list .record: first-child (border-top -width: 0px;) #records_list .record P: First-Child (Font-Weight: Bold; Font-Size: 11px;)

Among our Refs, I very often meet similar difficulties, most of them have the spamles, which they either buy, or find somewhere on the Internet, but they have nothing to spam, they have no longer a better competitive base. In this article I will try to set out the parting methods, i.e. I will try to teach newcomers to collect as much as possible.

Parsing is the process of collecting resources (sites). Collecting exactly sites, and their addresses. We collect these resources for the next spam. You can pass anything - guest books, forums, blogs, wiki, the main thing that you can leave your message with reference to your dor.
The request is what we enter in the search engine.
Issuance are those sites that give a search engine to our request.

Next, I want to note that the most important in the Parsing is the ability to properly use the search engine. Therefore, you need to know the syntax of requests. I will stop in Google. He has the largest database, relative to other search engines.
The syntax of google requests.
1) Inurl: "XXX" - the search engine will issue all sites at the address of which will find XXX, instead of xxx we can insert any other word, such as GuestBook, Forum, etc.
2) Intitle: "XXX" - search engine will give all sites in the header of which will find XXX. Again, instead of XXX, there may be any word.
3) Site: .xxx.com - search engine will give out all pages from the xxx.com domain, instead of XXX.COM can be any domain of any level. It may be jopa.mail.ru or for example, simply. R.M., if we just leave.ru, the search engine will give us all the sites from the domain zone.ru. Instead.ru can be.com, .org, .net, etc.
4) Intext: "XXX" - search engine will give us all the sites in the text that the word XXX was found. Instead of xxx - any word.
5) "XXX" - the search engine will give us sites in which the word XXX was found (found everywhere in the urla or in the text or header, no matter).
6) - "XXX" - the search engine will give us all the sites excluding those in which the word XXX was found. Inurl can also stand after minus: "XXX" intitle: "XXX" Site: .xxx.com Intext: "XXX", etc.

*** You can write the same without quotes, but I strongly recommend always to put them, because Quotes Shows Google the severity of the request, and therefore he will not give out all the rubbish, which in his opinion is also suitable for request.

It is very important not only to know the syntax of requests, but also to be able to combine them correctly. This is now we will deal with. In fact, everything is very very simple.

Introduction
There is a huge number of guest books in the world, but they all roughly speaking are divided into two main types of the same type and non-uniform. Guest sites are guests that have the same endings and the same mandatory fields for filling.
Here are examples of some of the same type of guest.
http://www.saveus.org/guestbook/sign.asp?pageposition\u003d1
http://www.caltrap.org/guestbook/sign.asp?pageposition\u003d1
http://mail.bebat.be/guestbookf/sign.asp?pageposition\u003d1
or
http://www.becquet.com/addguest.html.
http://www.vetgen.com/guest/addguest.html
http://www.newcreations.net/webmaster/guestbook/addguest.html
Than these guest are convenient:
1) easy to go
2) are easier analyzed (if there are no 10 guest of the guest of this type, then all the rest are most likely not to be neglected)

So novice I would recommend to start with the collection of the same type of guest.
Types of guests There are a huge cohogromic set, respectively, various single-type guests too.

Walk care. To begin with, we must decide which type of guest we want to collect and what (I mean a lot of hands, do not collect smile). When I started, I used the AllSubmiter program. It has a built-in parser. The program like all the other paid, but without a trial of the term. And if you do not plunge this program, it only performs the functions of the parser, heh, and we are exactly what you need. If we jump it and do not activate it, only the parser will work, the parser collects all the ullas from the page excluding the internal links of Google, the parser pulls into duplicates of domains and duplicates of links.
AllSubmiter take here
For a new type of guest, we create a new database.

We ask her the name.

Now proceed, I will show on a specific example how to collect the database using an allesubmitter. Let's collect, well, say the type of guest - gbook.php? A \u003d SIGN. These guests have the same endings when entering in Google Inurl: "gbook.php? A \u003d Sign" in Google them ~ 10.5K. But Google does not give more than 1000 results from the request, what to do, how to collect more than 1k? To do this, you need to narrow the request many times, it is necessary to issue on request not exceeding a thousand sites, so we can collect all the results. The analogy may be that with the girls you will not remove all the clothes at once in one fell, first one, then the other, then the bra, etc. As a result, she will still become naked, and the one who removed all the clothes, and not the one that having tried to remove everything at once in one fell swoop, took off only the cap and thought that she would not even remove anything from her. This is what I do not end in the guests to collect guests on request inurl: "gbook.php? A \u003d sign", but it begins with it. It is advisable to make a request even so
Inurl: "GBook.php? A \u003d Sign" - "error" - "warning", so we remove some of the bad non-working sites.
After we have created a new database, and AllSubmitere, enter Google.com in the browser, and enter the query there. (It is necessary that in Google it was supplied - "to issue 100 urlons on the page", it will speed up the collection of Allesubmitter parser), that's what we see

Then we click OK, then in the browser of the program "Back" and the same we do the same with the 2nd pages of issuing, then with the third, etc.

By doing this to make another request, for example \u003e\u003e
inurl: "gbook.php? a \u003d sign" Site: .com, i.e. We will collect all the gests from the domain zone.com, again we do the same collection procedure (see pictures)
Then another request
inurl: "gbook.php? A \u003d Sign" Site: .net
inurl: "gbook.php? a \u003d sign" site :..biz
inurl: "gbook.php? A \u003d Sign" Site: .org
In general, you can stay all types of domains.
Site: .com.
Site: .net
Site :..biz
Site: .org.
Site: .in.
Site: .name.
Site: .ru
Site: .fr.
Site: .it.
Site: .edu.
Site: .gov.
Site: .mil.
Site: .info.
Site :.au.
Site :.at.
Site: .by.
Site: .be.
Site: .bg.
Site: .ca.
Site: .cn.
Site: .cz.
Site: .dk
Site: .eg.
Site: .de
Site: .gr.
Site: .hu.
Site: .ie.
Site: .il.
Site: .jp.
Site: .us.
Site :.uk.
Site: .ua.
Site: .ch.
Site: .se.
Site: .es.
Site: .pl
Site: .nl
Site: .ro.
Site: .to.
Site: .mx

Alsubmititer will add only unique domains to the base, so you should not be afraid to make any requests, duplicates will not be j

Then you can make such requests
Inurl: "GuestBook / GBook.php? A \u003d Sign"
INURL: "GBOOK / GBOOK.PHP? A \u003d SIGN"
INURL: "GB / GBOOK.PHP? A \u003d SIGN"
Inurl: "Guest / GBook.php? A \u003d Sign"
And then make such a chip
Inurl: "GBook.php? A \u003d Sign" - inurl: "GuestBook / GBook.php? A \u003d Sign" -inurl: "GBook / GBook.php? A \u003d Sign" -inurl: "GB / GBook.php? A \u003d Sign "-inurl:" Guest / GBook.php? A \u003d SIGN "
those. Shoot what has already been laid

You can combine the most and most different requests together, you can use "-"
To drain what you are already laid, the main thing to make as many requests as possible.

Where to look for new types of gest? Usually I used two methods:
1) On the Internet, ready-made guest books are often planned, and since they are planned means they are massive, i.e. For all, that is, many of them are installed on different sites, etc. Just swing these gests pour on Frishnik and look at what they end, and then you watch this end in Google, if a big extradition also means to collect it, small - it means these books are not popular and collect them there is no particular sense.
2) You can search for new types of gestons in the tacks from competitors, everything can and say it is ugly ugly, etc., but very much do so much, although IMHO is better to combine the first and second ways.

From normal automatic parsers, a mango parser (253880089 - His Asya), it is inexpensive, but very quickly and qualitatively collects, filters on duplicates and removes the PCP session + distributes the PR.

In principle, everyone, all questions and wishes, write here, I will try to answer everyone.

© Vadiuha. All rights are protected

PHP 5.2 and above;
- mod_rewrite;
- MYSQL 4.1 and higher database.

Capabilities

Embedded to any site (for this you only need to edit the files Top.php and Bottom.php);
- antiflud;
- Ban List;
- page navigation<< < ...| 5 | 6 | 7 ... > >>;
- support for BBCode;
- display emoticons;
- notification of new added messages;
- the ability to add messages to moderation;
- the admin panel;
- Easy to install and tincture.

Installation

Unpack the archive and copy the contents of the archive to any folder on your web server (for example "GuestBook"). Open the config / config_db.php file in a text editor and specify the connection settings (host database or IP, database name, login and password). Place the MYSQL SQL query database table from the GuestBook.sql file. Usually on most hosting it is done through a web interface via phpmyAdmin. Go to the Administration Panel (http: // Your_sight / folder_s_script / admin /) and enter the password 1111. Next, specify the necessary settings.

Commercial version

At the request of the customer, I can adapt the script for specific conditions. Various additional features can be added.

Note

Script "PHP GuestBook", then simply the program is completely free. You can freely distribute, copy, make your changes in the source code of the program, only if the author's copywriter is saved. The use of the program "PHP GuestBook" for commercial purposes is prohibited. You use this program on your own fear and risk. The author does not bear any responsibility for the performance of the program, as well as for losing, damage to data or anything else related to the use and operation of this program.

If you like my script and you have a desire to thank me by the ruble, then here are my details:

WebMoney
U237811811298.
R198597198920.
Z917380288657.

Yandex money
41001635943434

PayPal.

If you have any questions or there are suggestions, please write to me: This email address is being protected from spam bots. You must have JavaScript enabled to view.



Did you like the article? Share it