alpha2x Posted January 31, 2012 Share Posted January 31, 2012 Hi guys, Hope someone can help me. I am trying to integrate as part of a script automated login into my system, I have got a far as getting ValidateLogin to return a uid and hash from the API, however I really am not sure what I am ment to do with this information, I have put it into 2 session variables as described in the wiki. Any help really appreciated. 0 Quote Link to comment Share on other sites More sharing options...
laszlof Posted January 31, 2012 Share Posted January 31, 2012 Its fairly simple. First off, the script you using needs to be on the same domain as the WHMCS installation. Otherwise, the session variables will not work. Once you have the uid and encrypted password hash, do the following in your PHP code. if (!session_id()) session_start(); $_SESSION['uid'] = $uid; $_SESSION['upw'] = md5($uid.$passwordhash.$_SERVER['REMOTE_ADDR']); // You're now logged in, redirect to your client area One note, if you're using the ValidateLogin API call. I am not sure what the "passwordhash" is that is returned by that. If its simply a dump from the tblclients database table, the above should work fine. However, this may not be the case, and if this doesnt work you might need to check with support on what actually gets returned by ValidateLogin. 0 Quote Link to comment Share on other sites More sharing options...
alpha2x Posted January 31, 2012 Author Share Posted January 31, 2012 Thanks for the reply. It does look like it gives a md5 hash in return already, still no joy though. 0 Quote Link to comment Share on other sites More sharing options...
Sitepearl Posted February 1, 2012 Share Posted February 1, 2012 Are you trying to validate the login? Or use a logged-in user as authentication? 0 Quote Link to comment Share on other sites More sharing options...
alpha2x Posted February 1, 2012 Author Share Posted February 1, 2012 I'm trying to validate a login as part of a script so once a couple of stages have been completed I can redirect a user to a pre-generated invoice on their account. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.