I've two forms: (login form, register form) plus they posted to my component.

Login form: I wish to check login and pass and hang status to "drenched" in joomla.

Register form: I would like register new user in joomla.

How to get it done?

$inplogin = JRequest::getVar('inplogin');
$inppass = JRequest::getVar('inppass');

???? JFactory::login($inplogin, $inppass); ????

???? JFactory::registeruser($inplogin, $inppass); ????


For Login

$result = JFactory::getApplication()->login(array('username'=>$username, 'password'=>$password));

For Registration

require_once  JPATH_ROOT.DS.'components'.DS.'com_users'.DS.'models'.DS.'registration.php';
$model = new UsersModelRegistration();

// Attempt to save the data.
$username = ; //your user name here
$password = ; //your password here
$data = array(  'username'=>$email,'name'=>$email,'email1'=>$email,'password1'=>$password, 'password2'=>$password, 'block'=>1 );
$return = $model->register($data);

I do not observe how this really is related particularly to joomla.

you should utilize exactly the same $_SESSION variable in the two cases. once you declare the variable, you should check on the start of your index page if the var is available (and when so, if the qualifications are correct or otherwise). something similar to:

    if (!isset($_SESSION['logged']) {

you should use JUser::bind($userData) and JUser::save($userData) for signing up the consumer.