Location: PHPKode > projects > Skrupel User Game Administration > wartend.php
<?php
define("INSTALL_DIR",dirname(__FILE__));
include (INSTALL_DIR."/include/conf.inc.php");
set_template($sugaurl,"",dirname(__FILE__),$serverurl);

include ($sugapath."/include/header.inc.php");
include ($sugapath."/include/usercheck.inc.php");

if ($_GET["fu"]==1){
   $n=1;
   $z="warte";
   $DB = new db_sql;
   $DB2 = new db_sql;
   $DB->query("SELECT * FROM skrupel_usedcommspiele");
   if ($DB->num_rows() < 1){
      $template->assign_block_vars('no_waiting_games',array());
   }
   else{
        while ($DB->next()){
                $spiel_id=$DB->value("id");
                $spiel_name=$DB->value("spiel_name");
                $siegbedingungen=$DB->value("siegbedingungen");
                if ($siegbedingungen==0){
                        $siegbedingungen="Just for Fun";
	        }
                if ($siegbedingungen==1){
    		        $siegbedingungen="Überleben";
    		        $zielinfo=$DB->value("Zielinfo_1");
    	        }
                if ($siegbedingungen==2){
		        $siegbedingungen="Todfeind";
		        $zielinfo=$DB->value("Zielinfo_2");
	        }
                if ($siegbedingungen==3){
   		        $siegbedingungen="Keine Angabe";
   	        }
                if ($siegbedingungen==4){
		        $siegbedingungen="Keine Angabe";
	        }
                if ($siegbedingungen==5){
		        $siegbedingungen="Vomissan muss gesichert werden.";
		        $zielinfo=$DB->value("Zielinfo_5");
	        }
                if ($siegbedingungen==6){
		        $siegbedingungen="Team Todfeind";
	        }

	        $user_[1]=$DB->value("user_1");
	        $user_[2]=$DB->value("user_2");
	        $user_[3]=$DB->value("user_3");
	        $user_[4]=$DB->value("user_4");
	        $user_[5]=$DB->value("user_5");
	        $user_[6]=$DB->value("user_6");
	        $user_[7]=$DB->value("user_7");
	        $user_[8]=$DB->value("user_8");
	        $user_[9]=$DB->value("user_9");
	        $user_[10]=$DB->value("user_10");

	        $rasse_[1]=$DB->value("rasse_1");
	        $rasse_[2]=$DB->value("rasse_2");
	        $rasse_[3]=$DB->value("rasse_3");
	        $rasse_[4]=$DB->value("rasse_4");
	        $rasse_[5]=$DB->value("rasse_5");
	        $rasse_[6]=$DB->value("rasse_6");
	        $rasse_[7]=$DB->value("rasse_7");
	        $rasse_[8]=$DB->value("rasse_8");
	        $rasse_[9]=$DB->value("rasse_9");
	        $rasse_[10]=$DB->value("rasse_10");

                $team[1]=$DB->value("team1");
                $team[2]=$DB->value("team2");
                $team[3]=$DB->value("team3");
                $team[4]=$DB->value("team4");
                $team[5]=$DB->value("team5");
                $team[6]=$DB->value("team6");
                $team[7]=$DB->value("team7");
                $team[8]=$DB->value("team8");
                $team[9]=$DB->value("team9");
                $team[10]=$DB->value("team10");
        
		$modul_0=$DB->value("modul_0");
		$modul_2=$DB->value("modul_2");
		if ($modul_0==1){
			$modul_0="Spionage und Sabotage";
		}
		if ($modul_2==1){
			$modul_2="Minenfelder";
		}

	        $spieler_admin=$DB->value("spieler_admin");
	        
   	        $DB2->query("SELECT * FROM skrupel_user WHERE id=".$spieler_admin);
   	        $DB2->next();
                $adminid = $spieler_admin;
                $adminnick = $DB2->value("nick");
                $adminmail = $DB2->value("email");
                $template->assign_block_vars('waiting_games',array('spiel_nr' => $n,
                                                          'spiel_name' => $spiel_name,
                                                          'admin' => $adminnick,
                                                          'siegbedingungen' => $siegbedingungen,
                                                          'modul_0' => $modul_0,
                                                          'modul_2' => $modul_2,
                                                          'spiel_id' => $spiel_id));
                //admin mail subtemplate
                if($adminmail == "--"){
                        $template->assign_block_vars('waiting_games.noadminmail',array());
                }
                else{
                        $template->assign_block_vars('waiting_games.adminmail',array('adminid' => $adminid));
                }
                //slots suptemplate
                for ($k=1;$k<11;$k++){
                        if (strtolower(substr($user_[$k],0,5))=="warte"){
		                $usernick="Wartet auf Mitspieler";
		                $usermail="--";
		        }
                        elseif (strtolower(substr($user_[$k],0,1))==0){
		                $usernick="Kein Spieler vorgesehen";
		                $usermail="--";
		        }
			else{
	                        $userdata = mysql_query("SELECT * FROM skrupel_user");
                                while ($row = mysql_fetch_object ($userdata)){
                                        if ($user_[$k]==$row->id){
                                                $userid=$row->id;
                                                $usernick=$row->nick;
                                                $usermail=$row->email;
                                        }
                               }
		        }
		        if (strtolower(substr($rasse_[$k],0,5))=="warte"){ 
		                $this_rass = "wählbar durch Spieler";
		        } 
		        else{ 
		                $this_rass = $rasse_[$k];
		        }
		        $template->assign_block_vars('waiting_games.player_slots',array('slot_nr' => $k,
		                                                                        'usernick' => $usernick,
		                                                                        'userrasse' => $this_rass,
		                                                                        'team' => $team[$k],
		                                                                        ));
		        if($usermail == "--"){
		                $template->assign_block_vars('waiting_games.player_slots.player_slots_nomail',array());
		        }
		        else{
		                $template->assign_block_vars('waiting_games.player_slots.player_slots_mail',array('userid'=>$userid));
		        }
		        
		        if (strtolower(substr($user_[$k],0,5))=="warte"){ 
		                $template->assign_block_vars('waiting_games.player_slots.player_slots_waiting', array(
		                                                'spiel_id' => $spiel_id,
		                                                'rasse' => $rasse_[$k],
		                                                'slot_nr' => $k,
		                                                ));
		        }
		        else{
		                $template->assign_block_vars('waiting_games.player_slots.player_slots_notwaiting',array());
		        }
		}
                $n++;
        }
   }
}
 
$template->pparse('xhtmlhead');
$template->pparse('waiting');
?>
Return current item: Skrupel User Game Administration