【php开源代码栏目提醒】:网学会员为需要php开源代码的朋友们搜集整理了addwritein.php相关资料,希望对各位网友有所帮助!
<?php
session_start();
include "dbfunc.php";
$link=connect_db();
if(!isset($_SESSION['admin'])) {
header("location:admin.php");
exit;
}
$addr=$REMOTE_ADDR;
$query=mysql_query("SElECT * FROM questions WHERE pollid = '".$_REQUEST['pollorder']."'");
for ($x=1;$questions=mysql_fetch_row($query);$x++)
{
//print "DB: $questions[2], FORM: $question<br>";
if ($questions[2] == $question)
{
$added=1;
break;
}
else
{
$added=0;
}
}
if ($added !=1)
{
if (($question == "") || ($question == " "))
{
print "参数不能为空.<br><br>";
}
else
{
$ipquery="SELECT * FROM ip WHERE pollorder=".$_REQUEST['pollorder']."";
$ip_handle= mysql_query($ipquery)
or die("Cant Init. IP Logger");
$ips = mysql_fetch_row($ip_handle);
for ($ipcount=1; $ipcount <=10; ++$ipcount)
{
if ($ips[$ipcount]==$addr)
{
die ("Your IP has voted in this poll in the last 10 votes.<br><a href=poll.php?pollorder=$pollorder>Go Back</a>");
}
}
print "$question added";
mysql_query("INSERT INTO questions VALUES('0','$pollorder','$question','1')")
or die("Cannot Add New Writein!!! <br><br>[<a href=poll.php?pollorder=$pollorder>Vote Again</a>]");
}
}
else
{
print "$question updated";
mysql_query("UPDATE questions SET votes = votes + 1 WHERE question = '$question'");
}
//header("Location:dovote.php?pollorder=$pollorder&vote=2000&addr=$REMOTE_ADDR&added=$added");
?>
上一篇:
AddVote.php
下一篇:
张方宇那些让人脸发烫的语录2