首页 > 编程 > PHP > 正文

PHP实现的迷你漂流瓶

2020-03-22 19:26:27
字体:
来源:转载
供稿:网友
本文实例讲述了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: !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" html xmlns="http://www.w3.org/1999/xhtml" head meta http-equiv="Content-Type" content="text/html; charset=utf-8" / title ppick u /title style type="text/css" .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; /style /head body a href='throwbtn.php' 发布信息 /a form id="form1" name="form1" method="post" action="pickbtn.php" table width="80%" border="0" @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)){ td width="12%" ID : /td td width="88%" =$re['author'] /td /tr td Text : /td td =$re['text'] /td /tr td Date : /td td =$re['date'] /td /tr p 已读标记 =$re['flag'] /p /table $q = "update `btn` set flag = 1 where id = {$re['id']}";mysql_query($q); input name="new" type="submit" value="截取"/ /form /body /html throwbtn.php: !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" html xmlns="http://www.w3.org/1999/xhtml" head meta http-equiv="Content-Type" content="text/html; charset=utf-8" / title 微软雅黑 /title style type="text/css" .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; /style /head body a href='pickbtn.php' 截取信息 /a @include('mysql.php');if(isset($_REQUEST['send'])){ echo 'Publish Successed ! br $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); form id="form1" name="form1" method="post" action="throwbtn.php" table width="80%" border="0" th width="110" ID /th td width="442" input type="text" name="author" / /td /tr th Text /th td input name="text" type="text" / /td /tr th Date /th input type="text" name="date" disabled="disabled" value=" =date('Y-m-d') " / /td /tr /table div align="center" input name="send" type="submit" value="Send Message"/ /div /form /body /html 希望本文所述对大家的php程序设计有所帮助。PHP教程

郑重声明:本文版权归原作者所有,转载文章仅为传播更多信息之目的,如作者信息标记有误,请第一时间联系我们修改或删除,多谢。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表