Go Back   Novahq.net Forum > Computers > Web design and Programming

Web design and Programming Discuss website creation and other programming topics.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-11-2018, 01:42 PM
~BLÃÐE~ is offline ~BLÃÐE~
Registered User

Join Date: Dec 2004
Location: Gold Coast, Australi
Posts: 241

Send a message via ICQ to ~BLÃÐE~
BHD Heartbeat

Hi Scott, would it be possible to add a map image to the coding showing which map is playing?
Reply With Quote
  #2  
Old 12-12-2018, 08:11 AM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,919

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
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #3  
Old 12-24-2018, 03:36 AM
~BLÃÐE~ is offline ~BLÃÐE~
Registered User

Join Date: Dec 2004
Location: Gold Coast, Australi
Posts: 241

Send a message via ICQ to ~BLÃÐE~
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
Reply With Quote
  #4  
Old 12-26-2018, 03:23 PM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,919

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.
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #5  
Old 12-27-2018, 12:41 AM
~BLÃÐE~ is offline ~BLÃÐE~
Registered User

Join Date: Dec 2004
Location: Gold Coast, Australi
Posts: 241

Send a message via ICQ to ~BLÃÐE~
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
Reply With Quote
  #6  
Old 12-27-2018, 11:24 AM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,919

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\" />";
}
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #7  
Old 12-27-2018, 02:38 PM
~BLÃÐE~ is offline ~BLÃÐE~
Registered User

Join Date: Dec 2004
Location: Gold Coast, Australi
Posts: 241

Send a message via ICQ to ~BLÃÐE~
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,
Reply With Quote
  #8  
Old 12-31-2018, 08:49 AM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,919

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.
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #9  
Old 01-02-2019, 01:25 PM
~BLÃÐE~ is offline ~BLÃÐE~
Registered User

Join Date: Dec 2004
Location: Gold Coast, Australi
Posts: 241

Send a message via ICQ to ~BLÃÐE~
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
Reply With Quote
  #10  
Old 01-02-2019, 01:28 PM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,919

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=="") {
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #11  
Old 01-02-2019, 02:12 PM
~BLÃÐE~ is offline ~BLÃÐE~
Registered User

Join Date: Dec 2004
Location: Gold Coast, Australi
Posts: 241

Send a message via ICQ to ~BLÃÐE~
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
Reply With Quote
  #12  
Old 01-02-2019, 02:19 PM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,919

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) {
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #13  
Old 01-02-2019, 03:12 PM
~BLÃÐE~ is offline ~BLÃÐE~
Registered User

Join Date: Dec 2004
Location: Gold Coast, Australi
Posts: 241

Send a message via ICQ to ~BLÃÐE~
wow, everything is spot on now!

Thanks Scott
Reply With Quote
  #14  
Old 01-02-2019, 05:32 PM
~BLÃÐE~ is offline ~BLÃÐE~
Registered User

Join Date: Dec 2004
Location: Gold Coast, Australi
Posts: 241

Send a message via ICQ to ~BLÃÐE~
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
Reply With Quote
  #15  
Old 01-02-2019, 09:28 PM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,919

That'll work as long as they are exact
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #16  
Old 01-10-2019, 04:00 PM
~BLÃÐE~ is offline ~BLÃÐE~
Registered User

Join Date: Dec 2004
Location: Gold Coast, Australi
Posts: 241

Send a message via ICQ to ~BLÃÐE~
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~
Reply With Quote
  #17  
Old 01-11-2019, 08:12 AM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,919

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\" />";
}
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #18  
Old 01-11-2019, 03:18 PM
~BLÃÐE~ is offline ~BLÃÐE~
Registered User

Join Date: Dec 2004
Location: Gold Coast, Australi
Posts: 241

Send a message via ICQ to ~BLÃÐE~
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.
Reply With Quote
  #19  
Old 01-12-2019, 10:37 AM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,919

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
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #20  
Old 01-13-2019, 08:01 AM
~BLÃÐE~ is offline ~BLÃÐE~
Registered User

Join Date: Dec 2004
Location: Gold Coast, Australi
Posts: 241

Send a message via ICQ to ~BLÃÐE~
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...
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 11:26 AM.




Powered by vBulletin®