Hey,
Ik ben bezig met een eigen website te maken, alles zelf gescript. Maar dat is dan ook echt de eerste keer,
En ik ben nu bezig met een login script, maar ik krijg een error.
Ik werk met PHPDesigner 7, dat zelf geen error ingeeft.
Maar op mijn host als ik test krijg ik de error:
SELECT * FROM users WHERE username=sem AND password=random
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/deluxhost/domains/deluxhost.s3.one2xs.com/public_html/One2Uploads/login.php on line 23
random
Nadat ik wou inloggen.
Ik moest mijn wachtwoord (random) in md5 formaat crypten, normaal als je je gegevens (iets randoms
) ingeeft, krijg je een code met je encrypted wachtwoord,
Nu krijg ik die error.
Line 23:
Ik snap de fout niet..
edit:
hele script:
Ik ben bezig met een eigen website te maken, alles zelf gescript. Maar dat is dan ook echt de eerste keer,
En ik ben nu bezig met een login script, maar ik krijg een error.
Ik werk met PHPDesigner 7, dat zelf geen error ingeeft.
Maar op mijn host als ik test krijg ik de error:
SELECT * FROM users WHERE username=sem AND password=random
Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/deluxhost/domains/deluxhost.s3.one2xs.com/public_html/One2Uploads/login.php on line 23
random
Nadat ik wou inloggen.
Ik moest mijn wachtwoord (random) in md5 formaat crypten, normaal als je je gegevens (iets randoms
) ingeeft, krijg je een code met je encrypted wachtwoord,Nu krijg ik die error.
Line 23:
$rowcount = mysql_num_rows(mysql_query($login)); Ik snap de fout niet..
edit:
hele script:
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/require"]require[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"connect.php"[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$post_username[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]username[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$post_password[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]];[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$post_username[/COLOR][COLOR= #007700]&&[/COLOR][COLOR= #0000BB]$post_password[/COLOR][COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$post_username[/COLOR][COLOR= #007700])>[/COLOR][COLOR= #0000BB]25[/COLOR][COLOR= #007700]||[/COLOR][URL="http://www.php.net/strlen"]strlen[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$post_password[/COLOR][COLOR= #007700])>[/COLOR][COLOR= #0000BB]35[/COLOR][COLOR= #007700])[/COLOR]
[URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"Username or password character length too long!"[/COLOR][COLOR= #007700]);[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
[COLOR= #FF8000]//convert password to md5[/COLOR]
[URL="http://www.php.net/md5"]md5[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$post_password[/COLOR][COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$post_password[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #FF8000]//query the database[/COLOR]
[COLOR= #0000BB]$login[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/printf"]printf[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT * FROM users WHERE username=%s AND password=%s"[/COLOR][COLOR= #007700],[/COLOR] [URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$post_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_password[/COLOR][COLOR= #007700]));[/COLOR]
[COLOR= #0000BB]$rowcount[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$login[/COLOR][COLOR= #007700]));[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #0000BB]$post_password[/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]"Username and Password required!"[/COLOR][COLOR= #007700]);[/COLOR]
?> 
