Page 1 of 1
My Website? PhP
Posted: Thu May 10, 2012 7:19 pm
by Chromeozone
Hey Guys,
I havnt posted in a long time, I just generally read the forums and see whats going on
But today, I have had a problem!
http://www.darkseaadventures.com/Arcade ... /index.php
Doesnt seem to work?
Please can I have some help to resolve this issue?
Re: My Website? PhP
Posted: Thu May 10, 2012 7:50 pm
by Chromeozone
After editing some settings on firefox I was able to turn off some network settings, finding the error
Warning: Division by zero in /.../..../public_html/Arcade/Dragon-Knights/lib.php on line 227
Warning: Division by zero in /..../..../public_html/Arcade/Dragon-Knights/lib.php on line 229
Code: Select all
// HP/MP/TP bars.
$stathp = ceil($userrow["currenthp"] / $userrow["maxhp"] * 100);
if ($userrow["maxmp"] != 0) { $statmp = ceil($userrow["currentmp"] / $userrow["maxmp"] * 100); } else { $statmp = 0; }
$stattp = ceil($userrow["currenttp"] / $userrow["maxtp"] * 100);
$stattable = "<table width=\"100\"><tr><td width=\"33%\">\n";
$stattable .= "<table cellspacing=\"0\" cellpadding=\"0\"><tr><td style=\"padding:0px; width:15px; height:100px; border:solid 1px black; vertical-align:bottom;\">\n";
if ($stathp >= 66) { $stattable .= "<div style=\"padding:0px; height:".$stathp."px; border-top:solid 1px black; background-image:url(images/bars_green.gif);\"><img src=\"images/bars_green.gif\" alt=\"\" /></div>"; }
if ($stathp < 66 && $stathp >= 33) { $stattable .= "<div style=\"padding:0px; height:".$stathp."px; border-top:solid 1px black; background-image:url(images/bars_yellow.gif);\"><img src=\"images/bars_yellow.gif\" alt=\"\" /></div>"; }
if ($stathp < 33) { $stattable .= "<div style=\"padding:0px; height:".$stathp."px; border-top:solid 1px black; background-image:url(images/bars_red.gif);\"><img src=\"images/bars_red.gif\" alt=\"\" /></div>"; }
$stattable .= "</td></tr></table></td><td width=\"33%\">\n";
$stattable .= "<table cellspacing=\"0\" cellpadding=\"0\"><tr><td style=\"padding:0px; width:15px; height:100px; border:solid 1px black; vertical-align:bottom;\">\n";
if ($statmp >= 66) { $stattable .= "<div style=\"padding:0px; height:".$statmp."px; border-top:solid 1px black; background-image:url(images/bars_green.gif);\"><img src=\"images/bars_green.gif\" alt=\"\" /></div>"; }
if ($statmp < 66 && $statmp >= 33) { $stattable .= "<div style=\"padding:0px; height:".$statmp."px; border-top:solid 1px black; background-image:url(images/bars_yellow.gif);\"><img src=\"images/bars_yellow.gif\" alt=\"\" /></div>"; }
if ($statmp < 33) { $stattable .= "<div style=\"padding:0px; height:".$statmp."px; border-top:solid 1px black; background-image:url(images/bars_red.gif);\"><img src=\"images/bars_red.gif\" alt=\"\" /></div>"; }
$stattable .= "</td></tr></table></td><td width=\"33%\">\n";
$stattable .= "<table cellspacing=\"0\" cellpadding=\"0\"><tr><td style=\"padding:0px; width:15px; height:100px; border:solid 1px black; vertical-align:bottom;\">\n";
if ($stattp >= 66) { $stattable .= "<div style=\"padding:0px; height:".$stattp."px; border-top:solid 1px black; background-image:url(images/bars_green.gif);\"><img src=\"images/bars_green.gif\" alt=\"\" /></div>"; }
if ($stattp < 66 && $stattp >= 33) { $stattable .= "<div style=\"padding:0px; height:".$stattp."px; border-top:solid 1px black; background-image:url(images/bars_yellow.gif);\"><img src=\"images/bars_yellow.gif\" alt=\"\" /></div>"; }
if ($stattp < 33) { $stattable .= "<div style=\"padding:0px; height:".$stattp."px; border-top:solid 1px black; background-image:url(images/bars_red.gif);\"><img src=\"images/bars_red.gif\" alt=\"\" /></div>"; }
$stattable .= "</td></tr></table></td>\n";
$stattable .= "</tr><tr><td>HP</td><td>MP</td><td>TP</td></tr></table>\n";
$userrow["statbars"] = $stattable;
Here is lib.php and Line 227 = $stathp = ceil($userrow["currenthp"] / $userrow["maxhp"] * 100);
Here is lib.php and line 229 = $stattp = ceil($userrow["currenttp"] / $userrow["maxtp"] * 100);
Re: My Website? PhP
Posted: Thu May 10, 2012 8:50 pm
by hallsofvallhalla
still doesnt work for me.
Re: My Website? PhP
Posted: Thu May 10, 2012 9:04 pm
by Chromeozone
What do you mean?
Re: My Website? PhP
Posted: Fri May 11, 2012 6:42 am
by Chromeozone
Still can't work it out xD
Re: My Website? PhP
Posted: Fri May 11, 2012 7:04 am
by Foofighter
mhm u posted just a link and expect us to know what your problem is?
is there still a problem?
As far as i can tell your index is working.
regards
Re: My Website? PhP
Posted: Fri May 11, 2012 7:31 am
by Chris
That error was most likely happening because you're dividing by an undefined variable. Either $userrow["currenthp"] or $userrow["maxhp"] were not set, PHP then casts the null values to an integer because of the division operator, so you end up trying to divide by 0, which is impossible.
Re: My Website? PhP
Posted: Fri May 11, 2012 2:21 pm
by hallsofvallhalla
When I went to the link it said page not found. So I tried but could not even get to the page.

Sorry man.