Jump to content
MakeWebGames

Header Error message


jds137
 Share

Recommended Posts

Can anyone help with this?

Warning: Division by zero in /home/jds137/public_html/header.php on line 205

This is the Line:

$minexp=(int) ($ir['mine_exp']/$ir['mine_needed']*100);

Mysql is:

the querys

ALTER TABLE `users` ADD `mine_level` int(11) NOT NULL ;

ALTER TABLE `users` ADD `mine_exp` int(11) NOT NULL ;

ALTER TABLE `users` ADD `mine_needed` int(11) NOT NULL ;

ALTER TABLE `users` ADD `power` int(11) NOT NULL ;

ALTER TABLE `users` ADD `max_power` int(11) NOT NULL ;

I am including my header information:

<?php
class headers {
function startheaders() {
global $ir, $set;
echo <<<EOF
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>{$set['game_name']}</title>
<style type="text/css">

<!--
body {
background-color: #000000;
margin-top: 0px;
margin-bottom: 0px;
font-family:verdana;font-size:11px;color: white;
  scrollbar-base-color: #005B70; 
  scrollbar-arrow-color: #F3960B;
  scrollbar-DarkShadow-Color: #000000;
}
a:visited,a:active,a:hover,a:link { color: white;text-decoration: none; }
table,tr,td { font-family:verdana, sans-serif;font-size: 11px; }
img { border:none; }
textarea { font-family:verdana;font-size:11px;color: black; }
.table2 {
}
.lgrad {
background-image:url(lgrad.);
background-repeat:repeat-y;
width:0px;
}
.linegrad {
background-image:url(linegrad.PNG);
background-repeat:repeat-y;
background-align: center;
width:0px;
}
.rgrad {
background-image:url(rgrad.);
background-repeat:repeat-y;
width:0px;
}
.dgrad {
background-image:url(dgrad.);
background-repeat:repeat-x;
height:1px;
}
.dgradl {
background-image:url(dgradl.);
background-repeat:no-repeat;
height:0px;
width:0px;
}
.dgradr {
background-image:url(dgradr.);
background-repeat:no-repeat;
height:0px;
width:0px;
}
.center {
width:0px;
background-color:#000000;
vertical-align:top;
text-align:center;
}
.table {
background-color:#FFFFFF;
}
.table3 {
background-color:#000000;
}
.table td {
background-color:#000000;
height:0px;
}
.table3 td {
background-color:#000000;
}
td .alt {
background-color:#EEEEEE;
height:0px;
}
td .h {
background-image:url(tablehgrad.png);
background-repeat:repeat-x;
font-weight: bold;
background-color: #D6D6D6;
}
.table th {
background-image:url(tablehgrad.png);
background-repeat:repeat-x;
font-weight: bold;
background-color: #D6D6D6;
}
body, td, tr{
   color: #D8D8D8;
font-family: Tahoma,Verdana,Geneva,Arial,Helvetica,"Sans Serif";
font-size: 8pt;
font-weight: normal;
line-height: 16px;
margin: 0px;
padding: 0px;
}

a:link, a:active, a:visited
{
color: #ffffff;
font-weight: none;
   text-decoration: none;
}


a:hover
{
color: #ff0000;
font-weight: none;
   text-decoration: none;
}

/* scrollbars */
html
{
scrollbar-base-color: #000000;
scrollbar-arrow-color: #FFFFFF;
}



/* form elements */
select, input, textarea, check
{
font: 11px verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif;
background-color: #000;
border: ridge;
border-width: 1px;
border-color: #333;
color: #CCC;
}
select:hover, input:hover, textarea:hover
{
font: 11px verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif;
background-color: #000;
border: ridge;
border-width: 1px;
border-color: #CCC;
color: #FF;
}
select:focus, input:focus, textarea:focus
{
font: 11px verdana, geneva, lucida, 'lucida grande', arial, helvetica, sans-serif;
background-color: #000;
border: ridge;
border-width: 1px;
border-color: #FFF;
color: #FFF;
}

  .menu:link, .menu:visited
  {
color: #FFFFFF;
   font-size: 8pt;
   font-weight: bold;
   text-decoration: none;
  }
  .menu:hover, menu:active
  {
color: #ffcc00;
   font-weight: bold;
   text-decoration: none;
  }

-->
</style></head>

EOF;
}
function userdata($ir,$lv,$fm,$cm,$dosessh=1)
{
global $db,$c,$userid, $set;
$IP = ($_SERVER['HTTP_X_FORWARDED_FOR'])
? $_SERVER['HTTP_X_FORWARDED_FOR']
: $_SERVER['REMOTE_ADDR'];
$db->query("UPDATE users SET laston=unix_timestamp(),lastip='$IP' WHERE userid=$userid");
if(!$ir['email'])
{
include_once("./blip.php");
if (blip_is_blocked())
die("<tt>Your IP address has been blocked. If you feel this is in error, please mail [email][email protected][/email]</tt>");
global $domain;
die ("<body>Your account may be broken. Please mail [email protected]{$domain} stating your username and player ID.");
}
if($dosessh && ($_SESSION['attacking'] || $ir['attacking']))
{
print "You Run Home And Lock Your Doors";
$db->query("UPDATE users SET exp=0,attacking=0 WHERE userid=$userid");
$_SESSION['attacking']=0;
}
$enperc=(int) ($ir['energy']/$ir['maxenergy']*100);
$wiperc=(int) ($ir['will']/$ir['maxwill']*100);
$experc=(int) ( $ir['exp']/$ir['exp_needed']*100);
$brperc=(int) ($ir['brave']/$ir['maxbrave']*100);
$hpperc=(int) ($ir['hp']/$ir['maxhp']*100);
$minexp=(int) ($ir['mine_exp']/$ir['mine_needed']*100);
$enopp=100-$enperc;
$wiopp=100-$wiperc;
$exopp=100-$experc;
$bropp=100-$brperc;
$hpopp=100-$hpperc;
$minex=100-$minexp;
$d="";
if($_GET['ID'] != abs(@intval($_GET['ID'])))
{
  die("click... click... KABOOM!");
}
$_GET['viewforum'] = abs(@intval($_GET['viewforum']));
$_GET['viewtopic'] = abs(@intval($_GET['viewtopic']));
$u=$ir['username'];
if($ir['donatordays']) 
{
$u = "<font color=red>{$ir['username']}</font>";$d="[img=donator.gif]"; 
}
else if($ir['user_level'] > 1) 
{
$u = "<font color=brown>{$ir['username']}</font>";$d="[img=staff.gif]"; 
}

$gn="";
global $staffpage;

$bgcolor = '000000';
print "<table width='100%' bgcolor='#000000' bordercolor='#000000' border='0'>
<tr>
<th>
</td>
<th width='700px' align='center'>";
if($ir['jail'] > 0)
{
print "
<center>[img=title.jpg]</center>";
}
else if($ir['hospital'] > 0)
{
print "
<center>[img=title.jpg]</center>";
}
else
{
print "
<center>[img=title.jpg]</center>";
}
print"
</th><th>
</th>
</tr>
</table>

[b]Energy:[/b] {$enperc}%
<img src=bluebar.png width=$enperc height=10><img src=redbar.png width=$enopp height=10><td/>
[b]Will:[/b] {$wiperc}%
<img src=bluebar.png width=$wiperc height=10><img src=redbar.png width=$wiopp height=10><td/>
[b]Brave:[/b] {$ir['brave']}/{$ir['maxbrave']}
<img src=bluebar.png width=$brperc height=10><img src=redbar.png width=$bropp height=10> <td/>
[b]EXP:[/b] {$experc}%
<img src=bluebar.png width=$experc height=10><img src=redbar.png width=$exopp height=10><td/>
[b]Health:[/b] {$hpperc}%
<img src=bluebar.png width=$hpperc height=10><img src=redbar.png width=$hpopp height=10></center>

<center><table width='100%' border='0'>
[b]Mine Exp:[/b] {$minexp}%

[img=bar_left.gif][img=bluebar.png][img=barred.gif][img=bar_fil_end.gif]
</div>
      <tr>
      </td><td>[b]Name: [/b] $gn{$u} [{$ir['userid']}] $d </td><td>[b]Money: [/b] {$fm} [url='bank.php'][[i]Bank[/i]][/url] </td><td>[b]Honors:[/b] {$ir['honors']}</td><td>[b]Credit Card:[/b] \${$ir['creditcard']}</td><td>[b]Level:[/b]{$ir['level']} </td><td>[b]Crystals: [/b] {$ir['crystals']} [url='voting.php'][[i]Earn[/i]][/url][url='crystaltemple.php'][[i]Use[/i]][/url]
</center>[/b]</td></tr></table>

<table cellspacing='0' border='0' cellpadding='0' class='table' width='100%'>
<tr background='tablehgrad.png'>
<tr>
<td colspan='2' class='h' align='center'>[url='donator.php']<font color=lime>[b]Donate To Mobs Life Here[/b]</font>[/url]</td>
<td colspan='2' class='h' align='center'>[url='voting.php']<font color=lime>[b]Vote For Mobs Life Here[/b]</font>[/url]</td>





<table width='100%' border='0' cellpadding='0' cellspacing='0'>
<tr>
<td width='15%' bgcolor='#$bgcolor' valign='top'>";
if($ir['fedjail'])
{
$q=$db->query("SELECT * FROM fedjail WHERE fed_userid=$userid");
$r=$db->fetch_row($q);
die("[b]<font color=red size=+1>You have been put in the {$set['game_name']} Federal Jail for {$r['fed_days']} day(s).

Reason: {$r['fed_reason']}
To get your account back Email </font><font color=yellow>[email protected]</font>[/b]</body></html>");
}
if(file_exists('ipbans/'.$IP))
{
die("[b]<font color=red size=+1>Your IP has been banned from {$set['game_name']}, there is no way around this.</font>[/b]</body></html>");
}
}
function menuarea()
{
include "mainmenu.php";
global $ir,$c;
$bgcolor = '000000';
print '</td><td width="2" class="linegrad" bgcolor="#'.$bgcolor.'"> </td><td width="100%" bgcolor="#'.$bgcolor.'" valign="top">
';
if($ir['hospital'])
{
print "[b]NB:[/b] You are currently in hospital for {$ir['hospital']} minutes.
";
}
if($ir['jail'])
{
print "[b]NB:[/b] You are currently in jail for {$ir['jail']} minutes.
";
}
print "";
}
function smenuarea()
{
include "smenu.php";
global $ir,$c;
$bgcolor = '000000';
print '</td><td width="2" class="linegrad" bgcolor="#'.$bgcolor.'"> </td><td width="80%" bgcolor="#'.$bgcolor.'" valign="top"><center>';
}
function endpage()
{

global $db;
print <<<OUT
</center>
</td>
</tr>
</table></td>
<td class="rgrad"></td>
</tr>
<tr>
<td colspan="5">
<table cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td class="dgradl"> </td>
<td class="dgrad"> </td>
<td class="dgradr"> </td>
</tr>
</table>

</body>
</html>
OUT;
}
function checkIncomingData($idata, $minsize, $maxsize) 
{
if ( 
  strlen($idata)<$minsize
  or  
  strlen($idata)>$maxsize 
  ) 
{
return false;
}
  else
{
  return true;
  }
}
//make sure that nothing bad can be entered by the user (-->sql injection attack)
function cleanIncomingData($idata) 
{
$cleaned = trim($idata); 
$cleaned = mysql_real_escape_string($cleaned);
return $cleaned;
$db->escape();
$forbidden = array('"','<','>','&','(',')');

$replacement = array('"','<','>','&','*','*');
$item2 = str_replace($forbidden,$replacement,$item);
function is_whole_number($var)
{
return (is_numeric($var)&&(intval($var)==floatval($var)));
}
$array = array_merge($_GET, $_POST);
while ($post_cap = current($array))
{
if ($post_cap < 0)
{
die("[b]What do you think your doing? Inserting negative integers is not tolerated![/b]

");
}
if (is_numeric($post_cap) && !is_whole_number($post_cap))
{
die("[b]What do you think your doing? Inserting decimal integers is not tolerated.[/b]

");
}
if(strpos($post_cap, '=') && ($_POST[confirmPage] == ""))
{
die("[b]What do you think your doing? An Invalid entry has been made.[/b]
Please contact Spere [2] if this error persists.

");
}
next($array);
}
$array_gete = array($_GET);
while ($tick = current($array_gete))
{
  $thekey = key($array_gete); //GoldenZero.Net
  $_GET[$thekey] = str_replace("=", "", htmlspecialchars($_GET[$thekey]));
  next($array_gete);
}
$array_poste = array($_POST);
while ($tick = current($array_poste))
{
  $thekey = key($array_poste);
  $_POST[$thekey] = str_replace("=", "", htmlspecialchars($_POST[$thekey]));
  next($array_poste);
}
}
}
?>


Link to comment
Share on other sites

Guest Anonymous

Re: Header Error message

I think ...

ALTER TABLE `users` ADD `mine_needed` int(11) NOT NULL DEFAULT 1000;

would have been the correct statement.

ie. check your users table, you will probably find all the users mine_needed is zero.

Use phpMyAdmin (or your preferred tool) to set the default value to something suitable (1000 is IIRC the standard, although you could start lower if you wanted.)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...