Nou waar denk je dat $_SERVER[REQUEST_METHOD] == "POST" zou moeten? ;p
Op een pagina waar geen formulier naar wordt verstuurd? Ja logisch
Op een pagina waar geen formulier naar wordt verstuurd? Ja logisch
Robbertb schreef:Ten derde is dit forum bedoeld om vragen te stellen als je ergens niet uitkomt. En ben ik na al je stappen nog weinig verder dan een controle die iets controleert dat ik al wist voordat ik hiermee begon.
True, ik geef je ook adviezen, maar zie het meer als een advies naar de goede richting. Ik ga niet alles voorkauwen, dus als je het nog niet snapt, vraag door, laat zien dat je er wat mee doet en gebruik je motivatie ook eens door eens Google af te speuren.
Quote:
Ten vierde wordt in 9 van de 10 tutorials gewoon die gebruikt en kraak jij dat vierkant af en wijs je naar een site met tutorials waar ook gewoon die nog wordt gebruikt.
het is en blijft fout, die() gebruik je niet. ALs 9/10 tutorials dat gebruiken zullen ze meer op de werking van het script doelen, en verwachten dat mening mens wel snapt dat die() fout is. Het blijven dan foute tutorials. die() stopt je hele script, wat je vaak nooit wilt.
Ik weet niet of je het hoofdstuk over if-else van je PHP-boek wel eens hebt doorgenomen, waar zo goed als altijd wordt het verschil tussen die() en statements uitgelegd.
Quote:
Ten vijfde als jij op school of werk weet niet hoe oud je bent of wat wat doet en het lukt niet stop je toch ook niet en zeg je tegen je baas of leraar. Dit is kan ik niet.
Vage zin? Sorry, gebruik eens wat interpuncties.
Quote:
En verder kom je met dingen aan zoals:
Anyway. kijk eens naar je kleurtjes in je codeblok.
Ja fantastisch ik weet dat er verschillende kleuren zijn. Wil jij ook nog is wat zien

[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]# errors weergeven[/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] [COLOR= #FF8000]// 1 == aan , 0 == uit[/COLOR]
[URL="http://www.php.net/error_reporting"]error_reporting[/URL][COLOR= #007700]([/COLOR]E_ALL [COLOR= #007700]|[/COLOR] E_STRICT[COLOR= #007700]);[/COLOR]
[COLOR= #FF8000]# sql debug[/COLOR]
[URL="http://www.php.net/define"]define[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]DEBUG_MODE[/COLOR][COLOR= #007700],[/COLOR]false[COLOR= #007700]);[/COLOR] [COLOR= #FF8000]// true == aan, false == uit
# functie voor sql debug[/COLOR]
[COLOR= #007700]function[/COLOR] showSQLError[COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$error[/COLOR][COLOR= #007700],[/COLOR][COLOR= #0000BB]$text[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]Error[/COLOR][COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR]DEBUG_MODE[COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/return"]return[/URL] [COLOR= #DD0000]FORUMCODE0[/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]$text[/COLOR][COLOR= #007700];
}
}[/COLOR]
[URL="http://www.php.net/session_start"]session_start[/URL][COLOR= #007700]();[/COLOR]
[COLOR= #0000BB]$username[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]];[/COLOR]
[URL="http://www.php.net/mysql_connect"]mysql_connect[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]"xxx"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/mysql_select_db"]mysql_select_db[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"a8976410_Site"[/COLOR][COLOR= #007700]) ;[/COLOR]
[COLOR= #0000BB]$result[/COLOR][COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM users WHERE username=$username"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700](([/COLOR][COLOR= #0000BB]$result_get_user[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700])) ===[/COLOR] false[COLOR= #007700]) {[/COLOR]
[COLOR= #FF8000]// de query is niet gelukt. Toon een error.[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] showSQLError[COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700],[/COLOR][URL="http://www.php.net/mysql_error"]mysql_error[/URL][COLOR= #007700](),[/COLOR][COLOR= #DD0000]Fout met het ophalen van de gebruiker.[/COLOR][COLOR= #007700]);
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[COLOR= #FF8000]// de query is wel gelukt[/COLOR]
[COLOR= #0000BB]$result1[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700]);[/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]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]]))
{[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$result1[/COLOR][COLOR= #007700]==[/COLOR][COLOR= #0000BB]1[/COLOR][COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"test"[/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]"Welcome, "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"! <br><a href= logout.php>Log out</a><br><a href=changepassword.php>Change password</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]"You must be logged in!"[/COLOR][COLOR= #007700];
}[/COLOR]
[COLOR= #FF8000]// plaats hier het vervolg, kijk bijv. met mysql_num_rows() of het item bestaat, en gebruik hier bijv. ook een if-else statement voor.[/COLOR]
[COLOR= #007700]}[/COLOR]
?> Error: [/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$error[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000]
[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700].[/COLOR] [COLOR= #DD0000];$username = $_SESSION[username]; if(!($_SERVER[REQUEST_METHOD]=="POST")){ [COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]]==[/COLOR][COLOR= #DD0000]"POST"[/COLOR][COLOR= #007700]){[/COLOR]
[COLOR= #FF8000]// verstuurd[/COLOR]
[COLOR= #007700]}[/COLOR] [URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[COLOR= #FF8000]// formulier[/COLOR]
[COLOR= #007700]}[/COLOR]
?> [COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/session_start"]session_start[/URL][COLOR= #007700]();[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]])[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Welcome, "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"! <br><a href= logout.php>Log out</a><br><a href=changepassword.php>Change password</a>"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[URL="http://www.php.net/die"]die[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]"You must be logged in!"[/COLOR][COLOR= #007700]);[/COLOR]
?> [COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/session_start"]session_start[/URL][COLOR= #007700]();[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]])[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Welcome, "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"! <br><a href= logout.php>Log out</a><br><a href=changepassword.php>Change password</a>"[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"You must be logged in!"[/COLOR][COLOR= #007700];[/COLOR]
?> [COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/session_start"]session_start[/URL][COLOR= #007700]();[/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]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]])) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Welcome, "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]"! <br><a href= logout.php>Log out</a><br><a href=changepassword.php>Change password</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]"You must be logged in!"[/COLOR][COLOR= #007700];
}[/COLOR]
?> 