Files
Testing/user_report1.php
sean 0e8a8b3028
Some checks are pending
deploy-testing / deploy (push) Waiting to run
Initial testing snapshot
2026-11-17 16:15:01 -05:00

197 lines
4.8 KiB
PHP

<?php
/* $Id: user_report.php 42 2009-01-29 04:55:14Z john $ */
include "header.php";
$page = "user_report1";
if(isset($_POST['task'])) { $task = $_POST['task']; } else { $task = "main"; }
if(isset($_POST['return_url'])) { $return_url = $_POST['return_url']; } elseif(isset($_GET['return_url'])) { $return_url = $_GET['return_url']; } else { $return_url = ""; }
// EXIT IF USER IS NOT LOGGED IN
if( !$user->user_exists ) { exit(); }
// MAKE SURE RETURN URL IS SET
if($return_url == "") { exit(); }
// ENCODE RETURN URL
$return_url = urldecode($return_url);
$return_url = str_replace("&amp;", "&", $return_url);
// SET VARS
$submitted = 0;
// SEND REPORT
if($task == "dosend")
{
// ENCODE RETURN URL
$return_url = urlencode($return_url);
// GET REPORT REASON AND DETAILS
$report_reason = $_POST['report_reason'];
$report_details = $_POST['report_details'];
// ADD TO DATABASE
if($report_reason==1){
$email="reportspam@bateworld.com";
$subject="Spam Reported";
$reports = $database->database_query("SELECT * FROM se_reports WHERE report_url='". $database->database_real_escape_string($return_url)."' AND time>".(time()-(60*5))."");
//if(SE_DEBUG){mail("leprakhauns@gmail.com", "eee", $return_url));}
if($database->database_num_rows($reports)>=3){
$explode=explode("user%3D",$return_url);
$explode1=explode("%",$explode[1]);
$report_info["reportusername"]=$explode1[0];
$database->database_query("UPDATE se_users SET user_enabled='-1' WHERE user_username='".$database->database_real_escape_string($report_info["reportusername"])."'");
$report_array[] = $report_info;
}
}
elseif($report_reason==2){
$email="reportinappropriate@bateworld.com";
$subject="Inappropriate Content Reported";
}
elseif($report_reason==3){
$email="reportabuse@bateworld.com";
$subject="Abuse Reported";
}
elseif($report_reason==4){
$email="reportother@bateworld.com";
$subject="Other Reported";
}
try{
// DECODE SUBJECT AND EMAIL FOR SENDING
//$subject = htmlspecialchars_decode($subject, ENT_QUOTES);
//$message = htmlspecialchars_decode($message, ENT_QUOTES);
// REPLACE VARIABLES IN SUBJECT AND MESSAGE
//$subject = str_replace($search, $replace, $subject);
////$message = str_replace($search, $replace, $message);
// ENCODE SUBJECT FOR UTF8
//$subject="=?UTF-8?B?".base64_encode($subject)."?=";
// REPLACE CARRIAGE RETURNS WITH BREAKS
//$message = str_replace("\n", "<br>", $message);
require_once('/home/bateworld/public_html/mailer/class.phpmailer.php');
//include("class.smtp.php"); // optional, gets called from within class.phpmailer.php if not already loaded
//$mail = new PHPMailer(true); // the true param means it will throw exceptions on errors, which we need to catch
//$mail->IsSMTP(); // telling the class to use SMTP
$mail = new PHPMailer();
//$mail->IsSMTP(); // telling the class to use SMTP
//$mail->Host = "mail.b8world.com"; // SMTP server
//$mail->SMTPAuth = true; // authentication enabled
//$mail->SMTPSecure = 'ssl';
//$mail->Port = 587;
//$mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail
//$mail->Username = "happybirthday@b8world.com"; // SMTP account username
//$mail->Password = "y2sWJ*#h8)xG"; // SMTP account password
//$mail->From = "mailservices@b8world.com";
$mail->SetFrom($email, 'Bateworld Reports');
//$mail->AddReplyTo('happybirthday@b8world.com', 'Bateworld');
$mail->AddAddress('BateWorld@cayzuemail.com');
$mail->Subject = $subject;
//$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; // optional - MsgHTML will create an alternate automatically
$mail->MsgHTML("User: ".$user->user_info["user_username"]." reported <a href='".urldecode($return_url)."' target='_blank'>".urldecode($return_url)."</a> and sent the message:<br>".$report_details);
//$mail->AddAttachment('images/61916url_logo.png'); // attachment
//$mail->AddAttachment('mailer/images/phpmailer_mini.gif'); // attachment
$mail->Send();
//echo "Message Sent OK<p></p>\n";
//echo "Message Sent OK<p></p>\n";
} catch (phpmailerException $e) {
//mail("porembaphilip@gmail.com", "MAIL ERROR", $e->errorMessage());
echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
echo $e->getMessage(); //Boring error messages from anything else!
//mail("porembaphilip@gmail.com", "MAIL ERROR", $e->getMessage());
}
// IF DATABASE HAS OVER 5000 REPORTS, CLEAN THEM OUT
/* $reports_total = $database->database_num_rows($database->database_query("SELECT report_id FROM se_reports"));
if($reports_total > 5000)
{
$database->database_query("DELETE FROM se_reports WHERE report_id ORDER BY report_id ASC LIMIT 100");
}
*/
$submitted = 1;
}
// ASSIGN SMARTY VARIABLES AND INCLUDE FOOTER
$smarty->assign('return_url', $return_url);
$smarty->assign('submitted', $submitted);
include "footer.php";
?>