peto Posted July 29, 2010 Share Posted July 29, 2010 Hi, I'm new to this world and I'm a bit lost about the resources that WHMCS provides to integrate this solution within our bussines. I'm trying to create a link to a external web site like (sitebuilder.server.myserver.es) from the WHMCS client area administration page. So, I have created a link on that page modifying homepage.tpl, that redirects to a php page called sitebuilder.php. Ok, now in that page (sitebuilder.php) i want to redirect the user to one or another page depending on the server where he has his domain hosted. Seeing this code may help to understand what im trying to do: <?php define("CLIENTAREA", true); require("dbconnect.php"); require("includes/functions.php"); require("includes/clientareafunctions.php"); // Comprobamos si el usuario está logeado if ($_SESSION['uid']) { // $sitebuilderserver = " "; header("Location: http://sitebuilder.server." . $sitebuilderserver . ".es"); } else { // Cargamos el entorno WHMCS $pagetitle = $_LANG['clientareatitle']; $pageicon = "images/support/clientarea.gif"; $breadcrumbnav = '<a href="index.php">' . $_LANG['globalsystemname'] . '</a>'; $breadcrumbnav .= ' > <a href="sitebuilder.php">' . $_LANG['sitebuildertitle'] . '</a>'; initialiseClientArea($pagetitle, $pageicon, $breadcrumbnav); // Archivo template para realizar login $templatefile = "login"; $smartyvalues["formaction"] = "dologin.php?goto=sitebuilder"; } outputClientArea($templatefile); ?> I suppose i'll have to consult mysql database to get what i need, but i don't know which tables. ¿Is there any reference about the database?¿Any idea of what should i do to obtain that server names? Maybe I could do it in a loaded smarty template file accessing a variable like $clientdetails.servers or something like that but i need to do it directly from the php file. Thanks in advance. 0 Quote Link to comment Share on other sites More sharing options...
laszlof Posted July 30, 2010 Share Posted July 30, 2010 Try This: <?php define("CLIENTAREA", true); require("dbconnect.php"); require("includes/functions.php"); require("includes/clientareafunctions.php"); // Comprobamos si el usuario está logeado if ($_SESSION['uid']) { $uid = $_SESSION['uid']; $sql = "SELECT s.hostname FROM tblservers s, tblhosting h WHERE h.userid = $uid AND s.id = h.server"; $data = mysql_query($sql); $row = mysql_fetch_array($data); $sitebuilderserver = $row[0]; header("Location: http://sitebuilder.server." . $sitebuilderserver . ".es"); } else { // Cargamos el entorno WHMCS $pagetitle = $_LANG['clientareatitle']; $pageicon = "images/support/clientarea.gif"; $breadcrumbnav = '<a href="index.php">' . $_LANG['globalsystemname'] . '</a>'; $breadcrumbnav .= ' > <a href="sitebuilder.php">' . $_LANG['sitebuildertitle'] . '</a>'; initialiseClientArea($pagetitle, $pageicon, $breadcrumbnav); // Archivo template para realizar login $templatefile = "login"; $smartyvalues["formaction"] = "dologin.php?goto=sitebuilder"; } outputClientArea($templatefile); ?> Of course, this probably wont work, since some customers may have more than 1 account. You'd need to make a loop if you want to link all of their accounts this way. This is also completely untested, so good luck. 0 Quote Link to comment Share on other sites More sharing options...
peto Posted July 30, 2010 Author Share Posted July 30, 2010 Thanks for the reply. I used your suggestion to finally get this query: $sql = "SELECT s.hostname FROM tblservers s INNER JOIN tblhosting h ON s.id=h.server WHERE h.userid = $uid"; That way I can obtain those clients that have an active domain ignoring those who don't. By the way, I found all the database information from a getting a backup and loading it into a local SQL client, so I think I won't have this kind of troubles any more hehe. 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.