Jump to content

Problem getting this code working


cris11368

Recommended Posts

Ok I literally started coding php like a few hours ago and I'm trying to get this to work

<?php

setcookie("status", 1, time()+120);

$status = $_COOKIE['status'];

if(($login = fsockopen("127.0.0.1", 7575)) == 1){$login = "Online";}

else {$login = "Offline";}

if(($world = fsockopen("127.0.0.1", 8484)) == 1){$world = "Online";}

else {$world = "Offline";}

 

echo $world.$login;

?>

 

What it's supposed to do is check to see if the server is on, on the ports specified. If it's not just display OfflineOffline if they are then OnlineOnline. I was trying to use a cookie so that if it's been less than 120 seconds since the person last check the status that it would just use the OnlineOnline. Thought I could use that so this doesnt get spammed but I cant make that work.

 

Link to comment
https://forums.phpfreaks.com/topic/170939-problem-getting-this-code-working/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.