[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Webmasterplein.net • Toon onderwerp - als de server offline is, dan...
aan alle goede dingen komt een eind, webmasterplein.net 2003 - 2013
wij danken jullie voor al mooie momenten die dankzij dit forum ontstonden - Derk, Rutger en Stef

als de server offline is, dan...

Je komt er niet helemaal uit bij het scripten? Übergoede functie geschreven? Alles met betrekking tot scripting, kun je hier terecht.

als de server offline is, dan...

Berichtdoor superpromo » 12 mei 2005 21:05

Er is een trucje om te bepalen vanaf welke server info gehaald kan worden:
[syntax="html"]<img src="http://mijnserver.com/pic.jpg" onError "window.location='http://andereserver.com/etc'">
[/syntax]
Maar nu zou ik dat trucje op een andere manier willen toepassen, namelijk in een iframe. In dat frame moet een PHP-programma worden afgeroepen, maar de server waar dat staat, is de laatste tijd vaak offline. Ik dacht dus iets als:
[syntax="html"]<iframe width=... height=... src="http://mijnserver.com/prog.php?data=gegevens" onError "window.location='http://andereserver.com/prog.php?data=gegevens'"></iframe>
[/syntax]
Maar dat werkt niet. Is er dan misschien een andere manier?
Ik ben tegen spam, popups, Trojaanse paarden en alle andere vormen van internetvervuiling
Avatar gebruiker
superpromo
wmpr
 
Berichten: 66
Geregistreerd: 06 mei 2005 09:58

Berichtdoor vosManz » 12 mei 2005 21:52

Dit topic staat in XHTML & CSS, dus ik denk dat je daar een oplossing in zoekt. Dit weet ik niet, maar ik weet wel een oplossing in PHP. Je server moet hier natuurlijk wel PHP voor ondersteunen, en mag niet in safe-mode staan.

[syntax="php"]<?php
@$fp=fsockopen("www.mijnserver.com","80",$errno,$errstr,"10");
if(!$fp){
$mytext="<iframe width=... height=... src=\"http://andereserver.com/prog.php?data=gegevens\"></iframe>";
}else{
$mytext="<iframe width=... height=... src=\"http://mijnserver.com/prog.php?data=gegevens\"></iframe>";
}
@fclose($fp);
echo $mytext;
?>[/syntax]

over de functie: fsockopen("www.mijnserver.com","80",$errno,$errstr,"10")

Het eerste argument is de website, of IP-adres ZONDER http ervoor.
Het tweede argument is de poort, voor een http server is dit meestal poort 80. Als je een ftp wil controleren moet je 21 gebruiken.
Het derde argument is het foutnummer. Als er iets fout gaat met de functie, kun je de variabele $errno gebruiken om de foutcode te achterhalen.
Het vierde argument is de foutmelding. Als er iets fout gaat met de functie, kun je de variabele $errstr gebruiken om de foutmelding te achterhalen.
Het vijfde argument is de time-out. Dit getal geeft aan hoe lang de functie moet proberen verbinding te maken. Als het binnen deze tijd niet lukt, geeft hij aan dat de server down is.
Avatar gebruiker
vosManz
wmpr
 
Berichten: 139
Geregistreerd: 17 apr 2005 21:26

Berichtdoor superpromo » 13 mei 2005 08:36

Nee, dan had dit hier niet moeten staan; ik had het hier gezet omdat er werd gesproken van "(X)(D)HTML". Dat is volgens mij ook HTML. Ik zal dit even elders plaatsen.

AANVULLING: en daar is het meteen op slot gezet.

Dus even voor de duidelijkheid:
Op een héél betrouwbare server (Skynet, die bijna nooit offline is) staat een stukje html met JavaScript. Dat genereert een iframe waarin PHP moet draaien. Maar op Skynet kan geen PHP draaien, dus dat moet op een andere server worden afgeroepen. Helaas ligt die server er nogal eens uit. Ik kan ook gebruik maken van een "reserve" PHP-server (die er ook wel eens uit ligt, dus die kan ik ook niet als vaste server gebruiken).

En hier is in concreto het probleem:

Javascript doet zoiets als dit:
[syntax="javascript"]document.write("<iframe width=... height=... src='http://superpromo.org/programma.php?lid=lidnaam&kl=anderedata'></iframe>");[/syntax]

Maar als die server offline is, zou ik willen dat automatisch die andere server wordt aangesproken, en ik had iets geprobeerd als:

[syntax="javascript"]document.write("<iframe width=... height=... src='http://superpromo.org/programma.php?lid=lidnaam&kl=anderedata' onError \"window.location='http://andereserver.com/programma.php?lid=lidnaam etc'\"></iframe>");[/syntax]

Dat werkt dus niet. En dit heb ik ook geprobeerd:

[syntax="javascript"]pl="mijnserver.com";
document.write("<img src='http://mijnserver.com/plaatje.gif width=1 height=1 onError=\"pl='andereserver.com'\">");
document.write("<iframe width=... height=... src='http://",pl,"/programma.php?lid=lidnaam&kl=anderedata'></iframe>");
// het iframe wordt gevuld met de (misschien offline zijnde) url op "mijnserver.com" voordat pl zijn nieuwe waarde krijgt doordat het plaatje niet geladen kan worden[/syntax]

Mijn vraag is wat wel zou werken.
Let op: het PHP-programma MOET binnen het iframe worden afgeroepen.
Ik ben tegen spam, popups, Trojaanse paarden en alle andere vormen van internetvervuiling
Avatar gebruiker
superpromo
wmpr
 
Berichten: 66
Geregistreerd: 06 mei 2005 09:58


Keer terug naar PHP, ASP, SQL



cron