if(isset($_POST['submit'])) {
if ($_POST['remember'] != '') {
setcookie("remember", $_POST['user'].";".$_POST['email'].";".$_POST['site'], time()+3600*24*31*2, "/");
} else {
setcookie("remember", "", time(), "/");
}
if(isset($_GET['id'])) {
$comment2 = $_POST['comment'];
$comment = stripslashes($_POST['comment']);
if($comment != '') {
$comment = stripslashes($_POST['comment']);
$id = $_GET["id"];
$uid = $_POST['user'];
$email = $_POST['email'];
$site = $_POST['site'];
// begin tijdelijke oplossing
if(isset($_POST['user_code'])) {
$code = $_POST['user_code'];
} else {
$code = '';
}
// einde tijdelijke oplossing
if($uid != '' AND $email != '') {
$checksubmit = mysql_result(mysql_query("SELECT COUNT(id) FROM poemscomments WHERE username = '$uid' AND comment = '$comment'"),0);
require('php-captcha.inc.php');
if (PhpCaptcha::Validate($_POST['user_code'])) {
//if ($code == '') {
if($checksubmit == 0) {
mysql_query("INSERT INTO poemscomments (username,email,site,poemsid,date,comment) VALUES ('$uid','$email','$site','$id',now(),'$comment')") or die (mysql_error());
$succesmsg = 'Your comment is added.';
} else {
$errormsg = 'You allready posted this comment';
}
} else {
$errormsg = 'You entered the wrong security code';
}
} else {
$errormsg = 'Please enter your name and e-mail!';
}
} else {
$errormsg = 'Please write your comment!.';
}
} else {
$errormsg = 'This poemspost is invalid!.';
}
}
if (isset($succesmsg)) {
$pagecontent .= mnonerror('Well done!',$succesmsg);
}
if(isset($_GET["id"])) {
$poemsid = $_GET["id"];
$idcheck = mysql_result(mysql_query("SELECT COUNT(id) FROM poems WHERE id = '$poemsid'"),0);
} else {
$idcheck = 0;
}
if ($idcheck != 1) {
$pagecontent .= merror('Page error',"There is no poemspost with this id!");
} else {
mysql_query("UPDATE poems SET views = views +1 WHERE id='$poemsid'") or die(mysql_error());
$poemsquery = mysql_query("SELECT n.id, n.topic, n.poems, n.date, u.username, u.id AS uid, c.categoryname, n.poemscat, n.pollid FROM poems as n, users as u, poemscategory as c WHERE n.userid = u.id AND n.poemscat = c.id AND n.id = $poemsid") or die (mysql_error());
while ($poems = mysql_fetch_assoc($poemsquery)) {
if(isset($_SESSION['sadmin'])) {
$adminbutton = '';
if(($_SESSION['sadmin'] & 16) == 16) {
$adminbutton .= '
';
} elseif(($_SESSION['sadmin'] & 8) == 8 AND $poems["uid"] == $_SESSION['sid']) {
$adminbutton .= '
';
} if(($_SESSION['sadmin'] & 64) == 64) {
$adminbutton .= '
';
} elseif(($_SESSION['sadmin'] & 32) == 32 AND $poems["uid"] == $_SESSION['sid']) {
$adminbutton .= '
';
//$adminbutton = '
';
} else {
$adminbutton = '';
}} else {
$adminbutton ='';
}
$tags = '';
$pagecontent .= mpoems($poems["id"],$poems["topic"],$poems["poems"],$poems["date"],$poems["username"],$poems["poemscat"],$poems["categoryname"],'',$adminbutton,$tags);
$sitetitle .= $poems["topic"];
if($poems["pollid"] != 0) {
$pollid = $poems["pollid"];
$open = mysql_result(mysql_query("SELECT COUNT(id) FROM poll WHERE id = $pollid AND public = '1'"),0);
$query = mysql_query("SELECT * FROM poll WHERE id = $pollid") or die (mysql_error());
while ($poll = mysql_fetch_assoc($query)) {
$id = $poll["id"];
$title = $poll["title"];
$text = '