Quick issue lotus

fone321

New Member
Messages
6
Reaction score
0
Points
0
My problem is that i am getting issues like this on the game i am develping using 3rd party software however this time its not the software i believe. It seems to have happened without me really tampering with anything and it didnt happen before. Im not being hacked or anything cause i haven't even really officaly launched my site.


Warning: Division by zero in /home/fone321/public_html/game/lib.php on line 226

Warning: Division by zero in /home/fone321/public_html/game/lib.php on line 228

That is the message i get at http://moviestop.co.cc/game above my siteb4 i log in. Now again its got nuthing to do with the 3rd party stuff (i believe) i think its more to do with lotus being anoying recently but need clarification.

line 226

$stathp = ceil($userrow["currenthp"] / $userrow["maxhp"] * 100);

line 228

$stattp = ceil($userrow["currenttp"] / $userrow["maxtp"] * 100);

Im gona try to trackback any edits i amy have made to original code that could have done this but again. im sure its not the 3rd party code, and i am sure its the "/" causing the problem but want to hear more from smarter people at the forums... thanks

Edit:
Ummm.. besides bumping i think i traced everything i did and nothing except compression and decompression of that at other files.

could it have put the / there because of a flaw in the compression/decompression or something?

---

Here is the full chunk of code from 226 -228 can som1 come up with an edit to this that would make it shut up when it wants to divide by zero. by that i mean whatever the hell the zero is instead of dividing it will do nothing

$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);
 
Last edited:

Livewire

Abuse Compliance Officer
Staff member
Messages
18,169
Reaction score
216
Points
63
My problem is that i am getting issues like this on the game i am develping using 3rd party software however this time its not the software i believe. It seems to have happened without me really tampering with anything and it didnt happen before. Im not being hacked or anything cause i haven't even really officaly launched my site.


Warning: Division by zero in /home/fone321/public_html/game/lib.php on line 226

Warning: Division by zero in /home/fone321/public_html/game/lib.php on line 228

That is the message i get at http://moviestop.co.cc/game above my siteb4 i log in. Now again its got nuthing to do with the 3rd party stuff (i believe) i think its more to do with lotus being anoying recently but need clarification.

line 226

$stathp = ceil($userrow["currenthp"] / $userrow["maxhp"] * 100);

line 228

$stattp = ceil($userrow["currenttp"] / $userrow["maxtp"] * 100);

Im gona try to trackback any edits i amy have made to original code that could have done this but again. im sure its not the 3rd party code, and i am sure its the "/" causing the problem but want to hear more from smarter people at the forums... thanks

Edit:
Ummm.. besides bumping i think i traced everything i did and nothing except compression and decompression of that at other files.

could it have put the / there because of a flaw in the compression/decompression or something?

No, it's an error in your code. Lotus has nothing to do with it.

$stattp = ceil($userrow["currenttp"] / $userrow["maxtp"] * 100);
$stathp = ceil($userrow["currenthp"] / $userrow["maxhp"] * 100);

What happens when maxtp or maxhp are zero? Division by zero. They -shouldnt- be zero, but if they ever are, that would cause the two errors.

My guess is you're calling them even if the user isn't logged in, thus resulting in $userrow not actually being defined. That's okay for anything on the left of the /, but anything undefined on the right results in a 0, which results in division by zero.


As an FYI, Lotus having an issue would most likely result in a Network Timeout issue - the site would either partially load and stop, or not load at all.
 

fone321

New Member
Messages
6
Reaction score
0
Points
0
I realised it to, not sure exatly how to deal with it

Can you provide a solution?

This is all i know about how the script verifies weather someone is logged in

// Login (or verify) if not logged in.
$userrow = checkcookies();
if ($userrow == false) {
if (isset($_GET["do"])) {
if ($_GET["do"] == "verify") { header("Location: users.php?do=verify"); die(); }
}
header("Location: login.php?do=login"); die();

Can you come up with anything that i could use to replace line 226-228?

Thanks
Edit:
crap all i did was cut out the code and try refresging and now im getting this, i pasted it back and it wont go away

2
Warning: Cannot modify header information - headers already sent by (output started at /home/fone321/public_html/game/lib.php:325) in /home/fone321/public_html/game/index.php on line 16

the code i cut was line 226-228

Ignore that last part it is fixed i accidently added that 2 at the end of the file lets continue with the main issue
 
Last edited:

Livewire

Abuse Compliance Officer
Staff member
Messages
18,169
Reaction score
216
Points
63
Unfortunately I'm not familiar with how your code is running, but one really brutal way to do it is this:

<?php
error_reporting(0);
?>

It'll still be erroring behind the scenes, but it won't display the error message to the user at all. Ideally it shouldn't error behind the scenes, but like I said, it's just a brutal way to get past it showing the error :)
 

fone321

New Member
Messages
6
Reaction score
0
Points
0
I guess that will have to suffice for now, Im guessing i paste that anywhere in the file?

When you use the word brutal it dosent mean it will invlove increased resource usage right?
 

Livewire

Abuse Compliance Officer
Staff member
Messages
18,169
Reaction score
216
Points
63
I'd put it at the top of the code.

And no, it won't be a resource hog - by brutal I mean it's a quick and dirty way to hide the problem, at least until a time as it can get fixed :)
 
Top