Er zit geen xss lek in dat script????
Kleine Vragen Topic #2
Ik snap niet waarom mijn script deze error aangeeft terwijl hij op mijn andere site wel gewoon werkt;
Quote:
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /SITE on line 12
Quote:
Warning: mysql_fetch_assoc() expects parameter 1 to be resource, boolean given in /SITE on line 12
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/include"]include[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]../config.php[/COLOR][COLOR= #007700]);[/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/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]inlog[/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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]]) ||[/COLOR] [URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]])) {[/COLOR]
[COLOR= #0000BB]$gebruikersnaam[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]gebruikersnaam[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$wachtwoord[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$aQuery[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT id, gebruikersnaam, wachtwoord, status FROM admin WHERE
gebruikersnaam = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$gebruikersnaam[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000]" AND
wachtwoord = "[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$wachtwoord[/COLOR][COLOR= #007700])).[/COLOR][COLOR= #DD0000]""[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$aFetch[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_fetch_assoc"]mysql_fetch_assoc[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$aQuery[/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]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]inlog[/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]$aQuery[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #DD0000]0[/COLOR][COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<div id="rood">Er klopt iets niet aan uw gegevens!<br />[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]<a href="javascript:javascript:history.go(-1)">Terug</a></div>[/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]gebruikersnaam[/COLOR][COLOR= #007700]]) ||[/COLOR] [URL="http://www.php.net/empty"]empty[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]wachtwoord[/COLOR][COLOR= #007700]]))
{[/COLOR]
[URL="http://www.php.net/Echo"]Echo[/URL] [COLOR= #DD0000]<div id="rood">U bent vergeten iets in te vullen![/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/Echo"]Echo[/URL] [COLOR= #DD0000]<a href="javascript:javascript:history.go(-1)">Terug</a><Br />[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/Echo"]Echo[/URL] [COLOR= #DD0000]<META HTTP-EQUIV="Refresh" CONTENT="3; URL=inloggen"></div>[/COLOR][COLOR= #007700];
}[/COLOR][URL="http://www.php.net/else"]else[/URL][COLOR= #007700]{[/COLOR]
[COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]inlog[/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]gebruikersnaam[/COLOR][COLOR= #007700]]);[/COLOR]
[URL="http://www.php.net/Echo"]Echo[/URL] [COLOR= #DD0000]<div id="groen">Welkom, [/COLOR][COLOR= #007700].[/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]inlog[/COLOR][COLOR= #007700]].[/COLOR][COLOR= #DD0000]. U bent succesvol ingelogd!</div>[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/Echo"]Echo[/URL] [COLOR= #DD0000]<META HTTP-EQUIV="Refresh" CONTENT="2; URL=index">[/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 action="#" method="post">
Gebruikersnaam:<br />
<input type="gebruikersnaam" name="gebruikersnaam" /><br /><br />
Wachtwoord:<br />
<input type="password" name="wachtwoord"/><br /><br />
<input type="submit" name="inlog" value="Inloggen" /><br /></form><br />[/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]U bent al ingelogd!<br />[/COLOR][COLOR= #007700];[/COLOR]
[URL="http://www.php.net/Echo"]Echo[/URL] [COLOR= #DD0000]<a href="javascript:javascript:history.go(-1)">Terug</a><Br />[/COLOR][COLOR= #007700];
}[/COLOR]
?> er zit een fout in je query. Als je aan foutafhandeling deed, zou je dat makkelijk kunnen opgelost hebben.
- Verkeerde formulier controle
- Missense foutafhandeling
- empty () is onpraktisch: if(trim($var)="") {
- metatags staan verkeerd....
Breken de boel
- Missense foutafhandeling
- empty () is onpraktisch: if(trim($var)="") {
- metatags staan verkeerd....
Breken de boel

Dylanh schreef:Huh? Zeg ik dat?Er zit geen xss lek in dat script????
Sanderc schreef:Ik denk dat hij doelt op het plaintext html elementHuh? Zeg ik dat?Eerdere citaten tonen
Dylanh schreef:Er zit geen xss lek in dat script????
Quote:
Ik heb nog geen beveiliging tegen plaintext toegevoegd, dat zal samen met de database in de volgende versie wel komen
Rogier schreef:Ja. ik zou het net zeggen.Ik denk dat hij doelt op het plaintext html elementEerdere citaten tonen
Sanderc schreef:Huh? Zeg ik dat?Eerdere citaten tonen
Dylanh schreef:Er zit geen xss lek in dat script????
Quote:
Ik heb nog geen beveiliging tegen plaintext toegevoegd, dat zal samen met de database in de volgende versie wel komen
Is er nog een lek waar tegen ik moet beveiliggen?
In dat script niet.
Dylanh schreef:Nice, maar misschien als ik morgen met de database werk wel...In dat script niet.
Maar weet iemand ongeveer hoe als ik een tabel users heb met de kollomen
TABEL USERS
kollomen:
username
password
hoe kan ik dan kijken of de opgegeven combinatie in de input in de database staat?
Sanderc schreef:Controleren of de input gelijk is aan de gegevens in db?Nice, maar misschien als ik morgen met de database werk wel...Eerdere citaten tonen
Dylanh schreef:In dat script niet.
Maar weet iemand ongeveer hoe als ik een tabel users heb met de kollomen
TABEL USERS
kollomen:
username
password
hoe kan ik dan kijken of de opgegeven combinatie in de input in de database staat?
Dylanh schreef:Ja maar hoe, heb je een klein voorbeeldscriptje of een link naar waar het correct wordt uitgelegt, in mysqli?Controleren of de input gelijk is aan de gegevens in db?Eerdere citaten tonen
Sanderc schreef:Nice, maar misschien als ik morgen met de database werk wel...Eerdere citaten tonen
Dylanh schreef:In dat script niet.
Maar weet iemand ongeveer hoe als ik een tabel users heb met de kollomen
TABEL USERS
kollomen:
username
password
hoe kan ik dan kijken of de opgegeven combinatie in de input in de database staat?

Ik ga binnenkort proberen een Minecraft bestel scriptje te maken. Het gaat werken met saldo en de one2xs API...
Iemand interesse?
Iemand interesse?

