Kleine Vragen Topic #1

Gestart doorLennard4.284 reacties15.585 weergaven

4.285 berichten · pagina 77 van 286

Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Dylanh schreef:
Eerdere citaten tonen
Nickjexx schreef:
Eerdere citaten tonen
Dylanh schreef:
Eerdere citaten tonen
Rik schreef:
Nou, als je bagger programmeert dan werkt je site ook bagger.
Oh xd, naja dan ik ga toch over op een andere server (hier)
Quote:
Server info Server is offline!
Probeer het later nog eens!
Laatste update: 16-08-2012 13:34

Moet hij bij elke pagina view checken of de server offline is? Zoja doe het met een cronjob smile
Nee, dat controleert ie per minuut:

[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]## Status cache ###[/COLOR]
[COLOR= #0000BB]$site[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"xxx"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$port[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"25565"[/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]3[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR][COLOR= #0000BB]$fp[/COLOR][COLOR= #007700])
{[/COLOR]
    [COLOR= #0000BB]$online[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]0[/COLOR][COLOR= #007700];
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
    [COLOR= #0000BB]$online[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]1[/COLOR][COLOR= #007700];
}[/COLOR]
[COLOR= #0000BB]$date[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM status"[/COLOR][COLOR= #007700]));[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$date[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]last[/COLOR][COLOR= #007700]] !=[/COLOR] [URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]d-m-Y H:i[/COLOR][COLOR= #007700])) {[/COLOR]
         [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE status SET last = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]d-m-Y H:i[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000]", online_users = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$server[/COLOR][COLOR= #007700]->[/COLOR]online_players[COLOR= #007700].[/COLOR][COLOR= #DD0000]"/"[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$server[/COLOR][COLOR= #007700]->[/COLOR]max_players[COLOR= #007700].[/COLOR][COLOR= #DD0000]", status = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$online[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);
}[/COLOR] 
[COLOR= #FF8000]### eind ###[/COLOR]
?>

Die 3 in je fsock zorgt ervoor dat de connectie voor 3 seconden lang open blijft volgens mij, en hij dan pas stopt met kijken of de server offline is. Dit wil zeggen dat het PHP script al minstens 3 seconden moet laden.

Dat soort dingen helpen dus mee aan de hoge laadtijd.
0
Berichten
1.684
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Doet dit iets speciaals?

<a href="#div">Dit is een link</a>


EDIT: Ja, dit is een link, maar wat doet "#div"?
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Doorsturen naar de anchor met de name: #div
Leuk voor F.A.Q.s bijvoorbeeld.

<a href="#div">Dit is een link</a>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<a name="div" />
<p>Hier staat informatie over iets...</p>
0
Berichten
1.684
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Kan dit gebruikelijk zijn voor dropdowns?

EDIT: Laat maar, ik denk dat "#" beter is voor dropdowns?
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Wat heeft een dropdown te maken met een link en anchor?
0
Berichten
1.684
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Aarclay schreef:
Wat heeft een dropdown te maken met een link en anchor?
Ik bedoel een dropdown menu.
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Ja,d at bedoel ik ook, ja.
Een selectbox?
0
Berichten
7.806
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Misschien een hele domme vraag, hoe doe je dat met drop down menus dat je er een link van maakt? Dus je kiest een option en word gelijk doorgestuurd.
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
<select onChange="this.options[this.selectedIndex].value && (window.location = this.options[this.selectedIndex].value);">
    <option value="">Maak je keuze</option>
    <option value="http://www.one2xs.nl">One2xs</option>
    <option value="http://www.facebook.com">Facebook</option>
</select>
0
Berichten
14.025
Reputatie
1
Punten
0,01
Lid sinds
Laatst gezien
Rik schreef:
Eerdere citaten tonen
Dylanh schreef:
Eerdere citaten tonen
Nickjexx schreef:
Eerdere citaten tonen
Dylanh schreef:
Eerdere citaten tonen
Rik schreef:
Nou, als je bagger programmeert dan werkt je site ook bagger.
Oh xd, naja dan ik ga toch over op een andere server (hier)
Quote:
Server info Server is offline!
Probeer het later nog eens!
Laatste update: 16-08-2012 13:34

Moet hij bij elke pagina view checken of de server offline is? Zoja doe het met een cronjob smile
Nee, dat controleert ie per minuut:

[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]## Status cache ###[/COLOR]
[COLOR= #0000BB]$site[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"xxx"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #0000BB]$port[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"25565"[/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]3[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR][COLOR= #0000BB]$fp[/COLOR][COLOR= #007700])
{[/COLOR]
    [COLOR= #0000BB]$online[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]0[/COLOR][COLOR= #007700];
}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
    [COLOR= #0000BB]$online[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]1[/COLOR][COLOR= #007700];
}[/COLOR]
[COLOR= #0000BB]$date[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM status"[/COLOR][COLOR= #007700]));[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$date[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]last[/COLOR][COLOR= #007700]] !=[/COLOR] [URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]d-m-Y H:i[/COLOR][COLOR= #007700])) {[/COLOR]
         [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE status SET last = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]d-m-Y H:i[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000]", online_users = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$server[/COLOR][COLOR= #007700]->[/COLOR]online_players[COLOR= #007700].[/COLOR][COLOR= #DD0000]"/"[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$server[/COLOR][COLOR= #007700]->[/COLOR]max_players[COLOR= #007700].[/COLOR][COLOR= #DD0000]", status = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$online[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);
}[/COLOR] 
[COLOR= #FF8000]### eind ###[/COLOR]
?>

Die 3 in je fsock zorgt ervoor dat de connectie voor 3 seconden lang open blijft volgens mij, en hij dan pas stopt met kijken of de server offline is. Dit wil zeggen dat het PHP script al minstens 3 seconden moet laden.

Dat soort dingen helpen dus mee aan de hoge laadtijd.
De website is nu versneld door dit te veranderen:

[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]### Status cache ###[/COLOR]
[COLOR= #0000BB]$date[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM status"[/COLOR][COLOR= #007700]));[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$date[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]last[/COLOR][COLOR= #007700]] !=[/COLOR] [URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]d-m-Y H:i[/COLOR][COLOR= #007700])) {[/COLOR]
    [COLOR= #0000BB]$site[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"server.nedercraft.nl"[/COLOR][COLOR= #007700];[/COLOR]
    [COLOR= #0000BB]$port[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]"25565"[/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]1[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700](![/COLOR][COLOR= #0000BB]$fp[/COLOR][COLOR= #007700])
    {[/COLOR]
        [COLOR= #0000BB]$online[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]0[/COLOR][COLOR= #007700];
    }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
        [COLOR= #0000BB]$online[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]1[/COLOR][COLOR= #007700];
    }[/COLOR]
         [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"UPDATE status SET last = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/date"]date[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]d-m-Y H:i[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000]", online_users = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$server[/COLOR][COLOR= #007700]->[/COLOR]online_players[COLOR= #007700].[/COLOR][COLOR= #DD0000]"/"[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$server[/COLOR][COLOR= #007700]->[/COLOR]max_players[COLOR= #007700].[/COLOR][COLOR= #DD0000]", status = "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$online[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);
}[/COLOR] 
[COLOR= #FF8000]### eind ###[/COLOR]
?>


Nu word ook de verbinding gecontroleerd wanneer de minuut voorbij isbiggrin
0
Berichten
7.806
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Aarclay schreef:
<select onChange="this.options[this.selectedIndex].value && (window.location = this.options[this.selectedIndex].value);">
    <option value="">Maak je keuze</option>
    <option value="http://www.one2xs.nl">One2xs</option>
    <option value="http://www.facebook.com">Facebook</option>
</select>
Bitte danke biggrin
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
dit is echt heel vaag maar als ik
echo trim("[QUOTE])."]n".$msg[bericht]."[/quote]n");


gebruik komen er allemaal spaties achter. ik snap niet hoe emo
Als ik het bericht op het forum echo is er niet aan de hand.

(het probleem is nogsteeds niet opgelost! xd)
0
Berichten
10.421
Reputatie
4
Punten
0,00
Lid sinds
Laatst gezien
Niet rottig bedoeld of evenmin een zielige sneer naar de hulp op One2xs, maar kijk eens op Stackoverflow, daar worden de vragen ook vrij snel beantwoord smile.

Als het haast heeft en er is wat meer expertise nodig, dan kan dat wel helpen.
Maar ook hier kunnen we helpen.

Ik denk dat het overigens wel ergens anders aan ligt? Die n staat er zeker omdat deze echo in een textarea gebruikt wordt?
0
Berichten
93.699
Reputatie
0
Punten
1,27
Lid sinds
Laatst gezien
Aarclay schreef:
Niet rottig bedoeld of evenmin een zielige sneer naar de hulp op One2xs, maar kijk eens op Stackoverflow, daar worden de vragen ook vrij snel beantwoord smile.

Als het haast heeft en er is wat meer expertise nodig, dan kan dat wel helpen.
Maar ook hier kunnen we helpen.

Ik denk dat het overigens wel ergens anders aan ligt? Die n staat er zeker omdat deze echo in een textarea gebruikt wordt?
Yup. ik ga inderdaad maar eens naar Stackoverflow.

het enige wat ik kan bedenken is de indenting van de code zelf, maar dat zou ik wel extreem bizar vinden.
0
Jvdw

Lid

Berichten
4.321
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
moet je voor myriad pro cufon gebruikenredface
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