Jump to content

Login form on external page


Recommended Posts

Hello to all!

 

I am working to integrate the login form on my main page, external to the WHMCS templating system.

 

Adding a login form is easy - it is just HTML code that points to the whmcs code. However, I only want to display this code if the client has not already logged in. I think what I need to do is create some PHP code to check for the login cookie or session information.

 

However, everything I have tried to do has not worked properly. Does anyone know of information relating to this? Namely, I am looking for session or cookie information that I can retreive from an external page outside of whmcs.

Link to comment
Share on other sites

Edit:

Whoops, just saw that you said "external" from the templating system. Yeah, you'll have to manually check the session ID and stuff, I think. Sorry for my airheaded response.

------------------

If you include the smarty stuff from the WHMCS folders, then you can do a simple smarty if statement using the $loggedin variable. Otherwise... hrm... well that's how I'd do it. ;)

Link to comment
Share on other sites

After sleeping overnight on this, I realized that I could do this by setting my own cookie with javascript. After setting this cookie on the WHMcs page (using the $loggedin variable) then I can read it on my other pages.

 

Thanks for the inspiration :)

Link to comment
Share on other sites

Thank you!

 

To anyone who would find this interesting, what I am doing is putting an {if} switched loggedin parameter on the support area of the site. If it is logged in, I display a welcome message along with javascript code to set a simple cookie. That handles WHMcs branded areas of the site.

 

For non-WHMcs areas, I am then reading this cookie and displaying either a login form, or the same welcome message.

 

The tricky part is that I want to make sure that my custom cookie and the whmcs session mesh as far as whether they are logged in or not. I think it is possible because the session only lasts as long as you are logged in, unless you check that "keep me logged in" box. So I still have sonme debugging to go as far as making sure that all lines up correctly.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated