neeee dat moet je gewoon niet willen
Kleine Vragen Topic #1
Lennard schreef:Je moet het niet willen, maar het kan wel.neeee dat moet je gewoon niet willen
Wat is er fout aan dit stuk script?
errors:
Notice: Undefined index: id in C:xampphtdocsbootstrapincconfig.php on line 12
Notice: Undefined index: id in C:xampphtdocsbootstrapregister.php on line 12
Notice: Undefined index: username in C:xampphtdocsbootstrapregister.php on line 13
Notice: Undefined index: email in C:xampphtdocsbootstrapregister.php on line 14
[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/session_start"]session_start[/URL][COLOR= #007700]();[/COLOR] ?>
<!DOCTYPE html>
<html>
<head>
<title>Sykle Control Panel - New account!</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="css/bootstrap.min.css" rel="stylesheet" media="screen">
</head>
<body>
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]inc/config.php[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]id[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]] =[/COLOR] [URL="http://www.php.net/strtolower"]strtolower[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]]);[/COLOR]
[COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]] =[/COLOR] [URL="http://www.php.net/strtolower"]strtolower[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]]);[/COLOR]
[COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]] =[/COLOR] htmlentities[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]]);[/COLOR]
[COLOR= #0000BB]$IPCheckQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM user_users WHERE IP="[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/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]$UserCheckQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM user_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]" LIMIT 1"[/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][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REQUEST_METHOD[/COLOR][COLOR= #007700]]==[/COLOR][COLOR= #DD0000]"POST"[/COLOR][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]$IPCheckQuery[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<font color=red>Ow, you can only have 1 account.</font><br />"[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]]) <[/COLOR] [COLOR= #0000BB]3[/COLOR][COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<font color=red>Your username must contain more than 3 characters.</font><br />"[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]]) >[/COLOR] [COLOR= #0000BB]12[/COLOR][COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<font color=red>Your username cant contain more than 12 characters.</font><br />"[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700](![/COLOR][URL="http://www.php.net/preg_match"]preg_match[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]/^[a-z0-9]+$/i[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]]) ) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<font color=red>Dont use wierd characters in your username.</font><br />"[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/elseif"]elseif[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$UserCheckQuery[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<font color=red>Ow, that username is already in use!</font><br />"[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]])) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<font color=red>Please, fill in a email adress!</font><br />"[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700](![/COLOR]filter_var[COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]],[/COLOR] FILTER_VALIDATE_EMAIL[COLOR= #007700])) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<font color=red>Your email adress is not correct!</font><br />"[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/elseif"]elseif[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]] !=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password2[/COLOR][COLOR= #007700]]) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<font color=red>The passwords doesnt match!</font><br />"[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/elseif"]elseif[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]]) <[/COLOR] [COLOR= #0000BB]4[/COLOR][COLOR= #007700]) {[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"<font color=red>The password must contain more than 4 characters.</font><br />"[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
[COLOR= #0000BB]$password[/COLOR][COLOR= #007700]=[/COLOR]hash[COLOR= #007700]([/COLOR]sha512[COLOR= #007700],[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]]);[/COLOR]
[URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO user_users (username,password,email,IP,rang,banned) VALUES ("[/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][COLOR= #0000BB]$password[/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]email[/COLOR][COLOR= #007700]]) .[/COLOR] [COLOR= #DD0000]", "[/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]", 0, 0)"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"success!"[/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]
<form class="well" action="" method="POST">
<input type="text" name="username" placeholder="Username.." /><br />
<input type="text" name="email" placeholder="Email.." /><br />
<input type="password" name="password" placeholder="Password.." /><br />
<input type="password" name="password2" placeholder="Confirm password.." /><br />
<button class="btn btn-info">Next..</button>
</form>[/COLOR][COLOR= #007700];
}[/COLOR]
?>
<script src="http://code.jquery.com/jquery.js"></script>
<script src="js/bootstrap.min.js"></script>
</body>
</html> errors:
Notice: Undefined index: id in C:xampphtdocsbootstrapincconfig.php on line 12
Notice: Undefined index: id in C:xampphtdocsbootstrapregister.php on line 12
Notice: Undefined index: username in C:xampphtdocsbootstrapregister.php on line 13
Notice: Undefined index: email in C:xampphtdocsbootstrapregister.php on line 14
Die variabelen hebben geen waarde op dit moment. Je moet ook controleren of je formulier verstuurd is....
if($_SERVER[REQUEST_METHOD]=="POST") {
Wat wil je met lijn 12 doen?
if($_SERVER[REQUEST_METHOD]=="POST") {
Wat wil je met lijn 12 doen?
Aarclay schreef:euhm..Die variabelen hebben geen waarde op dit moment. Je moet ook controleren of je formulier verstuurd is....
if($_SERVER[REQUEST_METHOD]=="POST") {
Wat wil je met lijn 12 doen?

Maar dit heb ik toch al?
if($_SERVER[REQUEST_METHOD]=="POST") { Niet op de goede plek. ... 

Volgens mij bestaat de sessie ook niet?
Beste Leden ,
Ik heb het volgende
tabel "forum_cat" :
Quote:
------
id |
------
tabel "forum_topics" :
Quote:
-------------
id | cat |
-------------
tabel "forum_reacties" :
Quote:
-------------------------
id | topic_id | time |
-------------------------
nu is het de bedoeling dat hij bij bijvoorbeeld categorie 2 de laatste reactie haalt uit het topics met de categorie 2
Iemand een idee hoe ik dit kan oplossen?
Ik heb het volgende
tabel "forum_cat" :
Quote:
------
id |
------
tabel "forum_topics" :
Quote:
-------------
id | cat |
-------------
tabel "forum_reacties" :
Quote:
-------------------------
id | topic_id | time |
-------------------------
nu is het de bedoeling dat hij bij bijvoorbeeld categorie 2 de laatste reactie haalt uit het topics met de categorie 2
Iemand een idee hoe ik dit kan oplossen?
Iets van
Ben nu beetje slaperig, wss is die fout.
SELECT forum_reacties.text FROM forum_reacties, forum_topics WHERE forum_topics.cat = 2 AND forum_reacties.topic_id = forum_topics.id ORDER BY forum_reacties.time DESC Ben nu beetje slaperig, wss is die fout.
Ik zou de boel denormaliseren en cat_id ook in je reactietabel zetten. Is niet zoals het officieel hoort maar scheelt wel in snelheid.
Als je gaat normaliseren waarom niet gelijk bij een bericht plaatsen een update query in de forum_cat?
Bij bericht plaatsen/aanpassen en topic plaatsen vind ik dat er best een extra query gedraaid mag worden.
Bij bericht plaatsen/aanpassen en topic plaatsen vind ik dat er best een extra query gedraaid mag worden.
Rogier schreef:Bij bericht plaatsen/aanpassen en topic plaatsen vind ik dat er best een extra query gedraaid mag worden.Als je gaat normaliseren waarom niet gelijk bij een bericht plaatsen een update query in de forum_cat?
Ooh met een last_post_id ofzo, dat is nog handiger inderdaad als je dit doel wil bereiken.
Lennard schreef:je kan toch ook aan topic tijd mee geven waarneer laadt gereageerd in is ?Bij bericht plaatsen/aanpassen en topic plaatsen vind ik dat er best een extra query gedraaid mag worden.Eerdere citaten tonen
Rogier schreef:Als je gaat normaliseren waarom niet gelijk bij een bericht plaatsen een update query in de forum_cat?
Ooh met een last_post_id ofzo, dat is nog handiger inderdaad als je dit doel wil bereiken.
Ja, maar als je ooit veel topics hebt dan moet je per categorie alle topics sorteren op laatste reactiedatum, en dat duurt veel langer dan even de last_post_id ophalen en daarmee het topic opzoeken.
Lennard schreef:Ik wil het ook niet in mijn eigen code maar als je de naam van je kolom niet wil veranderen dan is dit een optieneeee dat moet je gewoon niet willen