Since I spent so much time on it and since the original thread got a bit rich, here's a summary of how to do a simple username/password login form with the new JINPUT method suggested by Joomla.org.
Needless to say the entire credit goes to troester for making it work, I'm just writing it up.
The complication is that you need to grab onscreen data and validate other onscreen against it.
This used to be a case for JRequest::getvar() but this is now deprecated and no longer encouraged by the Joomla team it seems.
So if in t1 in MySQL you have two fields `username` and `password` and on the login form (with 2 elements 'your_name' and 'pass_word') you wanted to validate that the user has entered the correct password, you would go:
Where the last line (that I wasn't getting) compares your database pull with '$data' which is the current field's onscreen input.
You could additionally validate that the username exists in the first place and there's another working code snippet here:
http://fabrikar.com/forums/showthread.php?t=29403
of which you would be using the first part. You can figure it out.
Thanks
Needless to say the entire credit goes to troester for making it work, I'm just writing it up.
The complication is that you need to grab onscreen data and validate other onscreen against it.
This used to be a case for JRequest::getvar() but this is now deprecated and no longer encouraged by the Joomla team it seems.
So if in t1 in MySQL you have two fields `username` and `password` and on the login form (with 2 elements 'your_name' and 'pass_word') you wanted to validate that the user has entered the correct password, you would go:
Code:
$jinput = JFactory::getApplication()->input;
$us = $jinput->get('t1___your_name');
$db = &JFactory::getDBO();
$db->setQuery(" SELECT `password` FROM `t1`
WHERE `username` = '$us'");
$pass = $db->loadResult();
return $data==$pass;
You could additionally validate that the username exists in the first place and there's another working code snippet here:
http://fabrikar.com/forums/showthread.php?t=29403
of which you would be using the first part. You can figure it out.
Thanks