大家知道,数据库对于网络来说的重要性.由于cgi的复杂,现在asp和php+mysql已经成为主流.几乎所有的个人网页都要用到留言本,可是申请的留言本很不稳定.这为网上的交流带来了诸多不便.所以,希望拥有自己的留言本的朋友越来越多.
但是,免费的个人主页支持asp和php的很少.笔者现在向您推荐奥索网,(http://www.oso.com.cn)支持php.这样您便有了能够拥有自己留言本的基础.现在,我就通过一个文本留言本的例子来讲述php的简单使用.
首先,我们先确定,留言的几个过程:写留言,发送,查看.(搜索)等等.而且对于斑竹来说,管理留言本又是不可或缺的.这样我们就不妨定位于6个php文件,1个文本文件.6个php文件分别为:guest.php manage.php reply.php sys.php del.php edit.php,1个文本文件为:guest.txt
先来看看guest.php的内容,你当然可以直接将下面的内容放到您的php网页里,请尊重作者的劳动,谢谢.
----------------------
//guest.php:
require("sys.php");
if ($B1)
{
if ($message=="" or $name=="")
{
$errorm="出错了!!!姓名和留言内容必填";
}
else
{
#写入数据
$space = " ";
$time = date(Y年m月d日H小时i分);
$ip=$REMOTE_ADDR;
$name=encode($name);
$homepage=encode($homepage);
$from=encode($from);
$email=encode($email);
$message=StripSlashes($message);
$message=htmlspecialchars($message);
$message=check_strlen_long($message);
$message=nl2br($message);
$guestcontent = "
include('head.htm');?>
| |
function search($keyword)
{
global $content;
$count=count($content);
$subscript=0;
$ArrSearch=array();
for ($i=0;$i {
if (ereg($keyword,$content[$i]))
{
$ArrSearch[$subscript]=ereg_replace($keyword,"$keyword",$content[$i]);
$subscript++;
}
}
return $ArrSearch;
}//end function
$one_page_line=15;
$content = file($guestfile);
if (isset($search) and isset($keyword) and $keyword!="")
{
$content=search($keyword);
}
$count =count($content);
?>
$int_page_count=$count;//总条数; $int_page_num=ceil($int_page_count/$one_page_line);//总页数; echo "分页:"; for ($i=1;$i { echo "".$i." "; } echo ""; if (isset($search) and isset($keyword) and $keyword!="") { echo " echo "下面的留言中包含关键字$keyword共".$count."条 } ?> |
共有条 |
回复 编辑 删除 第$j条 |
include('bottom.htm');
?>

Outils d'IA chauds

Undresser.AI Undress
Application basée sur l'IA pour créer des photos de nu réalistes

AI Clothes Remover
Outil d'IA en ligne pour supprimer les vêtements des photos.

Undress AI Tool
Images de déshabillage gratuites

Clothoff.io
Dissolvant de vêtements AI

Video Face Swap
Échangez les visages dans n'importe quelle vidéo sans effort grâce à notre outil d'échange de visage AI entièrement gratuit !

Article chaud

Outils chauds

MinGW - GNU minimaliste pour Windows
Ce projet est en cours de migration vers osdn.net/projects/mingw, vous pouvez continuer à nous suivre là-bas. MinGW : un port Windows natif de GNU Compiler Collection (GCC), des bibliothèques d'importation et des fichiers d'en-tête librement distribuables pour la création d'applications Windows natives ; inclut des extensions du runtime MSVC pour prendre en charge la fonctionnalité C99. Tous les logiciels MinGW peuvent fonctionner sur les plates-formes Windows 64 bits.

ZendStudio 13.5.1 Mac
Puissant environnement de développement intégré PHP

VSCode Windows 64 bits Télécharger
Un éditeur IDE gratuit et puissant lancé par Microsoft

Adaptateur de serveur SAP NetWeaver pour Eclipse
Intégrez Eclipse au serveur d'applications SAP NetWeaver.

PhpStorm version Mac
Le dernier (2018.2.1) outil de développement intégré PHP professionnel
