一个很简单的php留言板。筹建在sae上的。
一个很简单的php留言板。。。。搭建在sae上的。。。
我在sae上搭建了一个个人简历的页面: 有兴趣的可以访问 http://671coder.sinaapp.com/
在做下面一个简单的留言板的时候,卡了我很久,虽然完全没用过php。。但是还是最后勉强写出来了。。。
主页面html是这样写的:
<div class="row row-contact" id="contact_row" style="display: block"> <article> <h2 id="Contact-Me">Contact Me</h2> <p>This block can be hidden and only shown in <a class="zoom-html">a popup</a>.</p> <div class="wrap-contact-form"> <form id="contacts" class="contact-form" action="/db/submitform.php" method="post"> <table class="info"> <tr> <th><label for="contact_name">Name</label></th> <td><input type="text" class="input-text" name="contact_name" id="contact_name" value="" maxlength="10"></td> </tr> <!-- start spam protection <tr class="spam-protection"> <th><label>E-mail</label></th> <td><input type="text" name="email" value=""></td> </tr> end --> <tr> <th><label for="contact_code">Security code</label></th> <td><input type="text" class="input-text" name="contact_code" id="contact_code" maxlength="4"></td> </tr> <tr> <th><label for="contact_message">Your Message</label></th> <td><textarea id="contact_message" name="contact_message" maxlength="200"></textarea></td> </tr> <tr> <th></th> <td> <input type="submit" class="input-submit" name="contact_send" value="Send"> <div class="on-success"> Thank You. The message was sent. </div> <!-- <div class="on-error"> A technical error occured. Message was not delivered. Please contact me over e-mail. </div> --> </td> </tr> </table> </form> </div> </article> </div>
验证码功能暂时还没有实现。。。
后台的php是这样写的:
<?php $name = $_POST['contact_name']; $message = $_POST['contact_message']; if (strlen($name) == 0 || strlen($message) == 0) { ?><script> alert("Sorry, your name and your message can not be empty."); window.history.back(-1); </script> } $m_notchar="$#@!%&*?"; $mysql = new SaeMysql(); $judge = true; for ($i=0; $ierrno() != 0 ) { die( "Error:" . $mysql->errmsg() ); } else if (!$judge) { ?><script>alert("Sorry, your message has illegal characters, please re-enter checked.");</script> } else { $sql = "INSERT INTO Message (MName, MText) VALUES ('$name', '$message')"; $mysql->runSql( $sql ); ?><script>alert("Thank you for your message!");</script> } $mysql->closeDb(); ?> <script>window.history.back(-1);</script>
然后最后显示留言板是这么写的:
<meta charset="utf-8"> <title>My messages</title> <link href="%E2%80%9Dhttp://fonts.googleapis.com/css?family=Reenie+Beanie:regular%E2%80%9D" rel="”stylesheet”" type="”text/css”"> <style type="text/css"> *{ margin:0; padding:0; } body{ font-family: arial,sans-serif; font-size:100%; margin:3em; background:#666; color:#fff; } h2,p{ font-size:100%; font-weight:normal; } ul,li{ list-style:none; } ul{ overflow: hidden; padding:3em; } ul li a{ text-decoration:none; color:#000; background:#ffc; display:block; height:10em; width:10em; padding:1em; -moz-box-shadow:5px 5px 7px rgba(33,33,33,1); -webkit-box-shadow: 5px 5px 7px rgba(33,33,33,.7); box-shadow: 5px 5px 7px rgba(33,33,33,.7); /*倾斜正方形*/ -webit-transform: rotate(-6deg); -o-transform: rotate(-6deg); -moz-transform: rotate(-6deg); /*添加鼠标放上时的平滑过渡*/ -moz-transition:-moz-transform .15s linear; -o-transition:-o-transform .15s linear; -webkit-transition:-webkit-transform .15s linear; } ul li{ margin:1em; float:left; } ul li h2{ font-size:140%; font-weight:bold; padding-bottom:10px; } ul li p{ font-family:"Reenie Beanie",arial,sans-serif,微软雅黑; font-size:110%; } ul li:nth-child(even) a{ -o-transform: rotate(4deg); -webkit-transform: rotate(4deg); -moz-transform: rotate(4deg); position:relative; top:5px; background:#cfc ; } ul li:nth-child(3n) a{ -o-transform: rotate(-3deg); -webkit-transform: rotate(-3deg); -moz-transform: rotate(-3deg); position:relative; top:-5px; background:#ccf ; } ul li:nth-child(5n) a{ -o-transform: rotate(5deg); -webkit-transform: rotate(5deg); -moz-transform: rotate(5deg); position:relative; top:-10px; } ul li a:hover, ul li a:focus{ -moz-box-shadow:10px 10px 7px rgba(0,0,0,.7); -webkit-box-shadow:10px 10px 7px rgba(0,0,0,.7); -box-shadow:10px 10px 7px rgba(0,0,0,.7); -webkit-transform:scale(1.25); -moz-transform:scale(1.25); -o-transform:scale(1.25); position:relative; z-index:5; } </style> <?php $link=mysql_connect(SAE_MYSQL_HOST_M.':'.SAE_MYSQL_PORT,SAE_MYSQL_USER,SAE_MYSQL_PASS); if(!$link)die('could not connect'.mysql_error()); mysql_select_db(SAE_MYSQL_DB,$link); $query = "select * from app_671coder.Message"; $result = mysql_query( $query ); if ($result) { ?>
-
echo "
-
=$user?>:
=$text?>
671coder's message:
"; while ($r = mysql_fetch_array($result)) { $idx = $r["MId"]; $user = $r["MName"]; $text = $r["MText"]; ?>
怎么样!感觉上很炫吧!
数据库的话想必大家都知道是怎么设计的了吧?!

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

记事本++7.3.1
好用且免费的代码编辑器

SublimeText3汉化版
中文版,非常好用

禅工作室 13.0.1
功能强大的PHP集成开发环境

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

热门话题

许多用户在选择智能手表的时候都会选择的华为的品牌,其中华为GT3pro和GT4都是非常热门的选择,不少用户都很好奇华为GT3pro和GT4有什么区别,下面就就给大家介绍一下二者。华为GT3pro和GT4有什么区别一、外观GT4:46mm和41mm,材质是玻璃表镜+不锈钢机身+高分纤维后壳。GT3pro:46.6mm和42.9mm,材质是蓝宝石玻璃表镜+钛金属机身/陶瓷机身+陶瓷后壳二、健康GT4:采用最新的华为Truseen5.5+算法,结果会更加的精准。GT3pro:多了ECG心电图和血管及安

如何使用CSS实现元素的旋转背景图动画效果背景图动画效果可以增加网页的视觉吸引力和用户体验。本文将介绍如何使用CSS实现元素的旋转背景图动画效果,并提供具体的代码示例。首先,我们需要准备一张背景图,可以是任何你喜欢的图片,例如一张太阳或者电风扇的图片。将该图片保存并命名为“bg.png”。接下来,创建一个HTML文件,并在文件中添加一个div元素,将其设置为

为什么截图工具在Windows11上不起作用了解问题的根本原因有助于找到正确的解决方案。以下是截图工具可能无法正常工作的主要原因:对焦助手已打开:这可以防止截图工具打开。应用程序损坏:如果截图工具在启动时崩溃,则可能已损坏。过时的图形驱动程序:不兼容的驱动程序可能会干扰截图工具。来自其他应用程序的干扰:其他正在运行的应用程序可能与截图工具冲突。证书已过期:升级过程中的错误可能会导致此issu简单的解决方案这些适合大多数用户,不需要任何特殊的技术知识。1.更新窗口和Microsoft应用商店应用程

Vue中如何对图片进行压缩和格式转换?在前端开发中,经常会遇到需要对图片进行压缩和格式转换的需求。特别是在移动端的开发中,为了提高页面加载速度和节省用户流量,对图片进行压缩和格式转换是很关键的。而在Vue框架中,我们可以通过一些工具库来实现对图片的压缩和格式转换。使用compressor.js库进行压缩compressor.js是一款用于压缩图片的JavaS

CSS3D视图属性解读:transform和perspective,需要具体代码示例引言:在现代网页设计中,3D效果已经成为了一个非常流行的元素。通过CSS的transform和perspective属性,我们可以轻松地为网页添加3D视觉效果,使页面更加生动和吸引人。本文将对这两个属性进行解读,并提供具体的代码示例。一、transform属性:transf

第1部分:初始故障排除步骤检查苹果的系统状态:在深入研究复杂的解决方案之前,让我们从基础知识开始。问题可能不在于您的设备;苹果的服务器可能会关闭。访问Apple的系统状态页面,查看AppStore是否正常工作。如果有问题,您所能做的就是等待Apple修复它。检查您的互联网连接:确保您拥有稳定的互联网连接,因为“无法连接到AppStore”问题有时可归因于连接不良。尝试在Wi-Fi和移动数据之间切换或重置网络设置(“常规”>“重置”>“重置网络设置”>设置)。更新您的iOS版本:

Vue中如何实现图片的动画和渐变效果?Vue是一种用于构建用户界面的渐进式框架,它可以轻松地实现动画和渐变效果。在本文中,将介绍如何使用Vue来实现图片的动画和渐变效果,并提供一些代码示例。一、使用Vue的过渡效果实现图片动画Vue提供了过渡效果的内置指令,可以轻松地在HTML元素上添加动画效果。使用过渡效果时,可以包裹图片元素,并在元素上添加过渡指令。示例

php提交表单通过后,弹出的对话框怎样在当前页弹出php提交表单通过后,弹出的对话框怎样在当前页弹出而不是在空白页弹出?想实现这样的效果:而不是空白页弹出:------解决方案--------------------如果你的验证用PHP在后端,那么就用Ajax;仅供参考:HTML code
