Kann einer bitte so nett sein und mir das um schreiben so das ich da auch
Interne Aufstellung
Gegner Aufstellung
stehen hab
Hier code:
<?php
# Copyright by: Manuel
# Support: www.ilch.de
defined ('main') or die ( 'no direct access' );
defined ('admin') or die ( 'only admin access' );
# get Flag list
# 1 akt flag
$warstpl = new tpl ( 'admin/wars' );
$warstpl->out(0);
function get_wlp_array () {
$ar = array (
1 => 'gewonnen',
2 => 'verloren',
3 => 'unentschieden'
);
return ($ar);
}
function get_datime() {
$own = true;
$_POST['day'] = escape($_POST['day'],'integer');
$_POST['mon'] = escape($_POST['mon'],'integer');
$_POST['jahr'] = escape($_POST['jahr'],'integer');
$_POST['stu'] = escape($_POST['stu'],'integer');
$_POST['min'] = escape($_POST['min'],'integer');
$_POST['sek'] = escape($_POST['sek'],'integer');
if ( checkdate ($_POST['mon'], $_POST['day'] , $_POST['jahr']) == FALSE ) {
$own = false;
} elseif ( $_POST['stu'] > 24 OR $_POST['min'] > 60 OR $_POST['sek'] > 60 ) {
$own = false;
}
if ( $own ) {
return ( $_POST['jahr'].'-'.$_POST['mon'].'-'.$_POST['day'].' '.$_POST['stu'].':'.$_POST['min'].':'.$_POST['sek'] );
} else {
return ( date('Y-m-d H:i:s' ) );
}
}
switch ( $um ) {
# last wars
case 'last' :
$show = true;
$tpl = new tpl ( 'admin/wars_last' );
if ( !empty ( $_GET['delete'] ) ) {
db_query("DELETE FROM prefix_wars WHERE id = '".$_GET['delete']."'");
$wid = $_GET['delete'];
for($i=1;$i<=5;$i++) {
db_query("DELETE FROM prefix_warmaps WHERE wid = ".$wid." AND mnr = ".$i);
if ( file_exists('include/images/wars/'.$wid.'_'.$i.'.gif') ) { unlink ('include/images/wars/'.$wid.'_'.$i.'.gif'); }
if ( file_exists('include/images/wars/'.$wid.'_'.$i.'.png') ) { unlink ('include/images/wars/'.$wid.'_'.$i.'.png'); }
if ( file_exists('include/images/wars/'.$wid.'_'.$i.'.jpg') ) { unlink ('include/images/wars/'.$wid.'_'.$i.'.jpg'); }
if ( file_exists('include/images/wars/'.$wid.'_'.$i.'.jpeg') ) { unlink ('include/images/wars/'.$wid.'_'.$i.'.jpeg'); }
}
$msg = '<tr class="Cmite"><td colspan="2">Erfolgreich gelöscht</td></tr>';
}
if ( !empty($_POST['sub']) ) {
if ( !empty($_POST['newmod']) ) { $_POST['mod'] = $_POST['newmod']; }
if ( !empty($_POST['newgame']) ) { $_POST['game'] = $_POST['newgame']; }
if ( !empty($_POST['newmtyp']) ) { $_POST['mtyp'] = $_POST['newmtyp']; }
if ( empty ($_POST['pkey']) ) {
db_query("INSERT INTO prefix_wars (`datime`,`status`,wlp,`owp`,`opp`,gegner,page,tid,`mod`,game,mtyp,land,txt) VALUES ('".get_datime()."','".$_POST['status']."','".$_POST['wlp']."','".$_POST['sumowp']."','".$_POST['sumopp']."','".$_POST['gegner']."','".$_POST['page']."','".$_POST['tid']."','".$_POST['mod']."','".$_POST['game']."','".$_POST['mtyp']."','".$_POST['land']."','".$_POST['txt']."')");
$wid = db_last_id();
for($i=1;$i<=5;$i++) {
if ( $_POST['map'][$i] != '' AND $_POST['opp'][$i] != '' AND $_POST['owp'][$i] != '' ) {
$_POST['opp'][$i] = escape($_POST['opp'][$i],'integer');
$_POST['owp'][$i] = escape($_POST['owp'][$i],'integer');
$_POST['map'][$i] = escape($_POST['map'][$i],'string');
db_query("INSERT INTO prefix_warmaps (wid,mnr,map,opp,owp) VALUES (".$wid.",".$i.",'".$_POST['map'][$i]."',".$_POST['opp'][$i].",".$_POST['owp'][$i].")");
}
}
$msg = '<tr class="Cmite"><td colspan="2">Erfolgreich eingetragen</td></tr>';
} else {
db_query("UPDATE prefix_wars SET datime = '".get_datime()."', status = '".$_POST['status']."',wlp = '".$_POST['wlp']."',owp = '".$_POST['sumowp']."',opp = '".$_POST['sumopp']."',gegner = '".$_POST['gegner']."',page = '".$_POST['page']."',tid = '".$_POST['tid']."',`mod` = '".$_POST['mod']."',game = '".$_POST['game']."',mtyp = '".$_POST['mtyp']."',land = '".$_POST['land']."',txt = '".$_POST['txt']."' WHERE id = '".$_POST['pkey']."'");
$wid = $_POST['pkey'];
for($i=1;$i<=5;$i++) {
$a = db_count_query("SELECT COUNT(*) FROM prefix_warmaps WHERE mnr = ".$i." AND wid = ".$wid);
$_POST['opp'][$i] = escape($_POST['opp'][$i],'integer');
$_POST['owp'][$i] = escape($_POST['owp'][$i],'integer');
$_POST['map'][$i] = escape($_POST['map'][$i],'string');
if ( $a == 0 AND $_POST['map'][$i] != '' AND $_POST['opp'][$i] != '' AND $_POST['owp'][$i] != '' ) {
db_query("INSERT INTO prefix_warmaps (wid,mnr,map,opp,owp) VALUES (".$wid.",".$i.",'".$_POST['map'][$i]."',".$_POST['opp'][$i].",".$_POST['owp'][$i].")");
} elseif ( $a == 1 AND ( $_POST['map'][$i] == '' OR $_POST['opp'][$i] == '' AND $_POST['owp'][$i] == '') ) {
db_query("DELETE FROM prefix_warmaps WHERE wid = ".$wid." AND mnr = ".$i);
if ( file_exists('include/images/wars/'.$wid.'_'.$i.'.gif') ) { unlink ('include/images/wars/'.$wid.'_'.$i.'.gif'); }
if ( file_exists('include/images/wars/'.$wid.'_'.$i.'.png') ) { unlink ('include/images/wars/'.$wid.'_'.$i.'.png'); }
if ( file_exists('include/images/wars/'.$wid.'_'.$i.'.jpg') ) { unlink ('include/images/wars/'.$wid.'_'.$i.'.jpg'); }
if ( file_exists('include/images/wars/'.$wid.'_'.$i.'.jpeg') ) { unlink ('include/images/wars/'.$wid.'_'.$i.'.jpeg'); }
} elseif ( $a == 1 AND $_POST['map'][$i] != '' AND $_POST['opp'][$i] != '' AND $_POST['owp'][$i] != '' ) {
db_query("UPDATE prefix_warmaps SET map = '".$_POST['map'][$i]."', opp = ".$_POST['opp'][$i].", owp = ".$_POST['owp'][$i]." WHERE wid = ".$wid." AND mnr = ".$i);
}
}
$msg = '<tr class="Cmite"><td colspan="2">Erfolgreich verändert</td></tr>';
}
}
if ( !empty ($_GET['pkey']) ) {
$erg = db_query("SELECT DATE_FORMAT(datime,'%d.%m.%Y.%H.%i.%s') as datime, id,status,wlp,owp,opp,gegner,page,tid,`mod`,game,mtyp,land,txt FROM prefix_wars WHERE id = '".$_GET['pkey']."'");
$_ilch = db_fetch_assoc($erg);
$_ilch['pkey'] = $_GET['pkey'];
list($_ilch['day'],$_ilch['mon'],$_ilch['jahr'],$_ilch['stu'],$_ilch['min'],$_ilch['sek']) = explode('.',$_ilch['datime']);
$wid = $_GET['pkey'];
for($i=1;$i<=5;$i++) {
$erg = db_query("SELECT map,opp,owp FROM prefix_warmaps WHERE mnr = ".$i." AND wid = ".$wid);
if ( db_num_rows($erg) == 0 ) {
$_ilch['map'.$i] = '';
$_ilch['opp'.$i] = '';
$_ilch['owp'.$i] = '';
} else {
$mpr = db_fetch_assoc($erg);
$_ilch['map'.$i] = $mpr['map'];
$_ilch['opp'.$i] = $mpr['opp'];
$_ilch['owp'.$i] = $mpr['owp'];
}
}
} else {
$_ilch = array ('pkey' => '', 'wlp' => '', 'opp' => '', 'owp' => '', 'gegner' => '', 'page' => '', 'mtyp' => '', 'tid' => 0, 'land' => '', 'txt' => '', 'mod' => '', 'game' => '', 'day' => date('d'), 'mon' => date('m'), 'jahr' => date('Y'), 'stu' => date('H'), 'min' => date('i'), 'sek' => date('s') );
for($i=1;$i<=5;$i++) {
$_ilch['map'.$i] = '';
$_ilch['opp'.$i] = '';
$_ilch['owp'.$i] = '';
}
}
$_ilch['msg'] = ( isset ($msg) ? $msg : '' );
$_ilch['tid'] = dblistee ( $_ilch['tid'], "SELECT a.gid,b.name FROM prefix_teams a left join prefix_groups b on b.id = a.gid ORDER BY b.name");
$_ilch['mod'] = dblistee ( $_ilch['mod'], "SELECT DISTINCT `mod`,`mod` FROM prefix_wars ORDER BY `mod`" );
$_ilch['game'] = dblistee ( $_ilch['game'], "SELECT DISTINCT `game`,`game` FROM prefix_wars ORDER BY `game`" );
$_ilch['mtyp'] = dblistee ( $_ilch['mtyp'], "SELECT DISTINCT `mtyp`,`mtyp` FROM prefix_wars ORDER BY `mtyp`" );
$_ilch['land'] = arlistee ( $_ilch['land'] , get_nationality_array() );
$_ilch['wlp'] = arlistee ( $_ilch['wlp'] , get_wlp_array() );
$tpl->set_ar_out($_ilch,0);
if(empty($_GET['page'])) { $_GET['page'] = 1; }
$limit = 20; $class = '';
$MPL = db_make_sites ($_GET['page'] , '' , $limit , '?m=wars&um=last' , 'wars' );
$anfang = ($_GET['page'] - 1) * $limit;
$abf = "SELECT id,gegner FROM prefix_wars WHERE status = 2 ORDER BY id DESC LIMIT ".$anfang.",".$limit;
$erg = db_query($abf);
while ($row = db_fetch_assoc($erg) ) {
$class = ($class == 'Cmite' ? 'Cnorm' : 'Cmite' );
$row['class'] = $class;
$tpl->set_ar ( $row );
$tpl->out(1);
}
$tpl->set ( 'MPL', $MPL );
$tpl->out(2);
break;
# Next wars
case 'next' :
$show = true;
$tpl = new tpl ( 'admin/wars_next' );
if ( !empty ( $_GET['delete'] ) ) {
db_query("DELETE FROM prefix_wars WHERE id = '".$_GET['delete']."'");
$msg = '<tr class="Cmite"><td colspan="2">Erfolgreich gelöscht</td></tr>';
}
if ( !empty($_POST['sub']) ) {
if ( !empty($_POST['newmod']) ) { $_POST['mod'] = $_POST['newmod']; }
if ( !empty($_POST['newgame']) ) { $_POST['game'] = $_POST['newgame']; }
if ( !empty($_POST['newmtyp']) ) { $_POST['mtyp'] = $_POST['newmtyp']; }
if ( empty ($_POST['pkey']) ) {
db_query("INSERT INTO prefix_wars (datime,`status`,gegner,page,tid,`mod`,game,mtyp,land,txt) VALUES ('".get_datime()."','".$_POST['status']."','".$_POST['gegner']."','".$_POST['page']."','".$_POST['tid']."','".$_POST['mod']."','".$_POST['game']."','".$_POST['mtyp']."','".$_POST['land']."','".$_POST['txt']."')");
$msg = '<tr class="Cmite"><td colspan="2">Erfolgreich eingetrage</td></tr>';
} else {
db_query("UPDATE prefix_wars SET datime = '".get_datime()."', status = '".$_POST['status']."',gegner = '".$_POST['gegner']."',page = '".$_POST['page']."',tid = '".$_POST['tid']."',`mod` = '".$_POST['mod']."',game = '".$_POST['game']."',mtyp = '".$_POST['mtyp']."',land = '".$_POST['land']."',txt = '".$_POST['txt']."' WHERE id = '".$_POST['pkey']."'");
$msg = '<tr class="Cmite"><td colspan="2">Erfolgreich verändert</td></tr>';
}
}
if ( !empty ($_GET['pkey']) ) {
$erg = db_query("SELECT DATE_FORMAT(datime,'%d.%m.%Y.%H.%i.%s') as datime, id,status,gegner,page,tid,`mod`,game,mtyp,land,txt FROM prefix_wars WHERE id = '".$_GET['pkey']."'");
$_ilch = db_fetch_assoc($erg);
list($_ilch['day'],$_ilch['mon'],$_ilch['jahr'],$_ilch['stu'],$_ilch['min'],$_ilch['sek']) = explode('.',$_ilch['datime']);
$_ilch['pkey'] = $_GET['pkey'];
} else {
$_ilch = array ('pkey' => '', 'wlp' => '', 'erg1' => '', 'erg2' => '', 'gegner' => '', 'page' => '', 'mtyp' => '', 'tid' => 0, 'land' => '', 'txt' => '', 'mod' => '', 'game' => '', 'day' => date('d'), 'mon' => date('m'), 'jahr' => date('Y'), 'stu' => date('H'), 'min' => date('i'), 'sek' => date('s') );
}
$_ilch['msg'] = ( isset ($msg) ? $msg : '' );
$_ilch['tid'] = dblistee ( $_ilch['tid'], "SELECT a.gid,b.name FROM prefix_teams a left join prefix_groups b on b.id = a.gid ORDER BY b.name");
$_ilch['mod'] = dblistee ( $_ilch['mod'], "SELECT DISTINCT `mod`,`mod` FROM prefix_wars ORDER BY `mod`" );
$_ilch['game'] = dblistee ( $_ilch['game'], "SELECT DISTINCT `game`,`game` FROM prefix_wars ORDER BY `game`" );
$_ilch['mtyp'] = dblistee ( $_ilch['mtyp'], "SELECT DISTINCT `mtyp`,`mtyp` FROM prefix_wars ORDER BY `mtyp`" );
$_ilch['land'] = arlistee ( $_ilch['land'] , get_nationality_array() );
$tpl->set_ar_out($_ilch,0);
if(empty($_GET['page'])) { $_GET['page'] = 1; }
$limit = 20; $class = '';
$MPL = db_make_sites ($_GET['page'] , '' , $limit , '?m=wars&um=next' , 'wars' );
$anfang = ($_GET['page'] - 1) * $limit;
$abf = "SELECT id,gegner FROM prefix_wars WHERE status = 1 ORDER BY id DESC LIMIT ".$anfang.",".$limit;
$erg = db_query($abf);
while ($row = db_fetch_assoc($erg) ) {
$class = ($class == 'Cmite' ? 'Cnorm' : 'Cmite' );
$row['class'] = $class;
$tpl->set_ar ( $row );
$tpl->out(1);
}
$tpl->set ( 'MPL', $MPL );
$tpl->out(2);
break;
# Images Upload
case 'upload' :
if ( !is_writeable ( 'include/images/wars' ) ) {
die ('Bitte erst dem Ordner "include/images/wars" Schreibrechte (chmod 777) geben.');
}
if ( empty($_POST['sub']) ) {
$tpl = new tpl ( 'admin/wars_upload' );
$_ilch = array ('wars' => dblistee ('', "SELECT id,gegner FROM prefix_wars ORDER BY id DESC") );
$tpl->set_ar_out($_ilch,0);
} elseif ( empty($_FILES['file']) ) {
$tpl = new tpl ( 'admin/wars_upload' );
$tpl->set_ar_out(array('wid' => $_POST['wid']),1);
$erg = db_query("SELECT * FROM prefix_warmaps WHERE wid = ".$_POST['wid']);
if ( db_num_rows($erg) == 0 ) {
echo '<tr class="Cmite"><td colspan="2">Keine Map vorhanden also auch keine Screenshots</td></tr>';
} else {
while ($row = db_fetch_assoc($erg) ) {
$tpl->set_ar_out($row,2);
}
}
$tpl->out(3);
} else {
foreach ($_FILES['file']['name'] as $k => $v) {
$tmp = explode('.',$v);
if ( $tmp[1] == 'gif' OR $tmp[1] == 'png' OR $tmp[1] == 'jpg' OR $tmp[1] == 'jpeg') {
$nname = $_POST['wid'].'_'.$k.'.'.$tmp[1];
if ( move_uploaded_file ( $_FILES['file']['tmp_name'][$k] , 'include/images/wars/'.$nname) ) {
echo 'Datei '.$k.' ( '.$v.' ) <font color="#00FF00">erfolgreich hochgeladen</font><br />';
} else {
echo 'Datei '.$k.' ( '.$v.' ) <font color="#FF0000">nicht erfolgreich hochgeladen</font><br />';
}
} else {
echo 'Datei '.$k.' ('.$v.') <font color="#FF0000">nicht erfolgreich hochgeladen weil die endung nur (gif, png, jpg oder jpeg sein darf)</font><br />';
}
}
}
break;
}
?>
Lebe dein Leben denn das Leben ist kurz