Zal het aanpassen.
Kleine Vragen Topic #2
Iemand die weet hoe ik MB naar GB omzet in PHP? Het moet hele GBs zijn, en altijd naar boven afgerond.
Bijvoorbeeld:
256MB is 1GB
1536MB is 2GB
1024MB is 1GB
15616MB is 16GB
Alvast bedankt
Bijvoorbeeld:
256MB is 1GB
1536MB is 2GB
1024MB is 1GB
15616MB is 16GB
Alvast bedankt

Wouterr schreef:Is toch gewoon wiskunde? Heeft niks te maken met PHPIemand die weet hoe ik MB naar GB omzet in PHP? Het moet hele GBs zijn, en altijd naar boven afgerond.
Bijvoorbeeld:
256MB is 1GB
1536MB is 2GB
1024MB is 1GB
15616MB is 16GB
Alvast bedankt
Raaoul schreef:Jep, sorry x). Is opgelost, ty! This laat, volgensmijBijvoorbeeld:Eerdere citaten tonen
Wouterr schreef:Iemand die weet hoe ik MB naar GB omzet in PHP? Het moet hele GBs zijn, en altijd naar boven afgerond.
256MB is 1GB
1536MB is 2GB
1024MB is 1GB
15616MB is 16GB
Alvast bedankt
Is toch gewoon wiskunde? Heeft niks te maken met PHP
Afbeelding niet beschikbaarDe bron kon niet worden geladen (One2xs).Bron openen ↗Antonn schreef:wat je nu doet is dom. dit is enorm onoverzichtelijk, gebruik fetch_assocEven ter info: mysql_result is sneller en beter. Om het je makkelijk te maken:Eerdere citaten tonen
Desire schreef:Ik heb het zo opgelost en het werkt.Eerdere citaten tonen
Aarclay schreef:Voeg eerst maar eens dat toe.Eerdere citaten tonen
Desire schreef:Vertel eens hoe ik hem dan laat doorsturen naar de in database geplaatste url..Eerdere citaten tonen
Aarclay schreef:Gooi nou foutafhandeling in je script. En mysql_query() kan je NIET echoen.[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #DD0000]1[/COLOR][COLOR= #007700]) {[/COLOR] [COLOR= #0000BB]$uQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM codes WHERE code = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]code[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #0000BB]$uFetch[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$uQuery[/COLOR][COLOR= #007700]);[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]URL: <a href="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$uFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]tURL[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]">Klik hier</a>[/COLOR][COLOR= #007700]; }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]code is onjuist[/COLOR][COLOR= #007700]; }[/COLOR] ?>[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]) {[/COLOR] [COLOR= #0000BB]$uQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT tURL FROM codes WHERE code = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]code[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #0000BB]$url[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_result"]mysql_result[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$uQuery[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]);[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]URL: <a href="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$url[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]">Klik hier</a>[/COLOR][COLOR= #007700]; }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]code is onjuist[/COLOR][COLOR= #007700]; }[/COLOR] ?>
Raaoul schreef:Die is minder snel toch?wat je nu doet is dom. dit is enorm onoverzichtelijk, gebruik fetch_assocEerdere citaten tonen
Antonn schreef:Even ter info: mysql_result is sneller en beter. Om het je makkelijk te maken:Eerdere citaten tonen
Desire schreef:Ik heb het zo opgelost en het werkt.Eerdere citaten tonen
Aarclay schreef:Voeg eerst maar eens dat toe.Eerdere citaten tonen
Desire schreef:Vertel eens hoe ik hem dan laat doorsturen naar de in database geplaatste url..Eerdere citaten tonen
Aarclay schreef:Gooi nou foutafhandeling in je script. En mysql_query() kan je NIET echoen.[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #DD0000]1[/COLOR][COLOR= #007700]) {[/COLOR] [COLOR= #0000BB]$uQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM codes WHERE code = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]code[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #0000BB]$uFetch[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$uQuery[/COLOR][COLOR= #007700]);[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]URL: <a href="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$uFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]tURL[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]">Klik hier</a>[/COLOR][COLOR= #007700]; }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]code is onjuist[/COLOR][COLOR= #007700]; }[/COLOR] ?>[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]) {[/COLOR] [COLOR= #0000BB]$uQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT tURL FROM codes WHERE code = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]code[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #0000BB]$url[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_result"]mysql_result[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$uQuery[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]);[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]URL: <a href="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$url[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]">Klik hier</a>[/COLOR][COLOR= #007700]; }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]code is onjuist[/COLOR][COLOR= #007700]; }[/COLOR] ?>

Wat is hier dan dom aan ofzo? Iets van details.
Wouterr schreef:Delen door 1024 en dan afronden met ceil()Jep, sorry x). Is opgelost, ty! This laat, volgensmijEerdere citaten tonen
Raaoul schreef:Bijvoorbeeld:Eerdere citaten tonen
Wouterr schreef:Iemand die weet hoe ik MB naar GB omzet in PHP? Het moet hele GBs zijn, en altijd naar boven afgerond.
256MB is 1GB
1536MB is 2GB
1024MB is 1GB
15616MB is 16GB
Alvast bedankt
Is toch gewoon wiskunde? Heeft niks te maken met PHPAfbeelding niet beschikbaarDe bron kon niet worden geladen (One2xs).Bron openen ↗
Wat is de regex als ik admin/user wil matchen en dan user er uit wil halen?
Ik heb /(.*?)/(.*?)/ al geprobeerd, matched hij user niet.
Edit: noodoplossing door een slash toe te voegen, als iemand een betere manier weet?
Ik heb /(.*?)/(.*?)/ al geprobeerd, matched hij user niet.
Edit: noodoplossing door een slash toe te voegen, als iemand een betere manier weet?
Antonn schreef:minder snel? 0.01 nanoseconde? boeit geen reetDie is minder snel toch?Eerdere citaten tonen
Raaoul schreef:wat je nu doet is dom. dit is enorm onoverzichtelijk, gebruik fetch_assocEerdere citaten tonen
Antonn schreef:Even ter info: mysql_result is sneller en beter. Om het je makkelijk te maken:Eerdere citaten tonen
Desire schreef:Ik heb het zo opgelost en het werkt.Eerdere citaten tonen
Aarclay schreef:Voeg eerst maar eens dat toe.Eerdere citaten tonen
Desire schreef:Vertel eens hoe ik hem dan laat doorsturen naar de in database geplaatste url..Eerdere citaten tonen
Aarclay schreef:Gooi nou foutafhandeling in je script. En mysql_query() kan je NIET echoen.[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #DD0000]1[/COLOR][COLOR= #007700]) {[/COLOR] [COLOR= #0000BB]$uQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM codes WHERE code = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]code[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #0000BB]$uFetch[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$uQuery[/COLOR][COLOR= #007700]);[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]URL: <a href="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$uFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]tURL[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]">Klik hier</a>[/COLOR][COLOR= #007700]; }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]code is onjuist[/COLOR][COLOR= #007700]; }[/COLOR] ?>[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]) {[/COLOR] [COLOR= #0000BB]$uQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT tURL FROM codes WHERE code = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]code[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR] [COLOR= #0000BB]$url[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_result"]mysql_result[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$uQuery[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]);[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]URL: <a href="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$url[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]">Klik hier</a>[/COLOR][COLOR= #007700]; }[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]code is onjuist[/COLOR][COLOR= #007700]; }[/COLOR] ?>
Wat is hier dan dom aan ofzo? Iets van details.
en ja dat is dom want: onoverzichtelijk. stel je wilt een rij naar een andere plaats verplaatsen, dan zit je met andere waarden en dan klopt niks meer
Bartw schreef:Details?Wat is de regex als ik admin/user wil matchen en dan user er uit wil halen?
Ik heb /(.*?)/(.*?)/ al geprobeerd, matched hij user niet.
Edit: noodoplossing door een slash toe te voegen, als iemand een betere manier weet?
Wil je dit matchen?
iets(slash)iets
Dat kan inderdaad met bovenstaande regex. Beter zou zijn als je de [func]explode[/func] functie.
Ja, maar ik wou juist proberen geen explode te gebruiken, want Regex leek mij hier makkelijker. Btw, details staan er in hoor...
Milan schreef:Jep, heb precies hetzelfde.Delen door 1024 en dan afronden met ceil()Eerdere citaten tonen
Wouterr schreef:Jep, sorry x). Is opgelost, ty! This laat, volgensmijEerdere citaten tonen
Raaoul schreef:Bijvoorbeeld:Eerdere citaten tonen
Wouterr schreef:Iemand die weet hoe ik MB naar GB omzet in PHP? Het moet hele GBs zijn, en altijd naar boven afgerond.
256MB is 1GB
1536MB is 2GB
1024MB is 1GB
15616MB is 16GB
Alvast bedankt
Is toch gewoon wiskunde? Heeft niks te maken met PHPAfbeelding niet beschikbaarDe bron kon niet worden geladen (One2xs).Bron openen ↗

Wat gebruiken jullie bij het maken van een php bestand? Bij html gebruik ik altijd notepad++, dan kan die hem makkelijk openen en zie ik preview via internet, maar dat kan via php niet, hoe kan ik een preview zien zonder steeds op mijn host te moeten zetten?
Jordyt schreef:http://writecodeonline.com/php/Wat gebruiken jullie bij het maken van een php bestand? Bij html gebruik ik altijd notepad++, dan kan die hem makkelijk openen en zie ik preview via internet, maar dat kan via php niet, hoe kan ik een preview zien zonder steeds op mijn host te moeten zetten?
Dit, je kan het dan wel niet saven.
Ik wil een map maken, dus heb ik dit script:
Hij zegt OK maar de map is niet aangemaakt?
[COLOR= #0000BB]<?php
$map[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]/home/x/domains/x.s2.one2xs.com/[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$path[/COLOR][COLOR= #007700].[/COLOR][COLOR= #DD0000]/[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/ftp_chdir"]ftp_chdir[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$ftp_server[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$map[/COLOR][COLOR= #007700])) {[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/ftp_mkdir"]ftp_mkdir[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$ftp_server[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]map2[/COLOR][COLOR= #007700]])) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]OK[/COLOR][COLOR= #007700];
}
}[/COLOR] Hij zegt OK maar de map is niet aangemaakt?