openmind Posted November 9, 2012 Share Posted November 9, 2012 Seeing as this had me stumped for quite some time I thought I would post the solution here. Anyway, I needed a way to set a ColdFusion session for the userID of the logged in WHMCS user so I could use it in areas outside the client account area. Now as ColdFusion works server side and you can't easily access PHP sessions with it I tried a million different ways until I hit on this simple method... 1) Create a new action hook in /includes/hooks and add the following code: <?php function login_redirect($vars) { //url-ify the data for the redirect foreach($vars as $key=>$value) { $vars_string .= $key.'='.$value.'&'; } rtrim($vars_string,'&'); header('Location: /your_coldfusion_file.cfm?' . $vars_string); exit; } add_hook("ClientLogin",1,"login_redirect"); ?> 2) Create the file to receive the URL so in the example above your_coldfusion_file.cfm and add this: <cfset session.isloggedin=True> <cfset session.custid=url.userid> <cflocation url="../portal/clientarea.php" addtoken="no"> On logging in the client bounces off your ColdFusion file, sets the session vars and returns back to the client area. Now you have the userID stored in a ColdFusion session you can use it outside of the portal in ColdFusion files. 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.