PHP實(shí)現(xiàn)的迷你漂流瓶
本文實(shí)例講述了PHP實(shí)現(xiàn)的迷你漂流瓶。分享給大家供大家參考。具體如下:
mysql.php:
<?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'>發(fā)布信息</a> <form id="form1" name="form1" method="post" action="pickbtn.php"> <table width="80%" border="0"> <?php @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)){ ?> <tr> <td class="box" width="12%">ID : </td> <td class="box" width="88%"><?=$re['author']?></td> </tr> <tr> <td class="box" >Text : </td> <td class="box"><?=$re['text'] ?></td> </tr> <tr> <td class="box">Date : </td> <td class="box"><?=$re['date']?></td> </tr> <p class="box">已讀標(biāo)記 <?=$re['flag']?></p> </table> <?php $q = "update `btn` set flag = 1 where id = {$re['id']}"; mysql_query($q); } } ?> <input class="btn" 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> <?php @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"> <tr> <th class="box" width="110">ID</th> <td class="box" width="442"><input class="box1" type="text" name="author" /></td> </tr> <tr> <th class="box" >Text</th> <td class="box"><input class="box1" name="text" type="text" /></td> </tr> <tr> <th class="box">Date</th> <td class="box"> <input class="box1" type="text" name="date" disabled="disabled" value="<?=date('Y-m-d')?>" /></td> </tr> </table> <div align="center"><input class="btn" name="send" type="submit" value="Send Message"/></div> </form> </body> </html>
希望本文所述對(duì)大家的php程序設(shè)計(jì)有所幫助。
相關(guān)文章
PHP使用strtotime獲取上個(gè)月、下個(gè)月、本月的日期
在PHP中有個(gè)叫做strtotime的函數(shù)。strtotime 實(shí)現(xiàn)功能:獲取某個(gè)日期的時(shí)間戳,或獲取某個(gè)時(shí)間的時(shí)間戳。strtotime 將任何英文文本的日期時(shí)間描述解析為Unix時(shí)間戳2015-12-12PHP實(shí)現(xiàn)時(shí)間軸函數(shù)代碼
我們?cè)谡搲l(fā)帖、發(fā)表評(píng)論、或者是使用QQ空間發(fā)布日志、微博發(fā)表言論時(shí),會(huì)看到發(fā)表的內(nèi)容后的時(shí)間顯示為“剛剛”、“5分鐘前”、“昨天10:23”等,而不是直接顯示具體日期和時(shí)間2011-10-10php使用ftp實(shí)現(xiàn)文件上傳與下載功能
這篇文章主要為大家詳細(xì)介紹了php使用ftp實(shí)現(xiàn)文件上傳與下載功能,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2017-07-07解析PHP中數(shù)組元素升序、降序以及重新排序的函數(shù)
本篇文章是對(duì)PHP中數(shù)組元素升序、降序以及重新排序的函數(shù)進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下2013-06-06PHP實(shí)現(xiàn)的pdo連接數(shù)據(jù)庫并插入數(shù)據(jù)功能簡單示例
這篇文章主要介紹了PHP實(shí)現(xiàn)的pdo連接數(shù)據(jù)庫并插入數(shù)據(jù)功能,結(jié)合簡單示例形式分析了pdo數(shù)據(jù)庫連接及執(zhí)行基本的插入SQL語句相關(guān)操作技巧,需要的朋友可以參考下2019-03-03PHP寫的求多項(xiàng)式導(dǎo)數(shù)的函數(shù)代碼
PHP寫的求多項(xiàng)式導(dǎo)數(shù)的函數(shù)代碼,需要的朋友可以參考下2012-07-07