http://dev."xxxxxyyyyy".com/xxxxx-community/register.html?&invite=5000
我需要使用session将此id($ invite = 5000)存储在名为$ fromid的变量中。/ component /com_community/controllers/register.php中有两个函数
我应该在哪里打电话给这个以及怎么做?
class CommunityRegisterController extends CommunityBaseController
{
public function register()
{
}
另一个
public function register_save()
{
$mainframe =& JFactory::getApplication();
$modelRegister = CFactory::getModel('register');
// Check for request forgeries
$mySess =& JFactory::getSession();
if(! $mySess->has('JS_REG_TOKEN'))
{
echo '<div class="error-box">' . JText::_('COM_COMMUNITY_INVALID_SESSION') . '</div>';
return;
}
$token = $mySess->get('JS_REG_TOKEN','');
$ipAddress = isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
$authKey = $modelRegister->getAssignedAuthKey($token, $ipAddress);
$formToken = JRequest::getVar( 'authkey', '', 'REQUEST');
if(empty($formToken) || empty($authKey) || ($formToken != $authKey))
{
//echo $formToken .'|'. $authKey;
echo '<div class="error-box">' . JText::_('COM_COMMUNITY_INVALID_TOKEN') . '</div>';
return;
}
//update the auth key life span to another 180 sec.
$modelRegister->updateAuthKey ($token, $authKey, $ipAddress);
// Get required system objects
$config = CFactory::getConfig();
$post = JRequest::get('post');
// If user registration is not allowed, show 403 not authorized.
$usersConfig = &JComponentHelper::getParams( 'com_users' );
if ($usersConfig->get('allowUserRegistration') == '0')
{
//show warning message
$view =& $this->getView('register');
$view->addWarning(JText::_( 'COM_COMMUNITY_REGISTRATION_DISABLED' ));
echo $view->get('register');
return;
}
我可以在使用该类的components / com_users / controllers / registration.php中访问$ fromid
class UsersControllerRegistration extends UsersController
{
}
答案 0 :(得分:0)
您可以使用GET方法获取值,然后将其存储在会话变量中, 例如:
$_SESSION['fromid'] = $_GET['invite'];
$fromid = $_SESSION['fromid'];