php jquery 无刷新评论
刷新后删除一个小时前的记录
php jquery 无刷新评论
演示
xml/html code
<?php
define(‘include_check’,1);
require “functions.php”;
require ̶李逵的性格特点0;conn.php”;
// remove tweets older than 1 hour to prevent spam
mysql_query(“delete from add_delete_record where id>1 and updatetime<subtime(now(),’0 1:0:0′)”);
//fetch the timeline
$q = mysql_query(“lect * from add_delete_record order by id desc”);
$timeline=”;
while($row=mysql_fetch_assoc($q))
{
$timeline.=formattweet($row[‘text’],$row[‘updatet银耳汤怎么做ime’]);
}
// fetch the latest tweet
$lasttweet = ”;
?>
<!doctype html public “-//w3c//dtd xhtml 1.0 transitional//en” “/d/file/titlepic/xhtml1-transitional.dtd&
<html xmlns=”https://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”content-type” content=”text/html; chart=utf-8″ />
<title>php jquery 无刷新评论 www.freejs.net</title>
<link rel=”stylesheet” type=”text/css” href=”demo.css” />
<script type=”text/javascript” src=”../../js/jquery-1.9.1.min.js”></script>
<script type=”text/javascript” src=”script.js”></script>
</head>
<body>
<p id=”twitter-container”>
<form id=”tweetform” action=”submit.php” method=”post”>
<span class=”counter”>140</span>
<label for=”inputfield”>请留言测试</label>
<textarea name=”inputfield” id=”inputfield” tabindex=”1″ rows=”2R普通话一甲43; cols=”40″></textarea>
<input class=”submitbutton inact” name=”submit” type=”submit” value=”提交” disabled=”disabled” />
<p class=”clear”></p>
</form>
<h3 class=”timeline”>freejs.net</h3>
<ul class=”status”><?php echo $timeline?></ul>
</p>
</body>
</html>
functions.php
php c当年明月语录ode
<?php
if(!defined(‘include_check’)) die(‘you are not allowed to execute this file directly’);
function formattweet($tweet,$updatetime)
{
$tweet=htmlspecialchars(stripslashes($tweet));
$flag = mt_rand(1,9);
return’
<li>
<a href=”#”><img class=”avatarR大学生人数21; src=”img/lito_s-ido_0′.$flag.’.png” width=”48″ height=”48″ /></a>
<p class=”tweettxt”>
<strong><a href=”#”>demo</a></strong> ‘. preg_replace(‘/((?:http|https|ftp):\/\/(?:[a-z0-9][a-z0-9_-]*(?:\.[a-z0-9][a-z0-9_-]*)+):?(\d+)?\/?[^\s\”\’]+)/i’,'<a href=”$1″ rel=”nofollow” target=”blank”>$1</a>’,$tweet).’
<p class=”date”>’.strtotime($updatetime).'</p>
</p>
<p class=”clear”></p>
</li>’;
}
?>
submit.php
php code
<?php
define(‘include_check’,1);
require “functions.php”;
require “conn.php”;
if(ini_get(‘magic_quotes_gpc’))
$_post[‘inputfield’]=stripslashes($_post[‘inputfield’]);
$_post[‘inputfield’] = mysql_real_escape_string(strip_tags($_post[‘inputfield’]),$lr);
if(mb_strlen($_post[‘inputfield’]) < 1 || mb_strlen($_post[‘inputfield’])>140)
die(“0”);
mysql_query(“inrt into add_delete_record t text='”.$_post[‘inputfield’].”‘,updatetime=now()”);
if(mysql_affected_rows($lr)!=1)
die(“0”);
echo formattweet($_post[‘inputfield’],time());
?>
本文发布于:2023-04-07 05:41:45,感谢您对本站的认可!
本文链接:https://www.wtabcd.cn/fanwen/zuowen/dafb00f1e8d7e4226370cccce2778ba8.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文word下载地址:php jquery 无刷新评论.doc
本文 PDF 下载地址:php jquery 无刷新评论.pdf
留言与评论(共有 0 条评论) |