Location: PHPKode > projects > Guild DKP System > dkpsystem1.4/includes/admin/startraid.php
<?php
$action = $_GET[action];
$sessionid = $_GET[sessionid];
if(isset($action) && $action == "delete") {
	$sql = $db->query("SELECT id FROM dkp_sessionhistory WHERE id=\"$sessionid\"");
	if($db->count_rows($sql) > 0) {
		$raidid = @mysql_result($db->query("SELECT raidid FROM dkp_sessionhistory WHERE id=\"$sessionid\""), 0);
		$db->query("DELETE FROM dkp_sessionhistory WHERE id=\"$sessionid\"");
		$db->query("DELETE FROM dkp_userhistory WHERE raidid=\"$raidid\"");
		$db->query("DELETE FROM dkp_tempadjustments WHERE raidid=\"$raidid\"");
		die(systemMessage("Raid Deleted", "You have successfully deleted the raid."));
	}
	else {
		die(systemMessage("Raid Error", "Can not delete the raid that you have selected."));
	}
}
?>
<script language="JavaScript">
function getBosses() {
	var index = formNewRaid.selectRaid.selectedIndex;
	var URL = formNewRaid.selectRaid.options[index].value;
	if(URL != 0) {
		location.href=URL;
	}
	return false;
}
function getIndex() {
	var index = formNewRaid.selectBoss.selectedIndex;
	formNewRaid.txtIndex.value = index - 1;
}
</script>
<table width="100%" border="0" cellspacing="1" cellpadding="3">
  <tr>
    <td bgcolor="#003366"><font color="#FFFFFF" size="2" face="Tahoma"><strong>Start Raid</strong></font></td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><form action="?d=admin&s=continueraid" method="post" name="formNewRaid" id="formNewRaid">
        <table width="100%" border="0" cellspacing="1" cellpadding="3">
          <tr> 
            <td colspan="3" bgcolor="#003366"><font color="#CCCCCC" size="1" face="Tahoma"><strong>Saved 
              Raids </strong></font></td>
          </tr>
          <tr> 
            <td width="15%" bgcolor="#999999"><u><strong><font color="#000000" size="1" face="Tahoma">Instances</font></strong></u></td>
            <td width="15%" bgcolor="#999999"><u><strong><font color="#000000" size="1" face="Tahoma">Status</font></strong></u></td>
            <td bgcolor="#999999"><u><strong><font color="#000000" size="1" face="Tahoma">Action</font></strong></u></td>
          </tr>
          <?php
$sql = $db->query("SELECT * FROM dkp_sessionhistory WHERE status=1");
if($db->count_rows($sql) > 0) {
	while($row = mysql_fetch_array($sql)) {
		$sessionid = $row[id];
		$instance = mysql_result(mysql_query("SELECT raid FROM dkp_sessions WHERE id=\"$row[raidid]\""), 0);
		$currentSession = $row[session];
		$maxSessions = mysql_result(mysql_query("SELECT sessions FROM dkp_sessions WHERE id=\"$row[raidid]\""), 0);
		$status = $currentSession . " / " . $maxSessions . " sessions";
?>
          <tr bgcolor="#CCCCCC"> 
            <td><strong><font color="#000000" size="1" face="Tahoma"><?php echo $instance; ?></font></strong></td>
            <td><strong><font color="#000000" size="1" face="Tahoma"><?php echo $status; ?></font></strong></td>
            <td><strong><font size="1" face="Tahoma"><a href="?d=admin&s=continueraid&sessionid=<?php echo $sessionid; ?>"><font color="#000000">resume</font></a> 
              <a href="?d=admin&s=startraid&action=delete&sessionid=<?php echo $sessionid; ?>" onClick="return verify('Are you sure you want to delete this session?')"><font color="#000000">delete</font></a></font></strong></td>
          </tr>
          <?php
	}
}
else {
?>
          <tr bgcolor="#CCCCCC"> 
            <td colspan="3"><font color="#000000" size="1" face="Tahoma"><strong>There 
              are no saved sessions.</strong></font></td>
          </tr>
          <?php
 }
 ?>
        </table>
        <table width="100%" border="0" cellpadding="3" cellspacing="1">
          <tr bgcolor="#003366"> 
            <td colspan="5"><font color="#CCCCCC" size="1" face="Tahoma"><strong>New 
              Raid Details</strong></font></td>
          </tr>
          <tr bgcolor="#CCCCCC"> 
            <td colspan="4" bgcolor="#999999"><u><strong><font size="1" face="Tahoma">Instance</font></strong></u></td>
            <td width="85%"><strong><font size="1" face="Tahoma"> 
              <select name="selectRaid" onChange="return getBosses()">
                <?php
				$sessionid = $_GET[sessionid];
				
				if(!isset($sessionid)) { echo "<option value='0'>Please select something to Raid</option>"; }
				else {
					$instance = @mysql_result($db->query("SELECT raid FROM dkp_sessions WHERE id=\"$sessionid\""), 0);
					echo "<option value=\"$sessionid\">$instance</option>";	
				}
				?>
                <option value="0">--</option>
                <?php
				$sql = $db->query("SELECT id, raid FROM dkp_sessions ORDER BY raid ASC");
				if($db->count_rows($sql) > 0) {
					while($row = mysql_fetch_array($sql)) {
						$id = $row[id];
						$raid = $row[raid];
						echo "<option value=\"?d=admin&s=startraid&sessionid=$id\">$raid</option>\n";
					}
				}
				else {
					echo "<option value=\"0\">There are no Sessions</option>\n";
				}
				?>
              </select>
              </font></strong></td>
          </tr>
          <?php
