gotzboost Posted July 11, 2008 Share Posted July 11, 2008 updated version, added DotNetPanel, also edited the query to pull back the panel's url. The panels URL is stored in configoption8 in the table tblproducts for DotNetPanel. I'm not sure if it's the same for all, so I only changed it for DotNetPanel. Maybe others can contribute to it and find out what it is for the other panels and update. Also, I had to use {include_php file="cp.php"} and save the cp.php in the root of the web app. {include file="cp.php"} doesn't recognize the <?php, it only supports smarty code. I added {include_php file="cp.php"} to the templates\portal\clientareahome.tpl file, above the line <p><strong>{$LANG.invoicesdue}</strong></p> <?php $query_string = "select s.name, s.type, h.packageid, h.domain, h.username, h.password, p.configoption8 from tblhosting h, tblservers s, tblproducts p where h.packageid = p.id AND h.server = s.id and h.userid = ".$_SESSION['uid']." and h.domainstatus = 'Active' order by h.domain"; $query = mysql_query($query_string); if (mysql_num_rows($query)) { ?> <p><strong>Control Panel Links</strong></p> <table align="center" style="width:90%" class="clientareatable" cellspacing="1"> <tr class="clientareatableheading"> <td>Domain</td> <td>Link</td> </tr> <?php while ($row = mysql_fetch_assoc($query)) { switch ($row["type"]) { case "dotnetpanel": echo '<tr class="clientareatableactive">'; echo '<td>'.$row["domain"].'</td>'; echo '<td><a target="_blank" href="'.$row['configoption8'].'/Default.aspx?pid=Login&user='.$row['username'].'&password='.decrypt($row['password']).'">Manage</a>'; echo '</td>'; echo '</tr>'; break; case "cpanel": echo '<tr class="clientareatableactive">'; echo '<td>'.$row["domain"].'</td>'; echo '<td><a target="_blank" href="https://'.$row['name'].'/login?user='.$row['username'].'&pass='.decrypt($row['password']).'">Manage</a>'; echo '</td>'; echo '</tr>'; break; case "helm": echo '<tr class="clientareatableactive">'; echo '<td>'.$row["domain"].'</td>'; echo '<td>><a target="_blank" href="https://'.$row['name'].'/default.asp?txtUsername='.$row['username'].'&txtPassword='.decrypt($row['password']).'&&selLanguageCode=EN&selInterface=standard_XP">Manage</a></td>'; echo '</tr>'; } } ?> </table> <?php } ?> 0 Quote Link to comment Share on other sites More sharing options...
adtastichosting Posted July 16, 2008 Share Posted July 16, 2008 I'm just reading around and found this mod but I'm confused about its purpose/need as there is already a login to control panel feature as well as a login to webmail feature built into the whmcs script in the client area under the product details of the individual products that appears to work great. Or am I missing something here? 0 Quote Link to comment Share on other sites More sharing options...
gotzboost Posted July 17, 2008 Share Posted July 17, 2008 What panel are you useing? Because with dotnetpanel all you see is the username and password for the panel. No link to it, no link to webmail, nothing. 0 Quote Link to comment Share on other sites More sharing options...
cafreamoroso Posted July 20, 2008 Share Posted July 20, 2008 with cpanel there's a nice button 0 Quote Link to comment Share on other sites More sharing options...
mediademon Posted October 17, 2008 Share Posted October 17, 2008 @allynne. Implemented, but couldn't get either of the logins to work. Login as client, but the link kept taking me to my serverthen i realised that the {$server.name} should be replaced by {$domain} in both cases. How can you use the server hostname? 0 Quote Link to comment Share on other sites More sharing options...
balebond Posted October 21, 2008 Share Posted October 21, 2008 After installing 3.7.1 my login scripts based on the code in this thread is broken. It appears that decrypt($row['password']) is no longer correctly generating the password. Is there a fix for this? This is a pretty urgent issue for me. Thanks for any help. 0 Quote Link to comment Share on other sites More sharing options...
balebond Posted October 21, 2008 Share Posted October 21, 2008 Ok, I see that the algorithm has changed and I need to use the API. However, I'm not getting any results out. I'm still a PHP newbie so maybe someone can see a flaw with my code... I modified the example in the documentation to make my call. $url = "http://www.mydomain.com/whmcs/includes/api.php"; # URL to WHMCS API file $username = "my_top_admin_user"; # Admin username goes here $password = "the_password"; # Admin password goes here //sql query and start of for loop omittted //decrypt cpanel password $postfields["action"] = "decryptpassword"; $postfields["password2"] = $row["cpass"]; //verified that data is there $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_TIMEOUT, 100); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields); $data2 = curl_exec($ch); curl_close($ch); $data2 = explode(";",$data2); foreach ($data2 AS $temp) { $temp = explode("=",$temp); $results2[$temp[0]] = $temp[1]; } //creating an array here //none of these variables have data //$data2["password"]; //$results2["password"]; //$data2[0]; //$results2[0]; //$data2[1]; //$results2[1]; What am I missing here? No errors. But not sure how to extract results from the call properly and not sure how to tell the call is working at all. My assumption is that I'm failing on the syntax somewhere. Thanks 0 Quote Link to comment Share on other sites More sharing options...
balebond Posted October 21, 2008 Share Posted October 21, 2008 Just a note that even after discovering I need to add: $postfields["username"] = $username; $postfields["password"] = md5($password); I'm still getting nada back for $results2.['password'] fyi, I also have an api call using $results.['password'] in my loop thus the #results2... but that one is coming back blank as well. 0 Quote Link to comment Share on other sites More sharing options...
nielsenj Posted October 21, 2008 Share Posted October 21, 2008 Syntax to access the variables stored into "$results2" would be "$results2['password']" or whatever you're trying to access. Notice the lack of "." inbetween. There's nothing within the code that is different from my implementations other than i have a lower timeout value of 10 instead of 100. But that shouldn't make a difference. 0 Quote Link to comment Share on other sites More sharing options...
balebond Posted October 21, 2008 Share Posted October 21, 2008 Oh... yeah I have $results2['password'] in my code... just made that mistake in my post. But still, no errors returning from call... yet no password coming back. If it looks like a valid call to others... I guess I'll put in a support ticket on it. 0 Quote Link to comment Share on other sites More sharing options...
nielsenj Posted October 21, 2008 Share Posted October 21, 2008 (edited) Oh... yeah I have $results2['password'] in my code... just made that mistake in my post. But still, no errors returning from call... yet no password coming back. If it looks like a valid call to others... I guess I'll put in a support ticket on it. Dump question then, have you made an API call before at all? If you haven't then double check your permissions on api.php.. i think it's supposed to be 755. Edited October 21, 2008 by nielsenj fix for my horrible spelling 0 Quote Link to comment Share on other sites More sharing options...
balebond Posted October 21, 2008 Share Posted October 21, 2008 Well... no I actually haven't come to think of it. I use WHM's api and one for my site builder but hadn't needed to use WHMCS's before. I put the api.php to 755 but still no dice. Is there anyway to be sure I'm getting communication here? Like intentionally invoking an error or something? Thanks for helping out. 0 Quote Link to comment Share on other sites More sharing options...
nielsenj Posted October 21, 2008 Share Posted October 21, 2008 Well error handling is always returned by the api in $results['result'] in any case any communication coming back from the API should have that filled so try echo'ing it. If you like, you can pm me your current code and i can give it a shot on mine as i know it's working. Regards, J 0 Quote Link to comment Share on other sites More sharing options...
balebond Posted October 23, 2008 Share Posted October 23, 2008 Did you get my PM? Taking you up on the offer. Hopefully what I'm doing makes sense. 0 Quote Link to comment Share on other sites More sharing options...
nielsenj Posted October 23, 2008 Share Posted October 23, 2008 Wierd, no PM yet. Try resending it maybe? My VPS server is down for a couple of days so i won't be able to test it out until it's back up. Sorry, a provider forced thing so nothing i can do about it. 0 Quote Link to comment Share on other sites More sharing options...
benblee Posted October 24, 2008 Share Posted October 24, 2008 We just did a very simple template change. No extra files required. In clientareaproductdetails.tpl, find <td width="50%" align="center">{$serverclientarea}</td> and replace it with <td width="50%" align="center"> <input class="button" type="button" onclick="window.open('https://{$server.name}:2083/login?user={$username}&pass={$password}')" value="Login to cPanel"/> <input class="button" type="button" onclick="window.open('https://{$server.name}:2096/login?user={$username}&pass={$password}')" value="Login to Webmail"/> </td> The only drawback is that there is no WHM login button (but this was not an issue for us because we haven't yet gone down the reseller route) Great post! I made a few adjustments that may help any resellers out there that don't have a full dedicated server with SSL cert covering all user logins. If you are on a reseller account, your host should be able provide you with the overall domain login that is covered with an SSL already. This means your site is reachable by yourdomain.com/cpanel or youripaddress.com/cpanel or the one that's covered by an SSL which would be something.something.com/cpanel. Replace this in the above quoted code: <input class="button" type="button" onclick="window.open('https://{$server.name}:2083/login?user={$username}&pass={$password}')" value="Login to cPanel"/> With this: <input class="button" type="button" onclick="window.open('https://something.something.com:2083/login?user={$username}&pass={$password}')" value="Login to cPanel"/> Next, if you're following the cool trend of using Google Apps to set up email for your clients, this won't send their username and password over, but it can bring up their secure email login page for their Google Apps email account. Replace this in the above quoted code: <input class="button" type="button" onclick="window.open('https://{$server.name}:2096/login?user={$username}&pass={$password}')" value="Login to Webmail"/> With this: <input class="button" type="button" onclick="window.open('https://mail.google.com/a/{$domain}')" value="Login to Email"/> Please critique as I am not a pro. 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted October 25, 2008 Share Posted October 25, 2008 I wrote my own cPanel/WebMail login a while ago when I changed my clientareahome page. When a user clicks the cPanel button it automatically logs them into cPanel. When they log out of cPanel they are redirected back to there clientarea home page. Webmail is a little different as cPanel still has a few bugs with the redirection of the logout link. (has been fixed in the EDGE release but I will wait until it gets to RELEASE) I might add the WHM buttons when I get a chance for when I start to have reseller packages available. Here is a pic of my clientarea home page 0 Quote Link to comment Share on other sites More sharing options...
jozeph Posted October 25, 2008 Share Posted October 25, 2008 Can you share this clientareahome? I wrote my own cPanel/WebMail login a while ago when I changed my clientareahome page.When a user clicks the cPanel button it automatically logs them into cPanel. When they log out of cPanel they are redirected back to there clientarea home page. Webmail is a little different as cPanel still has a few bugs with the redirection of the logout link. (has been fixed in the EDGE release but I will wait until it gets to RELEASE) I might add the WHM buttons when I get a chance for when I start to have reseller packages available. Here is a pic of my clientarea home page 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted October 26, 2008 Share Posted October 26, 2008 It is available and now the WHM button and login now shows if the account is a reseller account. 0 Quote Link to comment Share on other sites More sharing options...
jozeph Posted October 26, 2008 Share Posted October 26, 2008 Is it available? So where to download it? 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted October 26, 2008 Share Posted October 26, 2008 Sorry but due to Appropriate Conduct section in the Forum Rules I am unable to post you the link. 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted November 3, 2008 Share Posted November 3, 2008 You can see from the new pic above (previous post) that I have updated my client area home page to show graphs like in the admin area. 0 Quote Link to comment Share on other sites More sharing options...
TerrasIOI Posted November 8, 2008 Share Posted November 8, 2008 People, I have used this 'Cpanel Login on ClientArea Home' hack successfully for very long time with 3.6.0. Now I want to upgrade to 3.7.x. So I'm wondering: Will this 'Cpanel Login on ClientArea Home' work well with WHMCS version 3.7.x? I will appriciate any answer. Regards. 0 Quote Link to comment Share on other sites More sharing options...
TerrasIOI Posted November 8, 2008 Share Posted November 8, 2008 People, I have used this 'Cpanel Login on ClientArea Home' hack successfully for very long time with 3.6.0. Now I want to upgrade to 3.7.x. So I'm wondering: Will this 'Cpanel Login on ClientArea Home' work well with WHMCS version 3.7.x? I will appriciate any answer. Regards. 0 Quote Link to comment Share on other sites More sharing options...
sparky Posted November 8, 2008 Share Posted November 8, 2008 Mine is working fine on 3.7.2 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.