0.o wel dan zal ik er strak over 40 minutes nog eens naar kijken.
Ik krijg een blanco pagina.
Haal ik die met privatemessage etc. eruit haal doet hij het wel, de fout zit hem dus daarin!
toevoeging op 29 februari 2012, 20
52:
Iemand een idee?
toevoeging op 29 februari 2012, 20
52:Iemand een idee?
in mijn code had ik ook wat aangepast aan de $refmessage had je die ook veranderd?
IK heb alles wat jij schreef aangepast
Ga eens naar gewoon http://jesite.ext/jebestand.php?
if(isset($_POST[submit])){
Dit is niet de juiste manier. Gebruik dit:
if($_SERVER[REQUEST_METHOD]=="POST") {
Tevens ontbreekt goede foutafhandeling. Een script hoort NIET (ik herhaal NIET) te sterven als er iets fout gaat. Dat doen mensen normaal toch ook niet, als ze iets fout doen?
Ook raad ik aan om bovenaan te plaatsen:
En benut de tab-toets eens bij if-else statements.
Dit is niet de juiste manier. Gebruik dit:
if($_SERVER[REQUEST_METHOD]=="POST") {
Tevens ontbreekt goede foutafhandeling. Een script hoort NIET (ik herhaal NIET) te sterven als er iets fout gaat. Dat doen mensen normaal toch ook niet, als ze iets fout doen?
Ook raad ik aan om bovenaan te plaatsen:
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/error_reporting"]error_reporting[/URL][COLOR= #007700]([/COLOR]E_ALL[COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/ini_set"]ini_set[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]display_errors[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]);[/COLOR]
?> En benut de tab-toets eens bij if-else statements.
Dat van hoeft niet te sterven vergelijken met ons
ik heb het nog al gezien en het is redelijk stom. Als je zelf een error wilt geven zoals bv op youtube zijn er niet veel keuzes.
ik heb het nog al gezien en het is redelijk stom. Als je zelf een error wilt geven zoals bv op youtube zijn er niet veel keuzes.Hoe bedoel je, zoals op Youtube?
Ik heb het al iets mooier uitgelijnd want man wat een bagger script.
Anyway het zit hem wss in die or die dus export de database structuur van privatemessages eens.
*edit*
De eerste ufetch staat nu na de else, anders gaat het een error geven.
toevoeging op 29 februari 2012, 21:01:06:
Anyway het zit hem wss in die or die dus export de database structuur van privatemessages eens.
*edit*
De eerste ufetch staat nu na de else, anders gaat het een error geven.
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]submit[/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 users WHERE username = "[/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]username[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/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]$uQuery[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<div id="error">Dit lid bestaat niet!</div>[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
[COLOR= #0000BB]$uFetch[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][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]"UPDATE users SET waarschuwing = waarschuwing+"[/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]erbij[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]" WHERE id = "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$uFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO waarschuwingen (userid, reden, procenten) VALUES ("[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$uFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]", "[/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]reden[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]", "[/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]erbij[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]")"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
[COLOR= #0000BB]$refmessage[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]Hoi,<br />
<br />
Zojuist heb je een waarschuwing ontvangen, met de volgende reden:<br />
<b>[/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]reden[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]</b><br />
<br />
Je krijgt hierdoor <b>[/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]erbij[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]%</b> bij je waarschuwingsniveau.<br />
Als jij 100% krijgt dan krijg jij een permanente ban!<br />
<br />
Groeten,<br />
meljel2[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO privatemessages VALUES (
NULL,
1,
"[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$uFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]",
"[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$refmessage[/COLOR][COLOR= #007700]) .[/COLOR] [COLOR= #DD0000]",
0,
NOW(),
Waarschuwing (+"[/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]erbij[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]"%)
);
"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<div id="succes">Waarschuwingsniveau toegevoegd!</div>[/COLOR][COLOR= #007700];
}
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
?>
<br />
Geef hieronder de gebruikersnaam in van de gebruiker die je een waarschuwing wilt geven.<br /><br />
<form method="post" action="?p=admin_warning">
<table style="border: 0;">
<tr>
<td style="width: 210px;">
Gebruikersnaam:
</td>
<td>
<input type="text" name="username" />
</td>
</tr>
<tr>
<td style="width: 210px;">
Waarschuwingsniveau erbij doen:
</td>
<td>
<input type="text" name="erbij" />
</td>
</tr>
<tr>
<td style="width: 210px;">
Reden:
</td>
<td>
<input type="text" name="reden" />
</td>
</tr>
</table><br /><br />
<input type="submit" name="submit" value="Geef waarschuwingsniveau" />
</form>
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]}[/COLOR]
?> toevoeging op 29 februari 2012, 21:01:06:
Aarclay schreef:Daar geven ze ook zon mooie error als de database niet werkt en dat is dus niet met error reporting. Maar daar gaat het niet over, dus ga even weer on topic. Die is niet slecht, ik gebruik het ook niet maar als je het leuk vindt dan moet je het gewoon gebruiken.Hoe bedoel je, zoals op Youtube?
Alemaalte schreef:Ik heb het al iets mooier uitgelijnd want man wat een bagger script.
Anyway het zit hem wss in die or die dus export de database structuur van privatemessages eens.
*edit*
De eerste ufetch staat nu na de else, anders gaat het een error geven.
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]submit[/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 users WHERE username = "[/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]username[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/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]$uQuery[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<div id="error">Dit lid bestaat niet!</div>[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
[COLOR= #0000BB]$uFetch[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][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]"UPDATE users SET waarschuwing = waarschuwing+"[/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]erbij[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]" WHERE id = "[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$uFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]""[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO waarschuwingen (userid, reden, procenten) VALUES ("[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$uFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]", "[/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]reden[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]", "[/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]erbij[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]")"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
[COLOR= #0000BB]$refmessage[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #DD0000]Hoi,<br />
<br />
Zojuist heb je een waarschuwing ontvangen, met de volgende reden:<br />
<b>[/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]reden[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]</b><br />
<br />
Je krijgt hierdoor <b>[/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]erbij[/COLOR][COLOR= #007700]]).[/COLOR][COLOR= #DD0000]%</b> bij je waarschuwingsniveau.<br />
Als jij 100% krijgt dan krijg jij een permanente ban!<br />
<br />
Groeten,<br />
meljel2[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO privatemessages VALUES (
NULL,
1,
"[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$uFetch[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]",
"[/COLOR] [COLOR= #007700].[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$refmessage[/COLOR][COLOR= #007700]) .[/COLOR] [COLOR= #DD0000]",
0,
NOW(),
Waarschuwing (+"[/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]erbij[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]"%)
);
"[/COLOR][COLOR= #007700])[/COLOR] or [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700]());[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<div id="succes">Waarschuwingsniveau toegevoegd!</div>[/COLOR][COLOR= #007700];
}
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
?>
<br />
Geef hieronder de gebruikersnaam in van de gebruiker die je een waarschuwing wilt geven.<br /><br />
<form method="post" action="?p=admin_warning">
<table style="border: 0;">
<tr>
<td style="width: 210px;">
Gebruikersnaam:
</td>
<td>
<input type="text" name="username" />
</td>
</tr>
<tr>
<td style="width: 210px;">
Waarschuwingsniveau erbij doen:
</td>
<td>
<input type="text" name="erbij" />
</td>
</tr>
<tr>
<td style="width: 210px;">
Reden:
</td>
<td>
<input type="text" name="reden" />
</td>
</tr>
</table><br /><br />
<input type="submit" name="submit" value="Geef waarschuwingsniveau" />
</form>
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]}[/COLOR]
?> toevoeging op 29 februari 2012, 21:01:06:
Aarclay schreef:Daar geven ze ook zon mooie error als de database niet werkt en dat is dus niet met error reporting. Maar daar gaat het niet over, dus ga even weer on topic. Die is niet slecht, ik gebruik het ook niet maar als je het leuk vindt dan moet je het gewoon gebruiken.Hoe bedoel je, zoals op Youtube?
Nu werkt hij! Bedankt.
Ik heb helemaal niets veranderd, ben je zeker dat je mijn eerste script wel hebt uitgeprobeerd? 

Alemaalte schreef:Werk je bij Youtube? Heb je hun code ooit eens gezien?Daar geven ze ook zon mooie error als de database niet werkt en dat is dus niet met error reporting. Maar daar gaat het niet over, dus ga even weer on topic. Die is niet slecht, ik gebruik het ook niet maar als je het leuk vindt dan moet je het gewoon gebruiken.Eerdere citaten tonen
Aarclay schreef:Hoe bedoel je, zoals op Youtube?
Hoe weet je zeker dat het zo is wat je nu vertelt?
Iets met een klok en een klepel?
Het is maar een ideeeee hoor.
maar je zou dit kunnen beveiligen :http://thahab.nl/index.php?p=admin_warning
maar je zou dit kunnen beveiligen :http://thahab.nl/index.php?p=admin_warning