require_once("../../class2.php");
require_once(HEADERF);
require_once("language/".e_LANGUAGE.".php");
if (function_exists('select_user')) {
// DO NOTHING
} else {
function select_user($gs_form_name, $gs_form_value){
require_once(e_HANDLER."user_select_class.php");
$us = new user_select;
$ret = $us->select_form('popup', $gs_form_name, $gs_form_value);
return $ret;
}
}
if (isset($_GET['done'])) {
$ns->tablerender("Start Challenge","Thank you the challenge has been sent!
You will recieve notification via private message on Acception/Rejection of the challenge.
<< Back to Arcade Challenges
<< Send Another Challenge");
require_once(FOOTERF);
exit;
}
// Print navigation menu
$nav = "";
$nav .= "".ARCADE_1."";
$nav .= " ► Challenges";
$nav .= " ► Send New Challenge";
$title = "".ARCADE_38."";
$ns -> tablerender($title, $nav);
// END NAVIGATION MENU
$today = date("m/d/y");
$day = date("d");
$month = date("m");
$year = date("y");
$now = time();
$text .= "
";
$text .= "
<< Back";
$ns->tablerender("Start Challenge","".$text."");
$game = $_POST['game'];
$to = $_POST['to'];
if ($pref['arcade_goldactive'] == Yes) {
$bet = $_POST['bet'];
} else {
$bet = '0';
}
$vday = $_POST['dateday'];
$vmonth = $_POST['datemonth'];
$vyear = $_POST['dateyear'];
$enddate = mktime(20, 0, 0, $vmonth, $vday, $vyear);
$comments = $_POST['comments'];
$blank = "";
if ($pref['arcade_goldactive'] == Yes) {
$gold = gold(USERID);
}
$sql -> db_Select("user", "user_id", "user_name='".$to."'");
$row = $sql -> db_Fetch();
$sql -> db_Select("argames", "game_id", "game_title='".$game."'");
$game2 = $sql -> db_Fetch();
if ($pref['arcade_goldactive'] == Yes) {
if ($bet > $gold) {
echo 'You do not have enough gold to make this bet!';
require_once(FOOTERF);
exit;
}
}
if (isset($_POST['game']) && ($_POST['to']) && ($_POST['dateday']) && ($_POST['datemonth']) && ($_POST['dateyear'])) {
if ($row['user_id'] == $blank) {
echo 'Incorrect Username! Please Try Again.';
require_once(FOOTERF);
exit;
}
if ($row['user_id'] == USERID) {
echo 'You cannot start a challenge with yourself!';
require_once(FOOTERF);
exit;
}
if ($enddate <= $now) {
echo 'The END DATE of a challange cannot be set in the past or for the current date';
require_once(FOOTERF);
exit;
}
$sql->db_Insert("arcade_challenges", "'','".$row['user_id']."', '".USERID."', '".$game2['game_id']."', '".$bet."', '".$enddate."', '".$comments."', '1','0','0'");
$sql -> db_Select("user", "user_name", "user_id='".USERID."'");
$fro = $sql -> db_Fetch();
$msg = "You have recieved a new arcade challenge from ".$fro['user_name']." on the game ".$game.".
Go to the challenges area now to accept or reject this challenge.";
$size = strlen($msg);
$sendpm = mysql_query("INSERT INTO ".MPREFIX."private_msg (pm_id, pm_from, pm_to, pm_sent, pm_read, pm_subject, pm_text, pm_sent_del, pm_read_del, pm_attachments, pm_option, pm_size) VALUES('0', '".USERID."', '".$row['user_id']."', '".intval(time())."', '0', 'Arcade Challenge Recieved!', '".$msg."', '1', '0', '', '', '".intval($size)."' ) ");
header("Location: sendchal.php?done");
}
require_once(FOOTERF);
?>