Made a script a while back, to show the average lifespan of your server, on your webpage.

dumle29

New Member
So a while ago I made a script that would show the average lifespan of people on your server, I posted it to Reddit. Someone in there suggested that i should post it here, but i let that up to him. Now i have changed the script, as i discovered that i got the information from the wrong table.

This is now fixed, and the script will correctly show you the average lifespan.

So if you are interested:

Here's the script (allways the newest version)

Here's the reddit post (for questions, as I am rather frequent on there :p)

(Reddit proof: ahdU3iK3jd)
 
is to place an index to put your name, email and the GUID for the whitelist? where can I find it? PLiss!

What the.......... Can you translate that please.. not understandable language.

Nice script but you can probably shorter the whole code alot ;)
 
I can't see how you would make it any shorter. The thing that takes up the bulk of this are the if loops.

It determines whether to write "hour", "hours", "and 1 minute", "and x minutes", and so fourth.

If you see a way, feel free to shorten it :)
 
Another way to do this:
Code:
mysql> SELECT CONCAT(FLOOR(AVG(`survival_time`)/60), 'h ', MOD(ROUND(AVG(`survival_time`)),60),'m') AS 'Average Survival Time' FROM `survivor` WHERE `survival_time` > 50 AND `is_dead` = 0;
+-----------------------+
| Average Survival Time |
+-----------------------+
| 4h 44m                |
+-----------------------+
1 row in set (0.00 sec)
 
From the looks of it, Pwn's build wont be able to do this. From looking at it, I dont see anything to do an average on. Also I will rewrite your script to be PHP 5.5 compliant :), basically being rewritten in PDO and OO
 
My forum has a portal page on which I can place blocks of custom html: http://killinzedz.net

How could I make it so this information is displayed in an html block on my portal? Do I save the php file someplace and call it with html? Any insight is appreciated!
 
From the looks of it, Pwn's build wont be able to do this. From looking at it, I dont see anything to do an average on. Also I will rewrite your script to be PHP 5.5 compliant :), basically being rewritten in PDO and OO
Oh well :/ maybe you can change to bliss? anyhow I'm kinda out of the loop since I kinda left DayZ (and stopped my server)
Sounds cool with the PDO tho :)

My forum has a portal page on which I can place blocks of custom html: http://killinzedz.net

How could I make it so this information is displayed in an html block on my portal? Do I save the php file someplace and call it with html? Any insight is appreciated!

That website just tries to download me a file called download (1) (no file extension) thats rather fishy...

Other than that, I don't think you would be able to use that. This isn't HTML, it's PHP and it is run on the server before anything gets send to the user. You could host the script on your own website, and then iframe it.

Code:
<iframe src="http://yourSite.org/avgLife.php> </iframe>
 
That website just tries to download me a file called download (1) (no file extension) thats rather fishy...

Other than that, I don't think you would be able to use that. This isn't HTML, it's PHP and it is run on the server before anything gets send to the user. You could host the script on your own website, and then iframe it.

Code:
<iframe src="http://yourSite.org/avgLife.php> </iframe>

That's something on your end because my website works fine. It doesn't try to download anything to me:

43324796.jpg


I believe the problem with not being able to have php in the block is a limit to the phpBB3 portal. I've asked about it on their forums.
 
What browser are you using?
I'm using chrome, and I'm just getting a file called download (no file extension)

If I open that, theres a simple meta redirect to /phpBB3/portal.php

HTML:
<meta HTTP-EQUIV="REFRESH" content="0; url=http://killinzedz.net/phpBB3/portal.php">

I would think just changeing the contents of the document to
HTML:
<html>
<head>
<meta HTTP-EQUIV="REFRESH" content="0; url=http://killinzedz.net/phpBB3/portal.php">
</head>
<body>
</body>
</html>
 
What browser are you using?
I'm using chrome, and I'm just getting a file called download (no file extension)

If I open that, theres a simple meta redirect to /phpBB3/portal.php

HTML:
<meta HTTP-EQUIV="REFRESH" content="0; url=http://killinzedz.net/phpBB3/portal.php">

I would think just changeing the contents of the document to
HTML:
<html>
<head>
<meta HTTP-EQUIV="REFRESH" content="0; url=http://killinzedz.net/phpBB3/portal.php">
</head>
<body>
</body>
</html>

I'm also using Chrome. For some reason it looks like you're downloading the index file that redirects you to the forum portal.

*edit* I put that code into the index.html. Let me know if you are still having the problem. Probably doesn't matter because I don't think you have an interest in my website but I haven't had anyone else tell me they've had this problem. :)

*edit 2* Strange, now I'm getting the download thing since I put your code in...

*edit 3* Changed it to index.htm and it's working for me again...
 
I'm also using Chrome. For some reason it looks like you're downloading the index file that redirects you to the forum portal.

*edit* I put that code into the index.html. Let me know if you are still having the problem. Probably doesn't matter because I don't think you have an interest in my website but I haven't had anyone else tell me they've had this problem. :)

*edit 2* Strange, now I'm getting the download thing since I put your code in...

*edit 3* Changed it to index.htm and it's working for me again...

It works great now :)

EDIT: Oh and yeah, to allow people to put custom php on a page would be insane. You can really mess up a server with that (delete files, mess around in databases, reconfige stuff and madness)
 
Back
Top