PHP guestbook (with Oracle database paging display function)_PHP tutorial

WBOY
Release: 2016-07-13 17:31:28
Original
912 people have browsed it

(Excerpted from the CCU news group. The original source may be a book about php (as the current mainstream development language) published in Taiwan: php (as the current mainstream development language) Book)

Most websites will consider the interactive relationship with users. At this time, the message board function can be used to allow users to leave messages about their visit or some interactive messages with the website.
In terms of design, it can be very simple to only leave short messages from users, or it can be designed to a very complex Web BBS system that is classified according to nature. Of course, how to create a message board for your own website depends on the nature of the website and the ingenuity of the web developer.

The example introduced here simply lists the contents of all messages. Allows users to view the information of multiple messages at one time. The back-end of the system stores messages using Oracle (large website database platform) version 7.x database system. The database name in the example is WWW, the connected user account is user38, and the password is iam3849. To use this example directly, you must first execute the following SQL command to create the guestbook data table.

CREATE TABLE guestbook (
serial varchar2(255) not null,
ref varchar2(255) null,
id char(8) not null,
alias varchar2(32) not null,
ip varchar2(1024) null,
msgdate date not null,
email varchar2(1024) null,
msg varchar2(2000) not null,
flag char(1) default 1,
Prima(the most complete virtual host management system)ry key(serial)
);



The above SQL fields Please see the table below for instructions and details

Serial number field name Data form Data length Field description Restrictions Key
0 Serial number serial varchar2 255 NN PK
1 Refer to serial number ref varchar2 255 Temporarily reserved. For reply
message function
2 Account id char 8 User account NN
3 Anonymous alias varchar2 32 Displayed name NN
4 Website ip varchar2 1024 Internet IP
5 Time msgdate date NN
6 Email email varchar2 1024
7 Message content msg varchar2 2000 NN
8 Display flag flag char 1 0: Do not display
1: Display (default)


In the guestbook related programs in this section, if the user authentication function is added, the user's authentication account can be left in the account column of the guestbook data table to facilitate Webmaster to find inappropriate senders in the future. I will leave a space here for readers who need it to practice.

To use the program in this section, you must first install Oracle (large website database platform) version 7.x, and make sure that SQL*net on the Web Server side can successfully connect to Oracle(Large website database platform) Database. Later, when compiling php(as the current mainstream development language), add

--with-Oracle(large website database platform)=/home/ Oracle(Large website database platform)/product/7.3.2 option, of course it doesn’t matter if you change it to another path, as long as the path is really Oracle(Large website database platform) path. For details on the installation and use of Oracle(large website database platform), please refer to relevant books.

The following program adds the user's message information to the guestbook message data table. If you want to set up the user authentication function, you can check it at the beginning of the program. The person who sent the message can confirm his identity, and there is no need to check the identity when reading the message. This setting can prevent inappropriate comments, but will not limit the use of the message function to only a few people.


(as the current mainstream development language)
file://--------------- ------------
// Add message program addmsg.php (as the current mainstream development language)
// Author: Wilson Peng
// Copyright (C) 2000
file://--------------------------
//
// You can add the identity check function here by yourself
//
if (($alias!="") and ($msg!="")) {
putenv("Oracle( Large website database platform)_SID=WWW");
putenv("NLS_LANG=american_taiwan.zht16big5");
putenv("Oracle(Large website database platform)_HOME=/ home/Oracle(Large website database platform)/product/7.3.2");
putenv("LD_LIBRARY_PATH=/home/Oracle(Large website database platform)/product /7.3.2/lib");

putenv("ORA_NLS=/home/Oracle(Large website database platform)/product/7.3.2/ocommon/nls/admin/data ");

putenv("ORA_NLS32=/home/Oracle(large website database platform)/product/7.3.2/ocommon/nls/admin/data");

$handle=ora_logon("user38@WWW","iam3849") or die;
$cursor=ora_open($handle);
ora_commitoff($handle);

$serial =md5(uniqid(rand()));
$ref="";
$id=$php(as the current mainstream development language)_AUTH_USER;
$ip =$REMOTE_ADDR;
$msg=base64_encode($msg);
$flag="1";
$query="INSERT into guestbook(serial, ref, id, alias, ip,
msgdate, email, msg, flag) values($serial, $ref, $id, $alias, $ip,
sysdate, $email, $msg, $flag)";

ora_parse($ cursor, $query) or die;
ora_exec($cursor);

ora_close($cursor);
ora_logoff($handle);

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/509074.htmlTechArticle (Excerpted from the CCU news group, the original source may be a book published in Taiwan about PHP (as the current mainstream development Language) books: php (as the current mainstream development language) guide) most...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template