sql_fetchrow($db->sql_query("SELECT title, admins FROM ".$prefix."_modules WHERE title='Downloads'"));
$row2 = $db->sql_fetchrow($db->sql_query("SELECT name, radminsuper FROM ".$prefix."_authors WHERE aid='$aid'"));
$admins = explode(",", $row['admins']);
$auth_user = 0;
for ($i=0; $i < sizeof($admins); $i++) {
if ($row2['name'] == "$admins[$i]" AND !empty($row['admins'])) {
$auth_user = 1;
}
}
if ($row2['radminsuper'] == 1 || $auth_user == 1) {
function WarsMenu() {
global $admin_file, $bgcolor2, $bgcolor1, $bgcolor3, $bgcolor4;
OpenTable();
echo "
";
CloseTable();
echo "
";
}
function WarsCredits() {
include ("header.php");
WarsMenu();
OpenTable();
echo "
Module Made by Untergang - Unters-Designs.be.tt
";
CloseTable();
include ("footer.php");
}
function WarsMain() {
global $prefix, $db, $bgcolor2, $bgcolor4, $banners, $admin_file, $ad_admin_menu_main, $bgcolor1;
include ("header.php");
WarsMenu();
OpenTable();
echo "Latest Wars
"
.""
." | "
."Date | "
."Opponent | "
."Status | "
."ID | "
."Edit | "
."Remove |
";
$result = $db->sql_query("SELECT wid, status, game, day, month, year, time, opp_tag, opp_name, opp_url, opp_country, style, gametype, first_map, second_map, third_map, our_score, opp_score, report, report_url from " . $prefix . "_wars order by year DESC, month DESC, day DESC limit 0 , 5");
while ($row = $db->sql_fetchrow($result)) {
$wid = $row['wid'];
$day = $row['day'];
$month = $row['month'];
$year = $row['year'];
$status = $row['status'];
$opp_tag = $row['opp_tag'];
$opp_name = $row['opp_name'];
$opp_country = $row['opp_country'];
$opp_url = $row['opp_url'];
$game = $row['game'];
if ($j == 0)
{
$bg = $bgcolor2;
$j++;
}
else
{
$bg = $bgcolor1;
$j = 0;
}
//show game_icon
$result_icon = $db->sql_query("SELECT name, icon_url FROM " . $prefix . "_wars_games WHERE gid = '$game'");
list($name, $icon_url) = $db->sql_fetchrow($result_icon);
$name = stripslashes($name);
$name = htmlentities($name);
if ($icon_url != "")
{
echo " | ";
}
else
{
echo " | ";
}
echo "$day-$month-$year | ";
echo" ";
if($opp_url !=""){
echo"$opp_tag";
if($opp_tag !="" ){
if($opp_name !=""){
echo" - ";}
}
echo "$opp_name | ";}
else {
echo"$opp_tag";
if($opp_tag !="" ){
if($opp_name !=""){
echo" - ";}
}
echo "$opp_name";
}
echo"$status | "
."$wid | "
."
| "
." |
";
}
$j=0;
echo "
";
CloseTable();
echo "
";
OpenTable();
echo "Games
"
.""
." | "
."Name | "
."ID | "
."Edit | "
."Remove |
";
$result = $db->sql_query("SELECT gid, name, icon_url from " . $prefix . "_wars_games order by name");
while ($row = $db->sql_fetchrow($result)) {
$gid = $row['gid'];
$name = $row['name'];
$icon_url = $row['icon_url'];
if ($j == 0)
{
$bg = $bgcolor2;
$j++;
}
else
{
$bg = $bgcolor1;
$j = 0;
}
echo " | "
."$name | "
."$gid | "
."
| "
." |
";
} $j=0;
echo "
";
CloseTable();
include("footer.php");
}
function WarsAdmin() {
global $prefix, $db, $bgcolor2, $banners, $admin_file, $ad_admin_menu_main, $bgcolor1, $bgcolor4;
include ("header.php");
WarsMenu();
echo "";
OpenTable();
echo "Wars
"
.""
." | "
."Date | "
."Opponent | "
."Status | "
."ID | "
."Edit | "
."Remove |
";
$result = $db->sql_query("SELECT wid, status, game, day, month, year, time, opp_tag, opp_name, opp_url, opp_country, style, gametype, first_map, second_map, third_map, our_score, opp_score, report, report_url from " . $prefix . "_wars order by year DESC, month DESC, day DESC");
while ($row = $db->sql_fetchrow($result)) {
$wid = $row['wid'];
$day = $row['day'];
$month = $row['month'];
$year = $row['year'];
$status = $row['status'];
$opp_tag = $row['opp_tag'];
$opp_name = $row['opp_name'];
$opp_url = $row['opp_url'];
$opp_country = $row['opp_country'];
$game = $row['game'];
if ($j == 0)
{
$bg = $bgcolor2;
$j++;
}
else
{
$bg = $bgcolor1;
$j = 0;
}
//show game_icon
$result_icon = $db->sql_query("SELECT name, icon_url FROM " . $prefix . "_wars_games WHERE gid = '$game'");
list($name, $icon_url) = $db->sql_fetchrow($result_icon);
$name = stripslashes($name);
$name = htmlentities($name);
if ($icon_url != "")
{
echo " | ";
}
else
{
echo " | ";
}
echo "$day-$month-$year | ";
echo" ";
if($opp_url !=""){
echo"$opp_tag";
if($opp_tag !="" ){
if($opp_name !=""){
echo" - ";}
}
echo "$opp_name | ";}
else {
echo"$opp_tag";
if($opp_tag !="" ){
if($opp_name !=""){
echo" - ";}
}
echo "$opp_name";
}
echo "$status | "
."$wid | "
."
| "
." |
";
}
$j=0;
echo "
";
CloseTable();
include("footer.php");
}
function Add_war() {
global $prefix, $db, $banners, $admin_file, $ad_admin_menu;
include ("header.php");
WarsMenu();
OpenTable();
echo"";
CloseTable();
include("footer.php");
}
function WarAdd($wid, $status, $game, $day, $month, $year, $time, $opp_tag, $opp_name, $opp_url, $opp_country, $style, $gametype, $first_map, $second_map, $third_map, $our_score, $opp_score, $report, $report_url) {
global $prefix, $db, $admin_file, $ad_admin_menu;
$wid = intval($wid);
$day = intval($day);
$month = intval($month);
$year = intval($year);
$our_score = intval($our_score);
$opp_score = intval($opp_score);
$opp_url = str_replace('http://', '', $opp_url);
$db->sql_query("insert into " . $prefix . "_wars values (NULL, '$status', '$game', '$day', '$month', '$year', '$time', '$opp_tag', '$opp_name', '$opp_url', '$opp_country', '$style', '$gametype', '$first_map', '$second_map', '$third_map', '$our_score', '$opp_score', '$report', '$report_url')");
include("header.php");
WarsMenu();
OpenTable();
echo "
";
CloseTable();
include("footer.php"); }
function WarDelete($wid, $ok=0) {
global $prefix, $db, $admin_file, $bgcolor1, $bgcolor2, $bgcolor4;
$wid = $wid;
if ($ok == 1) {
$result = $db->sql_query("SELECT screen_url from " . $prefix . "_wars_screenshots where wid='$wid'");
while ($row = $db->sql_fetchrow($result)) {
$screen_url = $row['screen_url'];
$tmpfile = "/$screen_url";
unlink($tmpfile);
$db->sql_query("delete from " . $prefix . "_wars_screenshots where screen_url='$screen_url'");
}
$db->sql_query("delete from " . $prefix . "_wars where wid='$wid'");
Header("Location: ".$admin_file.".php?op=WarsAdmin");
} else {
include("header.php");
$row = $db->sql_fetchrow($db->sql_query("SELECT wid, day, month, year, opp_tag, opp_name, opp_url, opp_country, our_score, opp_score from " . $prefix . "_wars where wid='$wid'"));
$wid = $row['wid'];
$day = $row['day'];
$month = $row['month'];
$year = $row['year'];
$opp_tag = $row['opp_tag'];
$opp_name = $row['opp_name'];
$opp_url = $row['opp_url'];
$opp_country = $row['opp_country'];
$our_score = $row['our_score'];
$opp_score = $row['opp_score'];
WarsMenu();
OpenTable();
echo "Delete War
";
echo ""
."ID | "
."Date | "
."Opponent | "
."Result |
";
echo "$wid | "
."$day/$month/$year | "
." ";
if($opp_url !=""){
echo"$opp_tag";
if($opp_tag !="" ){
if($opp_name !=""){
echo" - ";}
}
echo "$opp_name | ";}
else {
echo"$opp_tag";
if($opp_tag !="" ){
if($opp_name !=""){
echo" - ";}
}
echo "$opp_name";
}
if ($our_score > $opp_score) {
echo "";}
else if ($our_score < $opp_score) {
echo " | ";}
else {
echo " | ";}
echo "$our_score/$opp_score | ";
echo "
"
."Are you sure you want to delete this war?
"
."[ " . _NO . " | " . _YES . " ]
";
CloseTable();
include("footer.php");
}}
function WarEdit($wid) {
global $prefix, $db, $admin_file, $ad_admin_menu;
define('NO_EDITOR', true);
include("header.php");
WarsMenu();
$bid = intval($bid);
$row = $db->sql_fetchrow($db->sql_query("SELECT wid, status, game, day, month, year, time, opp_tag, opp_name, opp_url, opp_country, style, gametype, first_map, second_map, third_map, our_score, opp_score, report, report_url from " . $prefix . "_wars where wid='$wid'"));
$wid = $row['wid'];
$status = $row['status'];
$game = $row['game'];
$day = $row['day'];
$month = $row['month'];
$year = $row['year'];
$time = $row['time'];
$opp_tag = $row['opp_tag'];
$opp_name = $row['opp_name'];
$opp_url = $row['opp_url'];
$opp_country = $row['opp_country'];
$style = $row['style'];
$gametype = $row['gametype'];
$first_map = $row['first_map'];
$second_map = $row['second_map'];
$third_map = $row['third_map'];
$our_score = $row['our_score'];
$opp_score = $row['opp_score'];
$report = $row['report'];
$report_url = $row['report_url'];
OpenTable();
echo"";
CloseTable();
include("footer.php");
}
function WarChange($wid, $status, $game, $day, $month, $year, $time, $opp_tag, $opp_name, $opp_url, $opp_country, $style, $gametype, $first_map, $second_map, $third_map, $our_score, $opp_score, $report, $report_url) {
global $prefix, $db, $admin_file;
$opp_url = str_replace('http://', '', $opp_url);
$db->sql_query("update " . $prefix . "_wars set status='$status', game='$game', day='$day', month='$month', year='$year', time='$time', opp_tag='$opp_tag', opp_name='$opp_name', opp_url='$opp_url', opp_country='$opp_country', style='$style', gametype='$gametype', first_map='$first_map', second_map='$second_map', third_map='$third_map', our_score='$our_score', opp_score='$opp_score', report='$report', report_url='$report_url' where wid='$wid'");
Header("Location: ".$admin_file.".php?op=WarsAdmin");
}
function Add_game() {
global $prefix, $db, $admin_file;
include ("header.php");
WarsMenu();
OpenTable();
echo"";
echo "All fields are required";
CloseTable();
include("footer.php");
}
function GamesAdmin() {
global $prefix, $db, $bgcolor2, $admin_file, $bgcolor1, $bgcolor4;
include ("header.php");
WarsMenu();
echo "";
OpenTable();
echo "Games
"
.""
." | "
."Name | "
."ID | "
."Edit | "
."Remove |
";
$result = $db->sql_query("SELECT gid, name, icon_url from " . $prefix . "_wars_games order by gid");
while ($row = $db->sql_fetchrow($result)) {
$gid = $row['gid'];
$name = $row['name'];
$icon_url = $row['icon_url'];
if ($j == 0)
{
$bg = $bgcolor2;
$j++;
}
else
{
$bg = $bgcolor1;
$j = 0;
}
echo " | "
."$name | "
."$gid | "
."
| "
." |
";
}
$j=0;
echo "
";
CloseTable();
include("footer.php");
}
function GameAdd($game, $name, $icon_url)
{
global $prefix, $db, $admin_file;
$name = addslashes($name);
$game = intval($game);
$db->sql_query("insert into " . $prefix . "_wars_games values (NULL, '$name', '$icon_url')");
include("header.php");
WarsMenu();
OpenTable();
echo "
";
CloseTable();
include("footer.php");
}
function GameDelete($gid, $ok=0) {
global $prefix, $db, $admin_file, $bgcolor1, $bgcolor2;
$gid = $gid;
if ($ok == 1) {
$db->sql_query("delete from " . $prefix . "_wars_games where gid='$gid'");
Header("Location: ".$admin_file.".php?op=GamesAdmin");
} else {
include("header.php");
$row = $db->sql_fetchrow($db->sql_query("SELECT gid, name, icon_url from " . $prefix . "_wars_games where gid='$gid'"));
$gid = $row['gid'];
$name = $row['name'];
$icon_url = $row['icon_url'];
WarsMenu();
OpenTable();
echo "Delete Game
";
echo "";
echo " | ";
echo "$name | ";
echo "
"
."Are you sure you want to delete this game?
"
."[ " . _NO . " | " . _YES . " ]
";
CloseTable();
include("footer.php");
}}
function GameEdit($gid) {
global $prefix, $db, $admin_file;
define('NO_EDITOR', true);
include("header.php");
WarsMenu();
$row = $db->sql_fetchrow($db->sql_query("SELECT gid, name, icon_url from " . $prefix . "_wars_games where gid='$gid'"));
$gid = $row['gid'];
$name = $row['name'];
$icon_url = $row['icon_url'];
OpenTable();
echo"";
CloseTable();
include("footer.php");
}
function GameChange($gid, $name, $icon_url) {
global $prefix, $db, $admin_file;
$db->sql_query("update " . $prefix . "_wars_games set name='$name', icon_url='$icon_url' where gid='$gid'");
Header("Location: ".$admin_file.".php?op=GamesAdmin");
}
function Wars_add_screenshot($wid) {
global $db, $prefix, $bgcolor1, $bgcolor2, $bgcolor4, $admin_file;
include("header.php");
OpenTable();
echo "[ Go back ]
";
//Check if theres a file selected
if(isset($_FILES['bestand'])) {
//if the file is bigger then 51200 bytes(500kb) , it wont be accepted
if($_FILES['bestand']['size'] > 512000) {
echo "The filesize is " . $_FILES['bestand']['size'] . ", maximum allowed filesize is 500 kB";
} else {
//check is there a new name given
if(empty($_POST['naam'])) {
$filename = $_FILES['bestand']['name'];
$naam = "$wid$filename";
} else {
//select extension
$x = strrchr($_FILES['bestand']['name'], ".");
$filename = $_POST['naam'];
$naam = "$wid$filename$x";
}
//upload the file
move_uploaded_file($_FILES['bestand']['tmp_name'], "modules/Wars/Screenshots/" . $naam);
//add file to database
$url = "modules/Wars/Screenshots/" . $naam;
$db->sql_query("insert into " . $prefix . "_wars_screenshots values (NULL, '$naam', '$url', '$wid')");
//chmod the file so everyine can see it
chmod("modules/Wars/Screenshots/" . $naam, 0777);
}
} else {
echo "";
}
echo "";
echo "
ID |
Name |
Location |
Delete |
";
$result = $db->sql_query("SELECT screen_name, screen_url, screen_id from " . $prefix . "_wars_screenshots where wid='$wid'");
while ($row = $db->sql_fetchrow($result)) {
$screen_name = $row['screen_name'];
$screen_url = $row['screen_url'];
$screen_id = $row['screen_id'];
if ($j == 0)
{
$bg = $bgcolor2;
$j++;
}
else
{
$bg = $bgcolor1;
$j = 0;
}
echo "$screen_id | $screen_name | $screen_url | |
";
$j=0;}
echo "
[ Go back ]";
CloseTable();
include("footer.php");
}
function DelScreen($screen_id)
{
global $db, $prefix, $admin_file;
$result = $db->sql_query("SELECT screen_name, screen_url, screen_id, wid from " . $prefix . "_wars_screenshots where screen_id='$screen_id'");
while ($row = $db->sql_fetchrow($result)) {
$screen_name = $row['screen_name'];
$screen_url = $row['screen_url'];
$screen_id = $row['screen_id'];
$wid = $row['wid'];}
$tmpfile = "/$screen_url";
unlink($tmpfile);
$db->sql_query("delete from " . $prefix . "_wars_screenshots where screen_url='$screen_url'");
Header("Location: ".$admin_file.".php?op=Wars_add_screenshot&wid=$wid");
}
if (!isset($save)) { $save = ""; }
if (!isset($terms_body)) { $terms_body = ""; }
if (!isset($country)) { $country = ""; }
if (!isset($ok)) { $ok = ""; }
if (!isset($active)) { $active = ""; }
if (!isset($new_pos)) { $new_pos = ""; }
switch($op) {
case "WarsMain":
WarsMain();
break;
case "WarsAdmin":
WarsAdmin();
break;
case "WarAdd":
WarAdd($wid, $status, $game, $day, $month, $year, $time, $opp_tag, $opp_name, $opp_url, $opp_country, $style, $gametype, $first_map, $second_map, $third_map, $our_score, $opp_score, $report, $report_url);
break;
case "Add_war":
Add_war();
break;
case "WarDelete":
WarDelete($wid, $ok);
break;
case "WarEdit":
WarEdit($wid);
break;
case "WarChange":
WarChange($wid, $status, $game, $day, $month, $year, $time, $opp_tag, $opp_name, $opp_url, $opp_country, $style, $gametype, $first_map, $second_map, $third_map, $our_score, $opp_score, $report, $report_url);
break;
case "GamesAdmin":
GamesAdmin();
break;
case "Add_game":
Add_game();
break;
case "GameAdd":
GameAdd($gid, $name, $icon_url);
break;
case "GameDelete":
GameDelete($gid, $ok);
break;
case "GameEdit":
GameEdit($gid);
break;
case "GameChange":
GameChange($gid, $name, $icon_url);
break;
case "WarsCredits":
WarsCredits();
break;
case "Wars_add_screenshot":
Wars_add_screenshot($wid);
break;
case "DelScreen":
DelScreen($screen_id, $wid);
break;
}
} else {
echo "Access Denied";
}
?>