Instead of returning "Yes" or "No" just return "secure content" and
place it into your DIV
Because imagine someone has got css disabled that means they can see
your hidden divs
--K
Massimiliano Marini wrote:
Hi all, someone knows or has realized an authentication form calling a
external PHP file for the authentication, in order to remain to the
inside of the main page (index.php)
All I want realize is this, when I click on submit, I call the
login.php file that control user and password. What I must give back in
both of case?
I've posted my solution, it works, but I'm not sure of it, may be
there's a better way, more secure.
Any idea, suggestions, code, corrections are welcome.
My code in index.php
$(document).ready(function(){
$('#formLogIn').ajaxForm({
success: showResponse
});
function showRequest(formData, jqForm, options) {
var queryString = $.param(formData);
alert(queryString);
return true;
}
function showResponse(responseText, statusText) {
if(responseText == "Yes") {
// Show/Hide DIV, I'no not problem to implement that :)
}
if(responseText == "No") {
alert("It does not exist");
}
}
<form id="formLogIn" method="post" action="login.php">
Username : <input id="u" type="text" name="username" />
Password : <input id="p" type="password" name="password" />
<input id="submit" type="submit" name="submit" value="Entra" />
</form>
login.php contains a simple query to a DB and returns :
echo "Yes" // if exists
echo "No" // if not exists
--
Massimiliano Marini - http://www.linuxtime.it/massimilianomarini/
"It's easier to invent the future than to predict it." -- Alan Kay
--
Kush Murod, Web applications developer
Sensory Networks
[E] [EMAIL PROTECTED]
[W] www.sensorynetworks.com
[T] +61 2 8302 2745
[F] +61 2 9475 0316
[A] Level 6, 140 William Street East Sydney 2011
=================================================================
This message is confidential and is intended for the listed
recipients only. Any use of this message by persons other than
the listed recipients is prohibited. If you are not on the
recipients list, please notify the sender and delete this
message immediately.
=================================================================
EMAIL NOTICE: This message and any attachment(s) may contain confidential
information and may be subject to copyright or other intellectual property
protection. If you are not the intended recipient, you are not authorized to
use, disclose, distribute or copy any part of this message including
attachment(s). If you have received this message in error, please notify the
sender immediately and delete all copies. Any views expressed in this message
are those of the individual sender and not necessarily that of the company.
Before opening any attachment(s), please check for viruses and other defects.