IP online

Gestart doorRickdb5 reacties45 weergaven

6 berichten · pagina 1 van 1

Rickdb

Lid · Topicstarter

Berichten
1.674
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Met wat voor n script kan ik kijken of het IP online is?
En dit dan weer te geven op de website.

Het is voor een stream verkoopwebsite namelijk.
0
Berichten
545
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]function[/COLOR] GetServerStatus[COLOR= #007700]([/COLOR][COLOR= #0000BB]$site[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$port[/COLOR][COLOR= #007700])
{[/COLOR]

[COLOR= #0000BB]$status[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"OFFLINE"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"ONLINE"[/COLOR][COLOR= #007700]);[/COLOR]

[COLOR= #0000BB]$fp[/COLOR] [COLOR= #007700]= @[/COLOR][URL="http://www.php.net/fsockopen"]fsockopen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$site[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$port[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$errno[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$errstr[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]2[/COLOR][COLOR= #007700]);[/COLOR]

[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700](![/COLOR][COLOR= #0000BB]$fp[/COLOR][COLOR= #007700]) {[/COLOR]
    [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$status[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]];
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$status[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]];
}
}[/COLOR]
?>


Voor de klikkers
0
Rickdb

Lid · Topicstarter

Berichten
1.674
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ja, maar ik wil niet dat hij het per port bekijkt? Alleen per ip, is dat mogelijk?

En ik krijg error:

Parse error: syntax error, unexpected $, expecting & or T_VARIABLE in /home/ralph/domains/stream-me.nl/public_html/index.php on line 20


Edit: Ik moet zelf IP kunnen instellen, niet dat hij via ip van webhost bekijkt.
0
Berichten
544
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Zoals Maurice al zegt dus;

[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]function[/COLOR] GetServerStatus[COLOR= #007700]([/COLOR][COLOR= #0000BB]$site[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$port[/COLOR][COLOR= #007700])
{[/COLOR]

[COLOR= #0000BB]$status[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"OFFLINE"[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]"ONLINE"[/COLOR][COLOR= #007700]);[/COLOR]

[COLOR= #0000BB]$fp[/COLOR] [COLOR= #007700]= @[/COLOR][URL="http://www.php.net/fsockopen"]fsockopen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$site[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$port[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$errno[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$errstr[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]2[/COLOR][COLOR= #007700]);[/COLOR]

[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700](![/COLOR][COLOR= #0000BB]$fp[/COLOR][COLOR= #007700]) {[/COLOR]
    [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$status[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700]];
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
    [URL="http://www.php.net/return"]return[/URL] [COLOR= #0000BB]$status[/COLOR][COLOR= #007700][[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]];
}
}[/COLOR]
?>


Een andere wijze is middels een fping zoals in mijn sig te zien is. Die checkt continue of One2Xs.com bereikbaar is "One2xs.com is alive".

Je vraag "moet zelf IP kunnen instellen, niet dat hij via ip van webhost bekijkt." snap ik niet helemaal, bedoel je dat je niet wilt dat hij het ip-adres van de server als afzender (source) gebruikt? Dat kan dus niet. Je hebt altijd een afzender ip-adres van de webhost.
0
Rickdb

Lid · Topicstarter

Berichten
1.674
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Wacht je zet hier een code neer.
Maar bij deze code:

function GetServerStatus($site, $port)


Moet ik de gegevens invullen, of moet dat daaronder.. Allebei kan ook nog.

Maar ik wil zelf zeg maar een IP instellen.
Bijv. ip van site is: 86.81.138.457
En het ip wat ik wil is: 94.215.83.2 bijvoorbeeld.
Dat wil ik kunnen nl.
0
Berichten
18.482
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Dan moet je echo GetServerStatus(ip dat je wil, 80) doen
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren