Heey,
Ik heb hier een probleem met mijn ajax/jquery login form:
letsweb.nl/systemen/overzicht/
Demo:
test
test
Het probleem is dat de ingevoerde gegevens altijd fout zijn.
ajax_login.php
Ik heb hier een probleem met mijn ajax/jquery login form:
letsweb.nl/systemen/overzicht/
Demo:
test
test
Het probleem is dat de ingevoerde gegevens altijd fout zijn.
ajax_login.php
[COLOR= #0000BB]<?php[/COLOR]
[URL="http://www.php.net/require_once"]require_once[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]./includes/connect.php[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #FF8000]//get the posted values[/COLOR]
[COLOR= #0000BB]$user_name[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]user_name[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$pass[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #FF8000]//now validating the username and password[/COLOR]
[COLOR= #0000BB]$sql[/COLOR][COLOR= #007700]=[/COLOR][COLOR= #DD0000]"SELECT email, wachtwoord FROM LWCMS_accounts WHERE email="[/COLOR][COLOR= #007700].[/COLOR][URL="http://www.php.net/mysql_real_escape_string"]mysql_real_escape_string[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$user_name[/COLOR][COLOR= #007700]).[/COLOR][COLOR= #DD0000]""[/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= #0000BB]$sql[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #0000BB]$row[/COLOR][COLOR= #007700]=[/COLOR][URL="http://www.php.net/mysql_fetch_array"]mysql_fetch_array[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$result[/COLOR][COLOR= #007700]);[/COLOR]
[COLOR= #FF8000]//if username exists[/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]$result[/COLOR][COLOR= #007700])>[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700])
{[/COLOR]
[COLOR= #FF8000]//compare the password[/COLOR]
[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/strcmp"]strcmp[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$row[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]password[/COLOR][COLOR= #007700]],[/COLOR][COLOR= #0000BB]$pass[/COLOR][COLOR= #007700])==[/COLOR][COLOR= #0000BB]0[/COLOR][COLOR= #007700])
{[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"yes"[/COLOR][COLOR= #007700];[/COLOR]
[COLOR= #FF8000]//now set the session from here if needed[/COLOR]
[COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]email[/COLOR][COLOR= #007700]]=[/COLOR][COLOR= #0000BB]$user_name[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"no"[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"no"[/COLOR][COLOR= #007700];[/COLOR] [COLOR= #FF8000]//Invalid Login[/COLOR]
?>
ophaalt..
