if(!IsSet($indexloaded)){
header("Location: ./index.php");
}
//CHECK ADMIN ACCESS LEVEL
if($admn[access] < 85){
include("$dir[func]/error.php");
display_error("You are not allowed to perform this function.
");
}
function admin_tourny(){
global $dir, $url, $out, $site, $admn;
//GET FAQS
$tournylist=mysql_query("SELECT tid,name FROM tournament_tourneys ORDER by tid");
while(list($tid,$name)=mysql_fetch_row($tournylist)){
$thetourny=$thetourny."";
}
$tablehead=table_head("show","100%","","center");
$tablefoot=table_foot("show");
$bannerhead=table_head("show","488","80","center");
$bannerfoot=table_foot("show");
$out[body]=$out[body]."
$bannerhead
$out[banner]
$bannerfoot
$tablehead
$tablefoot";
include("$dir[curtheme]");
}
function admin_tournyb($tournyid,$todo){
global $dir, $url, $out, $site, $admn;
if($todo=="Create Tournament"){
create_tourny();
}
else if($todo=="Edit Tournament"){
edit_tourny($tournyid);
}
else if($todo=="Delete Tournament"){
delete_tourny($tournyid);
include("$dir[func]/admin_finishmessage.php");
display_message("The selected Tournament was deleted.
");
}
else{
include("$dir[func]/error.php");
display_error("Unknown Command.
");
}
}
function create_tourny($todo){
global $dir, $url, $out, $site, $admn;
$tablehead=table_head("show","100%","","center");
$tablefoot=table_foot("show");
$bannerhead=table_head("show","488","80","center");
$bannerfoot=table_foot("show");
$out[body]=$out[body]."
$bannerhead
$out[banner]
$bannerfoot
$tablehead
Creat a new Tournament
$tablefoot";
include("$dir[curtheme]");
}
function admin_tournyc($size,$type,$active,$name,$details,$field1,$field2,$field3,$directors,$logo,$bgcolor,$tdcolor,$fontcolor){
global $dir, $url, $out, $site, $admn;
include("$dir[func]/checkdata.php");
$errormessage=check_validlength($errormessage, $name, "0", "250", "Your Question must not exceed 250 charecters");
$errormessage=check_validlength($errormessage, $details, "0", "5000", "Your answer must not exceed 5000 charecters");
error_check($errormessage);
$name=change_charecters($name);
$details=change_fromlinebreaks($details);
$details=change_charecters($details);
$details=change_tocharectercode($details);
$tday=date("Y-m-d H:i:s");
mysql_query("INSERT INTO tournament_tourneys VALUES (NULL,'$size','$type','$active','$$name','$details','$field1','$field2','$field3','$directors','$logo','$bgcolor','$tdcolor','$fontcolor');");
include("$dir[func]/admin_finishmessage.php");
display_message("The Tournament has been added.
");
}
function edit_tourny($tournyid){
global $dir, $url, $out, $site, $admn;
$tournyinfo=mysql_query("SELECT * FROM tournament_tourneys WHERE id='$tournyid'");
$tourny=mysql_fetch_array($tournyinfo);
if(!$tourny[id]){
include("$dir[func]/error.php");
display_error("Unknown Tournament ID.
");
}
include("$dir[func]/checkdata.php");
$tourny[details]=change_tolinebreaks($tourny[details]);
$tourny[details]=change_fromcharectercode($tourny[details]);
$tablehead=table_head("show","100%","","center");
$tablefoot=table_foot("show");
$bannerhead=table_head("show","488","80","center");
$bannerfoot=table_foot("show");
$out[body]=$out[body]."
$bannerhead
$out[banner]
$bannerfoot
$tablehead
Edit Selected Tournament
$tablefoot";
include("$dir[curtheme]");
}
function admin_tournyd($tournyid,$size,$type,$active,$name,$details,$field1,$field2,$field3,$directors,$logo,$bgcolor,$tdcolor,$fontcolor){
global $dir, $url, $out, $site, $admn;
if(!$tournyid){
include("$dir[func]/error.php");
display_error("Invalid Tournament ID.
");
}
include("$dir[func]/checkdata.php");
$errormessage=check_validlength($errormessage, $name, "0", "250", "Your Question must not exceed 250 charecters");
$errormessage=check_validlength($errormessage, $details, "0", "5000", "Your answer must not exceed 5000 charecters");
error_check($errormessage);
$name=change_charecters($name);
$details=change_fromlinebreaks($details);
$details=change_charecters($details);
$details=change_tocharectercode($details);
$tday=date("Y-m-d H:i:s");
mysql_query("UPDATE tournament_tourneys SET
size='$size',
type='$type',
active='$active',
name='$name',
details='$details',
field1='$field1',
field2='$field2',
field3='$field3',
directors='$directors',
password='$password',
logo='$logo',
bgcolor='$bgcolor',
tdcolor='$tdcolor',
fontcolor='$fontcolor',
WHERE id='$tournyid'");
include("$dir[func]/admin_finishmessage.php");
display_message("The Tournament has been updated.
");
}
function delete_tourny($tournyid){
mysql_query("DELETE FROM tournament_tourneys WHERE id='$tournyid'");
}