php - Create 2 cookies in the joomla 1.5 user login -
I have a problem with a Joomla 1.5.26 site that allows this site to handle users and services. Communicates with DB In order to communicate I have to make 3 cookies, one can see in the general url using Chrome's EditThisCookie in the public domain of that site. I created smthng like Now my problem is that I want to be at the front end when a registered user logs in to create 2 cookies after logging in, then a user name and another session Session_id Then on the function at login /plugins/user/joomla.php I have added the following code but I get an empty page after user logging and certainly not seeing any cookies Chrome's EditThisCookie Using. LoginUser at the function on my code is such, but I did not know my mistake ... any help would actually be appreciated by the people ... Any help will actually be appreciated by people thank you !!!! I have decided to use it before using // cookie set cookie ('cookie_on', 'value_off_cocai_on', '0', '/', '', using a line of code in code.php like this. .mysite.com ');
function onLoginUser ($ user, $ Option = array ()) {$ instance = & amp; $ This- & gt; _getUser ($ user, $ option); If ($ Example Example Exception) {Return False; } // If the user has been blocked, then redirect with error (get $ instance- & gt; receive ('block') == 1) {return JError :: raiseWarning ('SOME_ERROR_CODE', JText :: _ ('E_NOLOGIN_BLOCKED')); } // Authorize the user based on the group's information if (! Isset ($ options ['group'])) {$ options ['group'] = 'USERS'; } // Check user can login. $ Result = $ example- & gt; Authorize ($ option ['action']); If (! $ Results) {JER :: lifting (401, geext :: _ ('Gerar_LOGINAIED')); return false; } // Log in user $ example as mark-> Set ('guest', 0); // Essential session variable register $ session = & amp; JFactory :: getSession (); $ Session- & gt; Set ('user', $ example); $ Db = JFCFire :: BDBO (); // Check to see if the session already exists. $ App = JFTC :: Mill Application (); $ App- & gt; CheckSession (); // Update user-related fields for Joomla session table $ Db- & gt; Setgun ('UPDATE'. $ Db-> QuoteName ('#__ session'). 'SET'. $ Db- & gt; Bid ('Guest'). '='. $ Db-> Bid ( $ '-' $ '>' $ '='. $ '='. $ ' & Gt; ('username')). ','. '$ Db- & gt; Bid name (' userid ').' = '. (Intestine) $ example- & gt; mill (' id '). 'WHERE'. $ Db-> quoteName ('session_id'). '='. $ Db-> Bid ($ session-> getId ()); $ Db- & gt; Query (); // The user has the previous visit field $ instance-> SetLastVisit (); Press; / * ------------------------------------------------ ------------------------------ * / // Make sure we are in the front ($ app-> site Is ()) {// initial variable $ url = $ this- & gt; Parameters-> Obtain ('url', zur: base ()). "Current current =" jury :: base (); $ Cookie_one = 'value_of_cookie_one'; $ Cookie_domain = '.mysite.com'; $ End = (time (+) + 720); SetCookie ('ooo_username', $ instance- & gt; receive ('username'), $ end, '/', $ cookie_domain); SetCookie ('ooo_micipality_id', $ cookie_one, $ end, '/', $ cookie_domain); SetCookie ('ooo_session_id', $ session- & gt; getId (), $ end, '/', $ cookie_domain); // Tell me if the user is logged in ($ -> this-> Parameters-> Get ('ooo_redirection', 0) == 1) {$ app-> Redirect ($ url); }} / * ---------------------------------------------- -------------------------------- * / Return true; }
back right : < / P>
$ session = JFTC :: Millation (); $ Example = & amp; JFactory :: getUser (); $ Instance- & gt; Get ('username'); $ Cookie_domain = '.mysite.gr'; $ End = (time (+) + 720); Set cookie ('cookie_username', $ example- & gt; receive ('username'), $ end, '/', $ cookie_domain); Set cookie ('cookie_session_id', $ session- & gt; getId (), $ end, '/', $ cookie_domain);
Comments
Post a Comment