Hello everyone,

I am doing a login form in ExtJS + PHP, but it does not work. (authentication failed each time) . Here's the code:

ExtJS part:

<script type=text/javascript>
    Ext.onReady(function() {
        var loginForm = new Ext.FormPanel({
            url: 'login.php',
			title: 'Login to goodTalk',
            bodyStyle:'padding:5px 5px 0',
            width: 252,
            renderTo: 'innermost',
            items: [{
				xtype: 'box',
				autoEl: {
					html: "<div id='login-text'><h1>We don't want any!!!</h1></div>"
				xtype: 'textfield',
				fieldLabel: 'User',
				name: 'user',
				allowBlank: false
				xtype: 'textfield',
				fieldLabel: 'Password',
				name: 'password',
				allowBlank: false,
				inputType: 'password'
			buttons: [{
				text: 'Login',
				handler: function() {
						//clientValidation: true,
						success: function() {
							Ext.Msg.alert('Good', 'Logged');
						failure: function() {
							Ext.Msg.alert('Warning', 'Could not log');

and PHP part:




mysql_connect($dbhost,$dbuser,$dbpass) or die(mysql_error());
mysql_selectdb($db) or die(mysql_error());

$query="SELECT * FROM accounts WHERE name='$user' AND password='$password'";
$result=mysql_query($query) or die (mysql_error());

    echo "{success: true}";
    echo "{success: false}";

Yeah i know, SQL entry isn't sanitized, but i'm not really into that right now. Could somebody please tell me why it's not working? Also, i am looking forward to extending the project further, what else functionality should i add beside SQL sanitizing ?

Update: IT WORKS !!!
I was loading the file NOT from the server, how clumsy of me !!!
Thank you anyway !

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.