PHP:
if($task == "send") {
$userpointsquery = $database->database_query("SELECT `points` FROM `se_users` WHERE userpoints_user_id = '{$user->user_info['user_id']}'");
while($userpoint = $database->database_fetch_assoc($userpointsquery)) {
$userpoints = $userpoint['userpoints_count'];
}
$costpointsquery = $database->database_query("SELECT `cost` FROM `mf_gifts_data` WHERE id = ".$_POST['gift_id']);
while($costpoint = $database->database_fetch_assoc($costpointsquery)) {
$costpoints = $costpoint['cost'];
}
$message = ereg_replace("http://([.]?[a-zA-Z0-9_/-])*", "<a href=\"\\0\">\\0</a>", $_POST['message']);
$message = ereg_replace("(^| |\n)(www([.]?[a-zA-Z0-9_/-])*)", "\\1<a href=\"http://\\2\">\\2</a>", $message);
$message = cleanHTML($message, "a");
$message = str_replace("\n", "<br>", $message);
if ($_POST['to'] == "" or $_POST['to'] == 0) $_POST['to'] = $_GET['to'];
if($_POST['gift_id'] != '' AND $_POST['to'] != 0 AND $userpoints >= $costpoints){
$data = array(
'to_user' => $_POST['to'],
'gift_id' => $_POST['gift_id'],
'from_id' => $user->user_info[user_id],
'from_un' => $user->user_info[user_username],
'from_dn' => $user->user_displayname,
'message' => $message,
'private' => $_POST['private']);
$database->database_query("UPDATE `se_semods_userpoints` SET `userpoints_count` = '".($userpoints - $costpoints)."' WHERE `userpoints_user_id` = '{$user->user_info['user_id']}' ");
$gift->save_data($data);
}else{
$is_error = 80000028;
}
if($userpoints < $costpoints){$is_error = 80000054;}
if($_POST['to'] == 0){$is_error = 80000032;}
if($is_error != 0) { SE_Language::_preload($is_error); SE_Language::load(); $error_message = SE_Language::_get($is_error);}
else {$balance=($userpoints - $costpoints);}
echo "<html><head><meta http-equiv='Content-Type' content='text/html; charset=UTF-8'><script type='text/javascript'>";
echo "window.parent.messageSent('$is_error', '".str_replace("'", "\'", $error_message)."', '".str_replace("'", "\'", $balance)."');";
echo "</script></head><body></body></html>";
$userpoints = $balance;
exit();
}
Если покопать данный кусок кода можно сделать отправку подарков бесплатную!
Или же из определенной таблицы из базы!
Зачем ставить целый плагин, который будет нагружать сервер, когда тут такое простое решение!
Кто поможет решить?