Location: PHPKode > projects > Guild DKP System > dkpsystem1.4/includes/admin/sessionconfiguration.php
<?php
$Save = $_POST[Save];
if(isset($Save)) {
	$boss = $_POST[boss];
	$value = $_POST[value];
	$bossid = $_POST[bossid];
	$totalbosses = count($boss);
	
	for($x=0; $x<$totalbosses; $x++) {
		$bossName = $boss[$x];
		$bossValue = $value[$x];
		$id = $bossid[$x];
		$sql = $db->query("UPDATE dkp_sessionvalues SET boss=\"$bossName\", value=\"$bossValue\" WHERE id=\"$id\"");
		if(!$sql) {
			die(systemMessage("Database Error", mysql_error()));
		}
	}
	systemMessage("Sessions Updated", "Your settings have been saved.");
}
else {
?>
<table width="100%" border="0" cellspacing="1" cellpadding="3">
  <tr>
    <td bgcolor="#003366"><font color="#FFFFFF" size="2" face="Tahoma"><strong>Session Configuration</strong></font></td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="1" cellpadding="3">
  <tr> 
    <td colspan="2" bgcolor="#003366"><font color="#CCCCCC" size="1" face="Tahoma"><strong>Current 
      Sessions</strong></font></td>
  </tr>
  <tr> 
    <td width="15%" bgcolor="#999999"><u><strong><font color="#000000" size="1" face="Tahoma">Raid</font></strong></u></td>
    <td bgcolor="#999999"><u><strong><font color="#000000" size="1" face="Tahoma">Sessions</font></strong></u></td>
  </tr>
  <?php
$sql = $db->query("SELECT * FROM dkp_sessions ORDER BY raid ASC");
if($db->count_rows($sql) > 0 ) {
	while($row = mysql_fetch_array($sql)) {
		$raidname = $row[raid];
		$raidvalue = $row[sessions];
		
		$color1 = "#CCCCCC";
		$color2 = "#D7D7D7";
		$row_color = ($row_count % 2) ? $color1 : $color2;
		$row_count++;
?>
  <tr bgcolor="<?php echo $row_color; ?>"> 
    <td><strong><font color="#000000" size="1" face="Tahoma"><?php echo $raidname; ?></font></strong></td>
    <td><strong><font color="#000000" size="1" face="Tahoma"><?php echo $raidvalue; ?></font></strong></td>
  </tr>
  <?php
	}
}
else {
?>
  <tr bgcolor="#CCCCCC"> 
    <td colspan="2"><font color="#000000" size="1" face="Tahoma"><strong>There 
      are no instances recorded.</strong></font> </td>
    <?php
}
?>
  </tr>
  <tr bgcolor="#003366"> 
    <td colspan="2"><strong><a href="?d=admin&s=updatesessions"><font color="#CCCCCC" size="1" face="Tahoma">Update Sessions</font></a></strong></td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><form action="" method="post" name="formSessionValues" id="formSessionValues">
        <table width="100%" border="0" cellspacing="1" cellpadding="3">
          <tr> 
            <td colspan="2" bgcolor="#003366"><strong><font color="#CCCCCC" size="1" face="Tahoma">Session 
              Values</font></strong></td>
          </tr>
<?php
$sql = $db->query("SELECT * FROM dkp_sessions ORDER BY raid ASC");
if($db->count_rows($sql)) {
	while($row = mysql_fetch_array($sql)) {
		$raidid = $row[id];
		$raidname = $row[raid];
		$sessions = $row[sessions];
?>
          <tr bgcolor="#999999"> 
            <td colspan="2"><strong><font color="#000000" size="1" face="Tahoma"><u><?php echo $raidname; ?></u></font></strong></td>
          </tr>
<?php
		$sql2 = $db->query("SELECT * FROM dkp_sessionvalues WHERE raidid=\"$raidid\" LIMIT $sessions");
		while($row2 = mysql_fetch_array($sql2)) {
			$bossid = $row2[id];
			$boss = $row2[boss];
			$value = $row2[value];
			$color1 = "#CCCCCC";
			$color2 = "#D7D7D7";
			$row_color = ($row_count % 2) ? $color1 : $color2;
			$row_count++;
?>
          <tr bgcolor="<?php echo $row_color; ?>"> 
            <td width="15%"><input name="boss[]" type="text" id="boss[]" value="<?php echo $boss; ?>" size="35"></td>
            <td> <input name="value[]" type="text" id="value[]" value="<?php echo $value; ?>" size="4"> 
              <input name="bossid[]" type="hidden" id="id" value="<?php echo $bossid; ?>"> 
            </td>
          </tr>
        <?php
		}
	}
?>
          <tr bgcolor="#CCCCCC"> 
            <td colspan="2"><strong><font size="1" face="Tahoma"> 
              <input name="Save" type="submit" id="Save" value="Save">
              </font></strong><strong><font size="1" face="Tahoma"> </font></strong></td>
          </tr>
<?php
}
else {
?>
          <tr bgcolor="#CCCCCC">
            <td colspan="2"><font color="#000000" size="1" face="Tahoma"><strong>There are currently no instances recorded.</strong></font></td>
          </tr>
<?php
}
?>
        </table>
      </form>
	  </td>
  </tr>
</table>
<?php
}
?>
Return current item: Guild DKP System