Location: PHPKode > projects > Guild DKP System > dkpsystem1.4/includes/admin/factorpoints.php
<?php
$Factor = $_POST[Factor];
if(isset($Factor)) {
	$txtFactor = $_POST[txtFactor];
	$sql = $db->query("SELECT id, class_points, class_points_general FROM dkp_users");
	while($row = mysql_fetch_array($sql)) {
		$userid = $row[id];
		$class_points = $row[class_points];
		$class_points_general = $row[class_points_general];
		$new_class_points = round($class_points * $txtFactor);
		$new_class_points_general = round($class_points_general * $txtFactor);	
		$db->query("UPDATE dkp_users SET class_points=\"$new_class_points\", class_points_general=\"$new_class_points_general\" WHERE id=\"$userid\"");
		$db->query("INSERT INTO dkp_realadjustments (userid, reason, value) VALUES (\"$userid\", \"Points were factored by $txtFactor.\", \"--\")");
	}
	systemMessage("Factor Points", "You have successfully factored all points by $txtFactor.");
}
else {
?>
<table width="100%" border="0" cellspacing="1" cellpadding="3">
  <tr>
    <td bgcolor="#003366"><font color="#FFFFFF" size="2" face="Tahoma"><strong>Factor 
      Points</strong></font></td>
  </tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><form action="" method="post" name="formFactor" id="formFactor">
        <table width="100%" border="0" cellspacing="1" cellpadding="3">
          <tr> 
            <td colspan="2" bgcolor="#003366"><font color="#FFFFFF" size="1" face="Tahoma"><strong>Details</strong></font></td>
          </tr>
<?php
if($db->count_rows($db->query("SELECT id FROM dkp_users")) > 0) {
?>		  
          <tr> 
            <td width="15%" bgcolor="#999999"><strong><font size="1" face="Tahoma"><u>Amount</u></font></strong></td>
            <td bgcolor="#CCCCCC"><strong><font size="1" face="Tahoma"> 
              <input name="txtFactor" type="text" id="txtFactor" value="0.65" size="35">
              </font></strong></td>
          </tr>
          <tr> 
            <td bgcolor="#999999"><strong></strong></td>
            <td bgcolor="#CCCCCC"><strong><font size="1" face="Tahoma"> 
              <input name="Factor" type="submit" id="Factor" value="Factor">
              </font></strong></td>
          </tr>
<?php
}
else {
?>		  
          <tr> 
            <td colspan="2" bgcolor="#CCCCCC"><font color="#000000" size="1" face="Tahoma"><strong>There are currently no players recorded to factor.</strong></font></td>
          </tr>
<?php
}
?>
        </table>
      </form></td>
  </tr>
</table>
<?php
}
?>
Return current item: Guild DKP System