476 lines
9.6 KiB
PHP
476 lines
9.6 KiB
PHP
<?php
|
|
|
|
/* $Id: help_contact.php 42 2009-01-29 04:55:14Z john $ */
|
|
|
|
header("Location: /contact/");
|
|
exit;
|
|
|
|
$page = "help_contact";
|
|
|
|
include "header.php";
|
|
|
|
|
|
|
|
if(isset($_POST['task'])) { $task = $_POST['task']; } elseif(isset($_GET['task'])) { $task = $_GET['task']; } else { $task = "main"; }
|
|
|
|
|
|
|
|
|
|
|
|
// SET DEFAULTS
|
|
|
|
$result = 0;
|
|
|
|
$is_error = 0;
|
|
|
|
|
|
|
|
// SET DEFAULT EMAIL IF NOT SUBMITTED
|
|
|
|
if(!isset($_POST['contact_email'])) { $contact_email = $user->user_info['user_email']; } else { $contact_email = $_POST['contact_email']; }
|
|
|
|
|
|
|
|
// SEND HELP MESSAGE
|
|
|
|
if($task == "dosend")
|
|
|
|
{
|
|
|
|
$contact_name = $_POST['contact_name'];
|
|
|
|
$contact_subject = $_POST['contact_subject'];
|
|
|
|
$contact_message = $_POST['contact_message'];
|
|
|
|
//echo $contact_message;
|
|
|
|
|
|
|
|
$ExactBrowserNameUA=$_SERVER['HTTP_USER_AGENT'];
|
|
|
|
|
|
|
|
if (strpos(strtolower($ExactBrowserNameUA), "safari/") and strpos(strtolower($ExactBrowserNameUA), "opr/")) {
|
|
|
|
// OPERA
|
|
|
|
$ExactBrowserNameBR="Opera";
|
|
|
|
} elseif (strpos(strtolower($ExactBrowserNameUA), "safari/") and strpos(strtolower($ExactBrowserNameUA), "chrome/")) {
|
|
|
|
// CHROME
|
|
|
|
$ExactBrowserNameBR="Chrome";
|
|
|
|
} elseif (strpos(strtolower($ExactBrowserNameUA), "msie")) {
|
|
|
|
// INTERNET EXPLORER
|
|
|
|
$ExactBrowserNameBR="Internet Explorer";
|
|
|
|
} elseif (strpos(strtolower($ExactBrowserNameUA), "firefox/")) {
|
|
|
|
// FIREFOX
|
|
|
|
$ExactBrowserNameBR="Firefox";
|
|
|
|
} elseif (strpos(strtolower($ExactBrowserNameUA), "safari/") and strpos(strtolower($ExactBrowserNameUA), "opr/")==false and strpos(strtolower($ExactBrowserNameUA), "chrome/")==false) {
|
|
|
|
// SAFARI
|
|
|
|
$ExactBrowserNameBR="Safari";
|
|
|
|
} else {
|
|
|
|
// OUT OF DATA
|
|
|
|
$ExactBrowserNameBR="OUT OF DATA";
|
|
|
|
};
|
|
|
|
|
|
|
|
$os_platform = "Unknown OS Platform";
|
|
|
|
|
|
|
|
$os_array = array(
|
|
|
|
'/windows nt 6.3/i' => 'Windows 8.1',
|
|
|
|
'/windows nt 6.2/i' => 'Windows 8',
|
|
|
|
'/windows nt 6.1/i' => 'Windows 7',
|
|
|
|
'/windows nt 6.0/i' => 'Windows Vista',
|
|
|
|
'/windows nt 5.2/i' => 'Windows Server 2003/XP x64',
|
|
|
|
'/windows nt 5.1/i' => 'Windows XP',
|
|
|
|
'/windows xp/i' => 'Windows XP',
|
|
|
|
'/windows nt 5.0/i' => 'Windows 2000',
|
|
|
|
'/windows me/i' => 'Windows ME',
|
|
|
|
'/win98/i' => 'Windows 98',
|
|
|
|
'/win95/i' => 'Windows 95',
|
|
|
|
'/win16/i' => 'Windows 3.11',
|
|
|
|
'/macintosh|mac os x/i' => 'Mac OS X',
|
|
|
|
'/mac_powerpc/i' => 'Mac OS 9',
|
|
|
|
'/linux/i' => 'Linux',
|
|
|
|
'/ubuntu/i' => 'Ubuntu',
|
|
|
|
'/iphone/i' => 'iPhone',
|
|
|
|
'/ipod/i' => 'iPod',
|
|
|
|
'/ipad/i' => 'iPad',
|
|
|
|
'/android/i' => 'Android',
|
|
|
|
'/blackberry/i' => 'BlackBerry',
|
|
|
|
'/webos/i' => 'Mobile'
|
|
|
|
);
|
|
|
|
|
|
|
|
foreach ($os_array as $regex => $value) {
|
|
|
|
|
|
|
|
if (preg_match($regex, $ExactBrowserNameUA)) {
|
|
|
|
$os_platform = $value;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
$contact_message.="<br />
|
|
|
|
Browser: ".$ExactBrowserNameBR."<br />
|
|
|
|
OS: ".$os_platform."<br />
|
|
|
|
Additional Info: ".$_SERVER['HTTP_USER_AGENT'];
|
|
|
|
|
|
|
|
|
|
|
|
// MAKE SURE FIELDS ARE NOT BLANK
|
|
|
|
if(!is_email_address($contact_email)) { $is_error = 698; }
|
|
|
|
if(trim($contact_message) == "") { $is_error = 1036; }
|
|
|
|
if(trim($contact_name) == "") { $is_error = 1046; }
|
|
|
|
|
|
|
|
// CHECK CODE
|
|
|
|
// NOW IN HEADER:
|
|
|
|
//session_start();
|
|
|
|
if( !empty($setting['setting_contact_code']) )
|
|
|
|
{
|
|
|
|
$code = $_SESSION['code'];
|
|
|
|
if($code == "") { $code = randomcode(); }
|
|
|
|
$contact_secure = $_POST['contact_secure'];
|
|
|
|
|
|
|
|
if($contact_secure != $code)
|
|
|
|
$is_error = 708;
|
|
|
|
}
|
|
|
|
|
|
|
|
// SEND MESSAGE TO SUPERADMIN
|
|
|
|
if( !$is_error )
|
|
|
|
{
|
|
|
|
$recepient_info = $database->database_fetch_assoc($database->database_query("SELECT admin_email, admin_name FROM se_admins ORDER BY admin_id LIMIT 1"));
|
|
|
|
|
|
|
|
// GET SUBJECT AND MESSAGE
|
|
|
|
SE_Language::_preload_multi(1153, 1154);
|
|
|
|
SE_Language::load();
|
|
|
|
|
|
|
|
// COMPOSE SUBJECT
|
|
|
|
$subject = vsprintf(SE_Language::_get(1153), Array($contact_subject));
|
|
|
|
|
|
|
|
// COMPOSE MESSAGE
|
|
|
|
$contact_message.="<br /><br />Username: ".$_POST["username"]."<br />
|
|
|
|
Happened At: ".$_POST["month"]." ".$_POST["day"]." ".$_POST["year"]." ".$_POST["hour"].":".$_POST["minute"]."<br />
|
|
|
|
Timezone: ".$_POST["timezone"]."<br />";
|
|
|
|
$message = vsprintf(SE_Language::_get(1154), Array($recepient_info['admin_name'], $contact_email, $contact_name, $contact_subject, $contact_message));
|
|
|
|
|
|
|
|
// SEND MAIL
|
|
|
|
$contact_recipient="bateworldhelp@gmail.com";
|
|
|
|
send_generic_orig($contact_recipient, $contact_email, $subject, $message, Array(), Array());
|
|
|
|
$database->database_query("INSERT INTO contactemails SET name='".$database->database_real_escape_string($_POST["contact_name"])."', email='".$database->database_real_escape_string($_POST["contact_email"])."', IP='".$database->database_real_escape_string($_SERVER["REMOTE_ADDR"])."', subject='".$database->database_real_escape_string($_POST["contact_subject"])."', message='".$database->database_real_escape_string($_POST["contact_message"])."', username='".$database->database_real_escape_string($_POST["username"])."', time='".$database->database_real_escape_string($_POST["month"]." ".$_POST["day"]." ".$_POST["year"]." ".$_POST["hour"].":".$_POST["minute"])."',timezone='".$database->database_real_escape_string($_POST["timezone"])."', info='".$database->database_real_escape_string($_SERVER['HTTP_USER_AGENT'])."'") or die(mail("leprakhauns@gmail.com", "MasturbateWorld Contact Error2", var_export($_POST, true)));
|
|
|
|
|
|
|
|
// SET RESULT
|
|
|
|
$result = 1040;
|
|
|
|
$contact_name = "";
|
|
|
|
$contact_email = $user->user_info['user_email'];
|
|
|
|
$contact_subject = "";
|
|
|
|
$contact_message = "";
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// SET GLOBAL PAGE TITLE/DESCRIPTION
|
|
|
|
$global_page_title[0] = 754;
|
|
|
|
$global_page_description[0] = 1035;
|
|
|
|
|
|
|
|
function get_timezone()
|
|
|
|
{
|
|
|
|
// is curl installed?
|
|
|
|
if (!function_exists('curl_init')){
|
|
|
|
die('CURL is not installed!');
|
|
|
|
}
|
|
|
|
$ip = $_SERVER['REMOTE_ADDR']; // means we got user's IP address
|
|
|
|
$Url='http://smart-ip.net/geoip-json/' . $ip;
|
|
|
|
// create a new curl resource
|
|
|
|
$ch = curl_init();
|
|
|
|
|
|
|
|
/*
|
|
|
|
Here you find more options for curl:
|
|
|
|
http://www.php.net/curl_setopt
|
|
|
|
*/
|
|
|
|
|
|
|
|
// set URL to download
|
|
|
|
curl_setopt($ch, CURLOPT_URL, $Url);
|
|
|
|
|
|
|
|
// set referer:
|
|
|
|
curl_setopt($ch, CURLOPT_REFERER,'http://smart-ip.net/geoip-json/' . $ip);
|
|
|
|
|
|
|
|
// user agent:
|
|
|
|
curl_setopt($ch, CURLOPT_USERAGENT, "MozillaXYZ/1.0");
|
|
|
|
|
|
|
|
// remove header? 0 = yes, 1 = no
|
|
|
|
curl_setopt($ch, CURLOPT_HEADER, 0);
|
|
|
|
|
|
|
|
// should curl return or print the data? true = return, false = print
|
|
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
|
|
|
|
|
|
// timeout in seconds
|
|
|
|
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
|
|
|
|
|
|
|
// download the given URL, and return output
|
|
|
|
$ttt = curl_exec($ch);
|
|
|
|
|
|
|
|
// close the curl resource, and free system resources
|
|
|
|
curl_close($ch);
|
|
|
|
|
|
|
|
|
|
|
|
// maybe it's good to add some checks (if/else you've got an answer and if json could be decoded, etc.)
|
|
|
|
$ipData = json_decode( $ttt, true);
|
|
|
|
|
|
|
|
|
|
|
|
date_default_timezone_set($ipData['timezone']);
|
|
|
|
|
|
|
|
|
|
|
|
echo $now1->timezone;
|
|
|
|
?><input type="hidden" value="<?=$ipData['timezone']?>" name="timezone" />
|
|
|
|
<select name="month">
|
|
|
|
<option <? if(date("F")=="January"){?> selected="selected"<? }?>>January</option>
|
|
|
|
<option <? if(date("F")=="February"){?> selected="selected"<? }?>>February</option>
|
|
|
|
<option <? if(date("F")=="March"){?> selected="selected"<? }?>>March</option>
|
|
|
|
<option <? if(date("F")=="April"){?> selected="selected"<? }?>>April</option>
|
|
|
|
<option <? if(date("F")=="May"){?> selected="selected"<? }?>>May</option>
|
|
|
|
<option <? if(date("F")=="June"){?> selected="selected"<? }?>>June</option>
|
|
|
|
<option <? if(date("F")=="July"){?> selected="selected"<? }?>>July</option>
|
|
|
|
<option <? if(date("F")=="August"){?> selected="selected"<? }?>>August</option>
|
|
|
|
<option <? if(date("F")=="September"){?> selected="selected"<? }?>>September</option>
|
|
|
|
<option <? if(date("F")=="October"){?> selected="selected"<? }?>>October</option>
|
|
|
|
<option <? if(date("F")=="November"){?> selected="selected"<? }?>>November</option>
|
|
|
|
<option <? if(date("F")=="December"){?> selected="selected"<? }?>>December</option>
|
|
|
|
</select>
|
|
|
|
<select name="day">
|
|
|
|
<? for($x=1; $x<32; $x++)
|
|
|
|
{
|
|
|
|
?><option <? if($x==date("j")){?> selected="selected"<? }?>><?=$x?></option><?
|
|
|
|
}?></select>
|
|
|
|
<select name="year"><option><?=date("Y")-1?></option><option selected="selected"><?=date("Y")?></option></select>
|
|
|
|
<select name="hour">
|
|
|
|
<? for($x=0; $x<24; $x++)
|
|
|
|
{
|
|
|
|
?><option <? if($x==date("G")){?> selected="selected"<? }?>><?=$x?></option><?
|
|
|
|
}?></select>:<select name="minute">
|
|
|
|
<? for($x=0; $x<60; $x++)
|
|
|
|
{
|
|
|
|
?><option <? if($x==date("i")){?> selected="selected"<? }?>><?=$x?></option><?
|
|
|
|
}?></select>
|
|
|
|
<?
|
|
|
|
date_default_timezone_set('America/Phoenix');
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
// ASSIGN SMARTY VARIABLES AND INCLUDE FOOTER
|
|
|
|
$smarty->assign('now', $now);
|
|
|
|
$smarty->assign('result', $result);
|
|
|
|
$smarty->assign('is_error', $is_error);
|
|
|
|
$smarty->assign('contact_name', $contact_name);
|
|
|
|
$smarty->assign('contact_email', $contact_email);
|
|
|
|
$smarty->assign('contact_subject', $contact_subject);
|
|
|
|
$smarty->assign('contact_message', $contact_message);
|
|
|
|
|
|
|
|
include "footer.php";
|
|
|
|
|
|
|
|
?>
|