Novahq.net Forum

Novahq.net Forum (https://novahq.net/forum/index.php)
-   Web design and Programming (https://novahq.net/forum/forumdisplay.php?f=32)
-   -   BHD Heartbeat (https://novahq.net/forum/showthread.php?t=49403)

~BLÃÐE~ 12-11-2018 01:42 PM

BHD Heartbeat
 
Hi Scott, would it be possible to add a map image to the coding showing which map is playing?

Scott 12-12-2018 08:11 AM

It should be possible if you have the map images for sure. Your code would look something like this:
Code:

if(file_exists("/pathto/mapimages/".$Server['MissionFile'].".jpg")) {
        echo "<img src=\"/pathto/mapimages/".$Server['MissionFile'].".jpg\" />";
} else {
        echo "<img src=\"/pathto/mapimages/nophoto.jpg\" />";
}

$Server['MissionFile'] should be something like mapname.bms so just name your jpg files mapname.bms.jpg

~BLÃÐE~ 12-24-2018 03:36 AM

Not sure if i got this right, code added to the status.php.
Added a new folder into the BHD directory with an image called nophoto.jpg

Code:

if(file_exists("/Program files(X86)/Novalogic/Delta Force Black Hawk Down/mapimages/".$Server['MissionFile'].".jpg")) {
        echo "<img src=\"/Program files(X86)/Novalogic/Delta Force Black Hawk Down/mapimages/".$Server['MissionFile'].".jpg\" />";
} else {
        echo "<img src=\"/Program files(X86)/Novalogic/Delta Force Black Hawk Down/mapimages/nophoto.jpg\" />";

} else {

Thanks

Scott 12-26-2018 03:23 PM

Well you'd upload the files to your ftp and put the paths there. Something like (using tio coop status page for example):
Code:

if(file_exists("./mapimages/".$Server['MissionFile'].".jpg")) {
        echo "<img src=\"./mapimages/".$Server['MissionFile'].".jpg" />";
} else {
        echo "<img src=\"./mapimages/nophoto.jpg\" />";
}

If you'd like help I can but I'd need the file and/or ftp to upload it.

~BLÃÐE~ 12-27-2018 12:41 AM

LOL i tried that at first, made the map folder url /PHPScripts/mapimages/nophoto.jpg

But i figured it would call from the BHD folder, hence why i used that path.

OK, now im using the correct domain it works better too
I used the Outpost not TIO site to upload files (TIO is a sub domain)

Got the No Image to show, now just got to get the map images to show now.
http://www.tiocoop.com/Content/pid=10.html

Scott 12-27-2018 11:24 AM

If you're on Linux, the file name needs to have the same case as the map name. Like MapName.bms is not the same as mapname.bms on Linux. If you make sure all the photos are lower case you can use this:

Code:

if(file_exists("./mapimages/".strtolower($Server['MissionFile']).".jpg")) {
        echo "<img src=\"./mapimages/".strtolower($Server['MissionFile']).".jpg" />";
} else {
        echo "<img src=\"./mapimages/nophoto.jpg\" />";
}


~BLÃÐE~ 12-27-2018 02:38 PM

still no luck with map images.
i did notice though, line 2 of code:
.".jpg" doesn't have the \ and breaks the coding if not added. But you had it in first post coding.

PS Thanks for your help Scott, think i've had too much xmass cheer brain is still on holiday mod lol,

Scott 12-31-2018 08:49 AM

Sorry just got back from Christmas break... You're right, it should be:

Code:

if(file_exists("./mapimages/".strtolower($Server['MissionFile']).".jpg")) {
        echo "<img src=\"./mapimages/".strtolower($Server['MissionFile']).".jpg\" />";
} else {
        echo "<img src=\"./mapimages/nophoto.jpg\" />";
}

The map photos should be in the directory called mapimages and should be named like mapname.bms.jpg (Make sure the .bms or whatever is part of the file name)

If you need some more help I can ftp in and help you out.

~BLÃÐE~ 01-02-2019 01:25 PM

Thank You very much Scott, everything is working spot on now.

To make it easy for others to upload map images i figured i would try your phUploader.php
I changes the path from Uploads to mapimages, it works and uploads fine.

Problems i have now is the error below and also the image uploaded changes it's name to 1432644.jpg Is the a way to keep it's original name when uploading?

Code:

Warning: main(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/novaoutp/public_html/tiocoop.com/phUploader.php on line 198

Notice: Undefined index: submit in /home/novaoutp/public_html/tiocoop.com/phUploader.php on line 198

Line 198 is
Code:

If(($_POST['submit']==true) AND ($password_form=="")) {
Thanks again

Scott 01-02-2019 01:28 PM

in phuploader.php set:

Code:

$random_name=true;
to

Code:

$random_name=false;
Change Line 198 to:
Code:

if(!empty($_POST['submit']) && $_POST['submit']==true && $password_form=="") {

~BLÃÐE~ 01-02-2019 02:12 PM

TY again Scott :)

That got rid of the error.
But....

When i add a password i get the errors
Code:

Warning: main(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/novaoutp/public_html/tiocoop.com/phUploader.php on line 166

Notice: Undefined index: verify_password in /home/novaoutp/public_html/tiocoop.com/phUploader.php on line 166

Warning: main(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /home/novaoutp/public_html/tiocoop.com/phUploader.php on line 176

Notice: Undefined index: phUploader in /home/novaoutp/public_html/tiocoop.com/phUploader.php on line 176


Line 166
Code:

If($_POST['verify_password']==true) {
Line 176
Code:

If($_COOKIE['phUploader']!=$password_hash) {
Like i said everything is working perfect now, just the last 2 errors

I think this is pretty cool, having the HeartBeat with stats and images and an easy way to upload the map images

Thanks again Scott

Scott 01-02-2019 02:19 PM

Guess I should update my script at some point...

Line 166
Code:

If(!empty($_POST['verify_password']) && $_POST['verify_password']==true) {
Line 176
Code:

If(empty($_COOKIE['phUploader']) || $_COOKIE['phUploader']!=$password_hash) {

~BLÃÐE~ 01-02-2019 03:12 PM

wow, everything is spot on now! :hail:

Thanks Scott

~BLÃÐE~ 01-02-2019 05:32 PM

The phUploader kept taking the dot out of the file for the .bms
So the name would be test.bms.jpg but when it uploaded it is testbms.jpg

I got around this by changing the status.php file from MissionFile to MissionName, i don't need to use the .bms extention now :clap2:

Scott 01-02-2019 09:28 PM

That'll work as long as they are exact :)

~BLÃÐE~ 01-10-2019 04:00 PM

Ok, i got one more question, if i may.

The map image i have set at 250px width
How would i add, onclick of image to open at 800x600px.

Thanks ~BLÃÐE~

Scott 01-11-2019 08:12 AM

Hi Blade, it would look something like this:

Code:

               
if(file_exists("../mapimages/".$Server['MissionFile'].".jpg")) {
        echo "<a href=\"http://www.tiocoop.com/mapimages/".$Server['MissionFile'].".jpg\" target=\"_blank\"><img src=\"http://www.tiocoop.com/mapimages/".$Server['MissionFile'].".jpg\" width=\"500\" /></a>";
} else {
        echo "<img src=\"http://www.tiocoop.com/mapimages/nophoto.jpg\" />";
}


~BLÃÐE~ 01-11-2019 03:18 PM

Thanks again Scott, i was close in my coding lol, can't believe i have forgotten the basic stuff not doing any coding for years.

Ok so i think i have finished doing everything i can to it now lol.

Scott 01-12-2019 10:37 AM

Glad you got it working, BTW how is the heartbeat working out for you guys? I see MANY more BHD servers using it now which is great and will really help keep the lobbies up and running for years (fyi it also reports data to novaworld.cc if novahq ever goes down). Keep spreading the word :)

~BLÃÐE~ 01-13-2019 08:01 AM

Hi Scott, yeah we got about 7 servers up with HeartBeat in total with Mod and BHD/TS Servers (half the HB List lol)

Been trying to spread the word to whom ever we can...


All times are GMT -5. The time now is 11:35 PM.

Powered by vBulletin®