Jump to content
  • 0

[HELP] Status Indicator Issue


diamond

Question

Alright, I have fiddled with this for two full days now, and I am now out of ideas. So here's the scoop:

 

I created a PHP status script to indicate whether or not the login/game server is on/offline. Script was working fine, then, out of the blue, completely stopped functioning. Here is what I've done so far, and the script I'm using:

 

<?php

 

$server = "X.X.X.X";

$portg = "7777";

$portl = "2106";

$timeout = "1";

 

$game = @fsockopen("$server", $portg, $errno, $errstr, $timeout);

$login = @fsockopen("$server", $portl, $errno, $errstr, $timeout);

echo $game ? "<img src=\"ico-on.png\">" : "<img src=\"ico-off.png\">";

echo "     ";

echo $login ? "<img src=\"ico-on.png\">" : "<img src=\"ico-off.png\">";

?>

 

(I've removed the $server IP)

 

Now, I know for a fact that this is a working script, because if I modify the server IP to my webserver, and change the ports to 80, it works without issue. HOWEVER, just to test this, I've copy + pasted several similar scripts I've found here and on Ragezone, same issue.

 

Then, I reset my router to the defaults, re-forwarded ports 2106, 7777, and 3306 to a new static IP on the network, and edited the L2J Configs to match the new internal IP. I've also quadruple checked all of the settings in the router, L2J configs, and the PHP script.

 

I then checked the open ports using a port scanner available online. The port scanner sees 7777 and 2106 as open, however 3306 (for SQL) is closed for some reason. The SQL port I'm not concerned as much about right now, but if the port scanner can see 7777 and 2106, shouldn't the PHP Script also?

 

Finally, I went so far as to change the ports from 2106 and 7777 on L2J to random port numbers that are not in use, and then match all of the settings on the script and router, however same issue.

 

I'm completely out of ideas, is there anything anyone can think of that I can further test?

Link to comment
Share on other sites

11 answers to this question

Recommended Posts

  • 0

Dumb question, but have you tried with a total another PHP script (not L2J related), or is there any running script which currently work in the same time than your script ? Just to verify if PHP works correctly...

 

What's your error ? White blank screen ? Another type ?

 

You can test your PHP/mySQL link using another type of call, like an heroe/pvp/pk/another page, to see if php and mySQL can exchange data.

 

  • If you tested several scripts, that doesn't come (obviously) from script, assuming they all work :P.
  • If others PHP scripts work, that don't come from PHP.
  • If you can do a webpage calling heroes/etc, it doesn't come from php/mySQL link :P.
  • If all those things higher are true, than you 're in a big shit lol :). Nha, if all is true, it can only be a firewall problem, or your router. From my PoV anyway, and I'm not a guru in PsHitP...

 

Btw, you say in 2nd line it's not working now, and after your quote you're saying it works without issue... Have you changed something between the 2 states ?

 

If it's a developement platform, use an all-in-one solution like WAMP/LAMP. That avoids... Many problems.

 

Sry to don't give a real answer, but currently except if someone had exactly the same error in the past there is no real answer :D.

Link to comment
Share on other sites

  • 0

I've tried using a non-L2J related script, still having the same issue. What is strange is if I change the IP to my webserver, rather than point it to the game server, and change the ports to 80 instead of 7777 and 2106, the script runs correctly. So I am guessing there is something being blocked somewhere, but I've disabled the firewall on the router + windows firewall.

 

Edit: there is no error message, the script runs, but it shows the servers are offline when they clearly are not. The port scanner I used online can see the open ports but the script doesn't see the servers.

Link to comment
Share on other sites

  • 0

Another dumb check, you said you changed IP on L2J configs, but didn't say about L2J ports.

>> Are they matching ?

 

About that > I've tried using a non-L2J related script, still having the same issue.

>> if you got the same issue with a normal PHP script (try JUST an echo), it's PHP which is wrong :).

>> if you tried with another stylished ports script, try with an echo :P

 

Btw your LS/GS IP isn't the webserver one ? I have to understand you use 2 different computers if you hide your IP ? Because you just have to put 127.0.0.1 if it's the same computer.

 

If you haven't no more solution, try install/reinstall WAMP/LAMP, and test on it :P.

 

And try to remember what the heck you drink to fock your script yesterday, or at least what you did, haha :).

