Jump to content

Cpanel Login on ClientArea Home


robbo

Recommended Posts

Troy,

 

Thank you very much for the clarification.

 

I did actually have my server setup in whmcs but with only the first part of the server hostname. And you are correct "name" is being pulled from tblservers as you stated.

 

I have not finished my site and do not have a ssl yet as a ssl will be one of the last things I purchase before I go live.

 

Out of curiosity are you providing a ssl per server? And what benefit will this have other then a client not having to click the security warning?

 

Baja

Link to comment
Share on other sites

  • Replies 81
  • Created
  • Last Reply

Top Posters In This Topic

Troy,

 

Out of curiosity are you providing a ssl per server? And what benefit will this have other then a client not having to click the security warning?

 

Baja

 

Yes, we secure every web server with an inexpensive RapidSSL certificate to give clients a secure control panel, and we use the SSL and "redirect to hostname" options in CPanel's tweak settings area in WHM so that all control panel access is secured. Security warnings give an unprofessional impression to clients, IMO, and IE7's default settings make it more difficult for the average user to get around the security warning.

Link to comment
Share on other sites

Outstanding job Troy!

 

I changed the "name" to "domain" and I have already received praise from our links. Maybe Matt will add this script into a new version. Our clients say that it is easier to find it.

 

Incidentally, we added it to the left side menu in a table using the "navbox" and "navbar" classes.

 

Keith

Link to comment
Share on other sites

  • 2 weeks later...
Incidentally, we added it to the left side menu in a table using the "navbox" and "navbar" classes.

 

Keith

 

That's an excellent idea! I may do that too. It would certainly keep the customers' control panel links available to them at all times while logged in to their account.

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

So I added the cp.php file and entered: {include_php file="cp.php"} on the clientareahome.tpl and nothing changed. Is there something I am missing???

 

Ryan

 

Here's what I did:

 

Created the following cp.php file and put it in the whmcs root:

 

<?php
       $query_string = "select s.name, s.type, h.packageid, h.domain, h.username, h.password from tblhosting h, tblservers s where h.server = s.id and s.type in ('cpanel','helm') and h.userid = ".$_SESSION['uid']." and h.domainstatus = 'Active' order by h.domain";
       $query = mysql_query($query_string);
       if (mysql_num_rows($query)) {
?>



[b]Control Panel Links[/b]</p>
<table align="center" style="width:90%" class="clientareatable" cellspacing="1">
<tr class="clientareatableheading">
       <td>Domain</td>
       <td>Links</td>
</tr>

<?php
while ($row = mysql_fetch_assoc($query)) {
       switch ($row["type"]) {
               case "cpanel": 
                       echo '<tr class="clientareatableactive">';
                       echo '<td>'.$row["domain"].'</td>';
                       echo '<td>[url="https://'.$row['name'].':2083/login?user='.$row['username'].'&pass='.decrypt($row['password']).'"]Control Panel[/url]';
                       if ($row['packageid'] >= 3 && $row['packageid'] <= 7) {
                               echo ', [url="https://'.$row['name'].':2087/login/?user='.$row['username'].'&pass='.decrypt($row['password']).'"]Web Host Manager[/url]';
                       }
                       echo '</td>';
                       echo '</tr>';
                       break;
               case "helm":
                       echo '<tr class="clientareatableactive">';
                       echo '<td>'.$row["domain"].'</td>';
                       echo '<td>[url="https://'.$row['name'].'/default.asp?txtUsername='.$row['username'].'&txtPassword='.decrypt($row['password']).'&&selLanguageCode=EN&selInterface=standard_XP'.'"]Control Panel[/url]</td>';
                       echo '</tr>';
       }
}
?>

</table>

<?php } ?>

 

We only do CPanel and Helm, so it only covers those two control panels. The links are simple links, no forms/javascript required, and they forward the user to the control panel with no need to enter the control panel username/password. The code expects the servername set up in whmcs to be the actual hostname of the server, and to be secured with an SSL certificate.

 

It also places a WHM link for resellers, but the code that does it will have to be adjusted for your reseller package ids. It's this bit:

 

                        if ($row['packageid'] >= 3 && $row['packageid'] <= 7) {
                               echo ', [url="https://'.$row['name'].':2087/login/?user='.$row['username'].'&pass='.decrypt($row['password']).'"]Web Host Manager[/url]';
                       }

 

Our reseller packages have ids between 3 and 7, hence the if ($row['packageid'] >= 3 && $row['packageid'] <= 7), which needs to be taylored to your packages.

 

Otherwise everything else is done by server type, (only cpanel or helm), in whmcs and will accomodate any number of servers.

 

Then you simply do this wherever you want the links:

 

{include_php file="cp.php"}

 

I put it in the clientareahome.tpl right above the ticket list.

 

The code above looks poorly formatted, but that's just due to the word wrapping. If you copy and paste it, it should be well formatted (I hope).

Link to comment
Share on other sites

  • 2 weeks later...
  • 3 weeks later...

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)

Link to comment
Share on other sites

  • WHMCS CEO
The easiest thing would be to have a tick box on the product setup that indicates the package is a reseller account, and then passing that variable through to the template. Ooooh Matt ..... ;)

The product type does that - shared account, reseller account, server or other.

 

Matt

Link to comment
Share on other sites

I have read this thread and got very confused at the end..

 

Can someone bundle this up into a nice clean set of steps to add the Cpanel Link to the client area..

 

I thought I understood it but then I saw that it was modified a few times for this and that....

 

Can someoene place up the finalized exact steps?

 

Thanks

Link to comment
Share on other sites

Troy & Co.

 

I have been using this add on hack for a while and it works well. However, yesterday I have encountered a interesting phenomena.

 

For clients that has ordering largest hosting plan, it show 'cpanel login' AND 'WebHostManager login'!

 

I haven't changed anything in WHMCS. Can someone give me some tip here?

 

Regards.

Link to comment
Share on other sites

  • 4 weeks later...
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)

 

 

@allynne. Implemented, but couldn't get either of the logins to work. Loggin as client, but the link kept taking me to my server

then i realised that the {$server.name} should be replaced by {$domain} in both cases.

 

So the code becomes

<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://{$domain}:2083/login?user={$username}&pass={$password}')" value="Login to cPanel"/>
   <input class="button" type="button" onclick="window.open('https://{$domain}:2096/login?user={$username}&pass={$password}')" value="Login to Webmail"/>
</td>

or http:// instead of https, as the case may be.

Could you verify?

 

 

Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...

What happens if the user changes the cpanel password within cpanel? That means if you guys are passing the password in via the whmcs db then it's out of date/invalid? Could cause confusion for the user. Or does WHMCS pull updated passwords from cpanel somehow? I've yet to install/test.

Link to comment
Share on other sites

  • 2 weeks later...

want specifics? here ya go...

 

Warning: mysql_query() [function.mysql-query]: Access denied for user 'user'@'localhost' (using password: NO) in /home/user/public_html/cp.php on line 3

Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/user/public_html/cp.php on line 3

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/user/public_html/cp.php on line 4

 

Looks to me issues with DB connections, but the last one looks script related.

 

I even tried the original posted script, but that just gave me a blank page!

 

What gives!?!

 

Like Zippohost's request, could someone make it more black and white? clearly something is missing and incomplete here...

 

Thanks!

Link to comment
Share on other sites

Hmmm... no responses....why's that...?

 

My WHMCS works perfect, so I dunno why this mod wouldn't be able to work.

 

...still waiting for help....

 

Thanks!

 

Do you have your cp.php file in the WHMCS home directory?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated