天天看点

漂流瓶 php,PHP实现的迷你漂流瓶

本文实例讲述了php实现的迷你漂流瓶。分享给大家供大家参考。具体如下:

mysql.php:

mysql_connect('127.0.0.1','root','wjy123') or die('exit(-1)');

mysql_select_db('floatbtn');

mysql_query('set names utf8');

pickbtn.php:

/p>

"http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">

ppick u

.btn {

font-family: "微软雅黑";

font-size: 12px;

color: #fff;

background-color: #369;

border: 1px solid #666;

}

.box {

font-family: "微软雅黑";

color: #369;

font-size: 12px;

border: 1px solid #369;

}

发布信息

@include('mysql.php');

if(isset($_request['new'])){

$q = 'select * from `btn`';

$rs = mysql_query($q);

$max = mysql_num_rows($rs);

$rd = rand(1,$max);

$q = "select * from `btn` where id = {$rd}";

$rs = mysql_query($q);

while($re = mysql_fetch_array($rs)){

?>

id : =$re['author']?>text : =$re['text'] ?>date : =$re['date']?>

已读标记 =$re['flag']?>

$q = "update `btn` set flag = 1 where id = {$re['id']}";

mysql_query($q);

}

}

?>

throwbtn.php:

/p>

"http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">

微软雅黑

.btn {

font-family: "微软雅黑";

font-size: 12px;

color: #fff;

background-color: #369;

border: 1px solid #666;

}

.box {

font-family: "微软雅黑";

color: #369;

font-size: 12px;

border: 1px solid #369;

}

.box1 {

font-family: "微软雅黑";

font-size: 12px;

color: #369;

width: 800px;

border: 1px solid #666;

}

截取信息

@include('mysql.php');

if(isset($_request['send'])){

echo 'publish successed !

';

$author = $_request['author'];

$text = $_request['text'];

$date = date('y-m-d h:m:s');

if(!(null == trim($author)) && !(null == trim($text))) {

$q = "insert into `btn`(`id`,`author`,`text`,`date`,`flag`) values('','$author','$text','$date','0')";

mysql_query($q);

}

}

?>

id
text
date

希望本文所述对大家的php程序设计有所帮助。

希望与广大网友互动??

点此进行留言吧!