Link to comment
Share on other sites

  • 0

Yes, the ports matched, I've checked my configs hundreds of times thinking I was just an idiot, but unfortunately it wasn't that easy.

 

LS/GS IP is not the same as the webserver. LS/GS is hosted locally, webserver is hosted by a host company (Fatcow) So the PHP script is pointing to my router's IP address which should then forward to my internal IP address since I've opened and tested the ports, and have had users connect to the LS/GS from outside of my network without issue.

 

I'm not sure what you mean with trying just an echo though.

 

And man, I wish I knew what I did to screw this up lol. It has been a nightmare for two days now.

Link to comment
Share on other sites

  • 0

I just try to remove the followers from the "die" list :P.

- PHP

- mySQL

- ports

 

----

 

<?php echo 'Hello world !' ;
echo "Hello world !" ; ?>

 

Just to see if it's PHP or not. If it's already broken, the "fat|cow" will becomes a burger.

 

----

 

Have you tried to put off your server, to see what the result ?

 

----

 

I don't want to give you hope, but I think it could be the use of " instead of ' when you try to call (echo) images. I remember now something like that happened to me too... Some months ago.

 

To give a try, try my first echo situation and replace ' per ". I added the 2 versions in my code tag if you're lazy lol.

 

If you see only one *Hello world* instead of 2, you got your answer.

Link to comment
Share on other sites

  • 0

Thanks for the advice, sadly, both of the Hello World showed on the page.

 

I shut down the server to see if I just reversed the echo, however it still says offline.

 

Edit: I do not currently have WAMP installed, as I run the site from the remote webhost. However could this be causing the problem with the script being able to connect to my local PC? I'm wondering if that is why I am having a similar issue connecting from the web server to my MySQL database, it can't seem to see the system.

Link to comment
Share on other sites

  • 0

You tried to empty your browser cache...? Lol.

 

Be clear with your words, you're saying when the server is off, it says "offline", and when it is online, it says nothing. You're wrong or I'm wrong ? Because if it's true we got a track, if not that make a useless post on MxC lol.

 

Both off and on server should call nothing, if you got images when the server is offline, it's a draw problem. Lol.

 

Try replace your images with just a damn echo too.

 

<?php

 

$server = "X.X.X.X";

$portg = "7777";

$portl = "2106";

$timeout = "1";

 

$game = @fsockopen("$server", $portg, $errno, $errstr, $timeout);

$login = @fsockopen("$server", $portl, $errno, $errstr, $timeout);

echo $game ? 'on' : 'off';

echo ' ';

echo $login ? 'on' : 'off';

?>

 

I put the code in quote because it looks like christmas tree if you put in code tags.

 

If you got something it's related to your images.

 

About wamp, it was just if your current thing was a developement lab. You are supposed to be able to do the link between 2 hosts.

 

What have you tried with mySQL so far ?

 

Is your webhoster got security policies you didn't read ? :P

 

EDIT : TRY TO CHANGE THE HOSTNAME FOR A REAL ONE >> WWW.GOOGLE.COM

Link to comment
Share on other sites

  • 0

My firefox is set to clear cache on exit. I've done that multiple times, as well as restarted the PC and used Internet Explorer to test a separate browser. Still same problem.

 

What I mean is this:

LS/GS on: PHP script says both are offline

LS/GS off: PHP script says both are offline

 

Either way, it always displays the "Server Offline" image.

 

I used the code you listed, and still displays as "offline"

 

I am beginning to wonder if there is a problem with my router, even though all of the settings are correctly set to forward to my internal IP.

 

Edit: I am really confused why the PHP script doesn't see the servers, I went to http://www.canyouseeme.org/ and listed the ports 2106 and 7777 at my IP, and it sees both as open.

Link to comment
Share on other sites

  • 0
<?php

 

$server = "X.X.X.X";

$portg = "7777";

$portl = "2106";

$timeout = "1";

 

$game = fsockopen($server, $portg, $errno, $errstr, $timeout);

$login = fsockopen($server, $portl, $errno, $errstr, $timeout);

 

