Файл: ajax/answers/filter.php
Строк: 30
<?php
/**
* (C)Copyright 2011. All Rights Reserved.
* This software has been designed and developed by Yehia Abed
*
* Sngine -> ajax -> answers -> filter.php - filter answers
*
* Version 0.2 [Start Date: 04/01/2009]
*/
// fetch required files
$depth = '../../';
require_once($depth.'kernal.php');
// check user exist
if(!$userExist) {
exit(PopupError('Please log in to continue.', 'Not Logged In'));
}
// check user verified
if($userArray['Verified'] == "N") {
VerifyError();
}
// check page parameters
if(!isset($_POST['id'])) {
exit(PopupError(ReportError('parameters error[1] @/ajax/answers/filter')));
}
// valid inputs
$valid['do'] = array('spam', 'unspam');
if(!in_array($_POST['do'], $valid['do'])) {
exit(PopupError(ReportError('parameters error[2] @/ajax/answers/filter')));
}
// parse parameters
$id = ParseId($_POST['id'], 4);
if(!$id) {
exit(PopupError(ReportError('parameters error[3] @/ajax/answers/filter')));
}
$answerId = $id[1];
$postType = $id[2];
$postId = $id[3];
$authorId = $id[4];
// spam
if ($_POST['do'] == "spam") {
$db->query(sprintf("INSERT INTO users_spammers (UserID, SpammerID) VALUES (%s, %s)", SafeSQL($userArray['UserID'], 'int'), SafeSQL($authorId, 'int') )) || exit;
// unspam
}elseif ($_POST['do'] == "unspam") {
$db->query(sprintf("DELETE FROM users_spammers WHERE UserID = %s AND SpammerID = %s", SafeSQL($userArray['UserID'], 'int'), SafeSQL($authorId, 'int') )) || exit;
}
?>