View Single Post
  #3  
Old 02-01-2006, 12:17 AM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default

Hi Craig, interesting bumping into you in a thread here after meeting in the thread to request x-cart integration on the Kayako forums

I integrated my support suite with my x-cart to use the same login and password, but found it annoying that a user logged into x-cart, would have to re-enter their login/pass to access Kayako, as a result I created a script to auto-log them in.

In my Kayako support directory I put this in an .htaccess file:

Code:
DirectoryIndex home.php index.php

This allows home.php to be called prior to the kayako index.

Then in home.php I entered the following which checks for a logged in x-cart user, and if they are logged into x-cart, it will create a login form for kayako and auto-submit it using javascript, logging them automatically into kayako.

It works very similar to yours, just a bit of another integration option.

NOTE: You'll have to edit the path to skin1.css and I'd put a logo on the page or something also.

Code:
<?php require "../auth.php"; if ($login) { $pass = func_query_first("SELECT password FROM $sql_tbl[customers] WHERE login='$login' LIMIT 1"); $pass = $pass[password]; $pass = text_decrypt($pass); ?> <HTML><title>Logging into Client Support Center</title> <link rel="stylesheet" href="/skin1/skin1.css"> <BODY onLoad="document.loginform.submit();"> <form name="loginform" action="index.php" method="POST"> <input type="hidden" name="loginemail" value="<?= $login; ?>"> <input type="hidden" name="loginpassword" value="<?= $pass; ?>"></td> <input type="hidden" name="rememberme" value="1"> <input type="hidden" name="_m" value="core"> <input type="hidden" name="_a" value="login"> <input type="hidden" name="querystring" value=""> <table width="100%" height="100%" ><tr><td align="center" valign="middle"> <div align=center> <table cellpadding=15 cellspacing=0 width=500 bgcolor="#FFFFFF"><tr><td> <font face="arial" size="3">Client Support Center</font></p> <font face="arial" size="2">Please wait while we log you into the Client Support Center...</font></p> <p align=center><input type="submit" class="form" value="Click here if you're not automatically logged in"></p> </td></tr></table> </div> </td></tr></table> </form></body></html> <? } else { header("Location: index.php"); } ?>
Reply With Quote