echo $game ? 'on' : 'off';

echo ' ';

echo $login ? 'on' : 'off';

?>

 

The $server variable was under ""... And what about the @ before fsockopen, I don't see the use.

 

If that still doesn't work, try with another existing hostname, instead of your IP put www.google.com

 

About the timeout, I have no idea how it is influenced by the ping. If it is, it could be one way. There is a default timeout set in your php.ini, so this optio is pretty useless anyway (from what I read).

 

See more about fsockopen here : http://www.php.net/manual/en/function.fsockopen.php

Link to comment
Share on other sites

  • 0

Tried your code again, still didn't work. I replaced it with google as well as a couple other private server IP's and still showing as offline. Could this be caused by the webhost ?

 

Here is the error message I get using your code:

 

Warning: fsockopen() [function.fsockopen]: unable to connect to 91.206.227.139:7777 (Connection refused) in /hermes/web04/b1856/moo.l2con/index.htm on line 142

Warning: fsockopen() [function.fsockopen]: unable to connect to 91.206.227.139:2106 (Connection refused) in /hermes/web04/b1856/moo.l2con/index.htm on line 142

Link to comment
Share on other sites

  • 0

You should contact your webhoster yup, I read some could firewalling ports to avoid spamming, which avoids to be blacklisted.

 

Did you tried with other websites, because google isn't the only one :). Try with 2-3 others, and if it's still no, just ask to your host.

 

You normally have an admin panel too in your webhoster, check about ports options if there is one.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • I also think this feature would bring more harm than good... another example is a dwarf rushing against your mobs so he takes priority, then he plays fake death and proceeds to grief the shit out of you. A minimum damage threshold is necessary, which would basically converge to what is the default feature (i.e. biggest damage dealer)
    • I bought the premium to watch the video and it's private. 😢
    • For some Majestic reason OP can't edit their topics anymore?    Let me update the potential offers, I got up to 2 spots to fill.   CONTACT TELEGRAM ONLY: https://t.me/asupport_g1     A credible team that SGuard represents is looking for java developers.    These positions is full time only i.e. your time is mostly dedicated within the team and team tasks, side gigs are fine, as long as you are able to combine your gig and main.  All necessary tools are provided.  The team is consistent with > 10 team members and the team is looking to expand to meet various goals. A decent Lineage 2 Essense OR Main (GOD) knowledge is needed.  Experience with l2r/l2p/l2s. mobius is fine too for referrence only. The team is friendly and goal oriented, very active and resourceful.   Requirements are standard, java knowledge is optional.  Multi language is a plus but not necessary (English/Russian), any is accepted.   Terms and conditions including compensation are reasonable and considered to be up for the industry standards. Details are negotiable with suitable candidates.   You will need to have a headset and a mic just for the initial processing, there're no team meetings or conferences after that. There's a small 30min interview process to demonstrate knowledge and just to meet each other.   The team has decided it is in their best interest to not publish their information at this time. Details will be available only for suitable candidates.   CONTACT TELEGRAM ONLY: https://t.me/asupport_g1
    • Thanks for the detailed info. I also have some ideas in mind but the execution may be hard. Thanks again!
    • There are as many approaches as stars in the sky, for all I know. You could create a class variable in MonsterInstance.java, which will hold the Object_ID of its first aggressor/dmg_dealer. From there, you will have to add a check in the RequestAttack and RequestMagicSkillUse packets and/or in some doDamage()/reduceHp() method, which will check if the damage dealer is the first aggressor, and if not - reduce the damage to 0. But you also have to be mindful about special cases, such as: - what happens when a Warlord runs around an area, provoking everything just to trigger the aggression and then just goes to town waiting for someone else to kill the said mobs so that the WL can collect free rewards? You might have to play with the DefaulAI, or the AI of monsters and hook a function that would reset the aggressor_id value under certain conditions, such as - the aggressor is not in X range or the aggressor is dead, or the aggressor is not online, or the NPC/Monster's AI is in INACTIVE state, which would indicate they are not in combat. - what happens when the aggressor is in party? should the said aggressor/dmg_dealer variable be a List/Set of players which are all eligible to deal dmg or receive rewards?  
  • Topics

×
×
  • Create New...