如何用cookie防止用户的灌水回复?
今天没事瞎点 点到 凤凰网的一个链接了 http://yue.ifeng.com/y/detail_2011_12/07/11160676_0.shtml
评论框 内容是 :文明上网,登陆评论!
直接点按钮 js alert 请填写评论内容
再点一下文本框 文本框内容变成:请您先登录,再发布评论。
再点按钮 就提交了
打开的页面中的最新评论里就有了。然后我就复制了部分html
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html"; charset="utf-8">
</head>
<body>
<form method="post" target='_blank' action="http://comment.ifeng.com/post.php" id="commentForm" name="commentForm">
<textarea onclick="changeBox();" class="" cols="50" rows="10" id="content" name="content">bbbbbbbbbbb</textarea>
<input type="hidden" value="11160676" name="docId">
<input type="hidden" value="吴卓羲女友张馨予家中大尺度内衣自拍照火辣曝光" name="docName">
<input type="hidden" value="http://yue.ifeng.com/y/detail_2011_12/07/11160676_0.shtml" name="docUrl">
<input type="hidden" value="21202" name="chId">
<input type="submit" style="margin-left:20px; display:inline" value="xxxxxxxxxxxx" >
</form>
</body>
</html>
<!--
Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/
-->
header("content-type:text/html;charset:utf-8;");
/*
chId 21202
content mmmmmmmmm
docId 11160676
docName 吴卓羲女友张馨予家中大尺度内衣自拍照火辣曝光
docUrl http://yue.ifeng.com/y/detail_2011_12/07/11160676_0.shtml
*/
$url = "http://comment.ifeng.com/post.php";
//$url = "http://localhost/php/index.php";
$data = array(
'content'=>'xxxxxxxxxxoooooooooooo',
'docId'=>11160676,
'docName'=>'吴卓羲女友张馨予家中大尺度内衣自拍照火辣曝光',
'docUrl'=>'http://yue.ifeng.com/y/detail_2011_12/07/11160676_0.shtml',
'chId'=>21202
);
$ret = http_post($url,$data);
var_dump($ret);
function http_post($url, $data)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER,1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
$data = http_build_query($data);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_REFERER, "http://yue.ifeng.com/y/detail_2011_12/07/11160676_0.shtml");
$cookie = "userid=1323532473389_2814";
curl_setopt($ch, CURLOPT_COOKIE, $cookie);
$rs = curl_exec($ch);
curl_close($ch);
return $rs;
}
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号