if(isset($sessionid)) {
?>
          <tr bgcolor="#CCCCCC"> 
            <td colspan="4" bgcolor="#999999"><u><strong><font size="1" face="Tahoma">Boss</font></strong></u></td>
            <td><strong><font size="1" face="Tahoma"> 
              <select name="selectBoss" id="select" onChange="getIndex();">
                <option value="0">Please select your starting point</option>
                <option value="0">--</option>
                <?php
				$sessions = @mysql_result($db->query("SELECT sessions FROM dkp_sessions WHERE id=\"$sessionid\""), 0);
				$sql = $db->query("SELECT * FROM dkp_sessionvalues WHERE raidid=\"$sessionid\" LIMIT $sessions");
				while($row = mysql_fetch_array($sql)) {
					$boss = $row[boss];
					$bossid = $row[id];
					echo "<option value=\"$bossid\">$boss</option>";
				}
				?>
              </select>
              </font></strong></td>
          </tr>
          <tr bgcolor="#CCCCCC">
            <td height="28" colspan="4" bgcolor="#999999"><font size="1" face="Tahoma"><u><strong>Index</strong></u></font></td>
            <td><input name="txtIndex" type="text" size="10" maxlength="10" readonly="true"></td>
          </tr>
<?php
}
?>
          <tr bgcolor="#CCCCCC"> 
            <td height="28" colspan="4" bgcolor="#999999"><u><strong><font size="1" face="Tahoma">On 
              time bonus</font></strong></u></td>
            <td><strong><font size="1" face="Tahoma"> 
              <input name="txtBonus" type="text" id="txtBonus" value="0" size="10" maxlength="10">
              </font></strong></td>
          </tr>
        </table>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr> 
            <td> <table width="100%" border="0" cellspacing="1" cellpadding="3">
                <tr> 
                  <td colspan="5" bgcolor="#003366"><font color="#CCCCCC" size="1" face="Tahoma"><strong>Participating 
                    Players </strong></font></td>
                </tr>
                <?php
$sql = $db->query("SELECT * FROM dkp_classes");
while($class_row = mysql_fetch_array($sql)) {
	$classid = $class_row[id];
	$class_name = $class_row['class'];
?>
                <tr bgcolor="#003366"> 
                  <td colspan="5"><font color="#CCCCCC" size="1" face="Tahoma"><strong><?php echo $class_name; ?></strong></font></td>
                </tr>
                <tr> 
                  <td bgcolor="#999999"> <div align="center"><font color="#000000" size="1" face="Tahoma"><strong><u>P</u></strong></font></div></td>
                  <td width="25%" bgcolor="#999999"><u><strong><font color="#000000" size="1" face="Tahoma">Character</font></strong></u></td>
                  <td width="25%" bgcolor="#999999"><u><strong><font color="#000000" size="1" face="Tahoma">Class 
                    Points</font></strong></u></td>
                  <td width="25%" bgcolor="#999999"><u><strong><font color="#000000" size="1" face="Tahoma">General 
                    Points</font></strong></u></td>
                  <td width="25%" bgcolor="#999999"><u><strong><font color="#000000" size="1" face="Tahoma">Last 
                    Raid</font></strong></u></td>
                </tr>
                <?php
	$sql2 = $db->query("SELECT * FROM dkp_users WHERE class=\"$classid\" ORDER BY class_points DESC, name ASC");
	if($db->count_rows($sql2) > 0) {
		while($row = mysql_fetch_array($sql2)) {
			$userid = $row[id];
			$character = $row[name];
			$class_points = $row[class_points];
			$general_points = $row[class_points_general];
			$last_active = $row[last_raid_date];
			
			$color1 = "#CCCCCC";
			$color2 = "#D7D7D7";
			$row_color = ($row_count % 2) ? $color1 : $color2;
			$row_count++;

?>
                <tr bgcolor="<?php echo $row_color; ?>"> 
                  <td><div align="center"> 
                      <input name="playing[]" type="checkbox" value="<?php echo $userid; ?>">
                    </div></td>
                  <td><strong><font color="#000000" size="1" face="Tahoma"><?php echo $character; ?></font></strong></td>
                  <td><strong><font color="#000000" size="1" face="Tahoma"><?php echo $class_points; ?></font></strong></td>
                  <td><strong><font color="#000000" size="1" face="Tahoma"><?php echo $general_points; ?></font></strong></td>
                  <td><strong><font color="#000000" size="1" face="Tahoma"><?php echo $last_active; ?></font></strong></td>
                </tr>
                <?php
		}
	}
	else {
?>
                <tr bgcolor="#CCCCCC"> 
                  <td colspan="5"><font color="#000000" size="1" face="Tahoma"><strong>There 
                    are no players in this category.</strong></font></td>
                </tr>
                <?php
	}
}
?>
                <tr bgcolor="#CCCCCC"> 
                  <td colspan="5"> <input name="StartRaid" type="submit" id="StartRaid" value="Start Raid" <?php if(!isset($sessionid)) { echo "disabled"; } ?>> 
                  </td>
                </tr>
              </table></td>
          </tr>
        </table>
      </form></td>
  </tr>
</table>
Return current item: Guild DKP System