이 시도 제출을,
제출 페이지가 joomla 프레임 워크 외부의 joomla의 일부가 아니라고 가정합니다.
1 단계 :
Include Joomla Frame work
define('_JEXEC', 1);
define('JPATH_BASE', dirname(__FILE__));//this is when we are in the root
define('DS', DIRECTORY_SEPARATOR);
require_once (JPATH_BASE .DS.'includes'.DS.'defines.php');
require_once (JPATH_BASE .DS.'includes'.DS.'framework.php');
$mainframe = JFactory::getApplication('site');
$mainframe->initialise();
$db = JFactory::getDBO();
2 단계 : 확인 사용자 이름이 이미 DB에 존재 : 3
Collect your Form fields data.
//Something like $user_email ,$password etc.
단계.
$sql ="SELECT * FROM #__users WHERE username ='$username'";
$db->setQuery($sql);
$db->query();
if($db->getNumRows()>0){
$mainframe->redirect("url","error msg","error");
}
else{
jimport('joomla.user.helper');
$salt = JUserHelper::genRandomPassword(32);
$crypt = JUserHelper::getCryptedPassword($password, $salt);
$password = $crypt.':'.$salt;
//Data to login table
$sql= "INSERT INTO #__users(username,email,lastvisitDate,registerDate,block,sendEmail,password,name,params,) values('$user_email','$user_email','$now','$now',0,0,'$password','$full_name','{}')";
$db->setQuery($sql);
$db->query();
$last_inserted_id = $db->insertid();
//User group tabe normally group id for registered user is 2 other wise you have to check that too
$sql= "INSERT INTO #__user_usergroup_map(user_id,group_id) values('$last_inserted_id',2)";
$db->setQuery($sql);
$db->query();
//Finally send a mail to user if required.
JUtility::sendMail(mailfrom, fromname, $user_email, $emailSubject, $email_body,true);
}
이
이 당신에게 어떤 도움이 될 수 있습니다 ..이 의미를 희망 : http://stackoverflow.com/questions/1904809/how-can-i-create-a-new-joomla -user-account-from-a-script – Lodder
체크 아웃 : http://tutorialzine.com/2013/08/simple-registration-system-php-mysql/ & http://www.infosearchshop.com/56 -php-registration-form-php-registration-script-with-mysql –