Arvixe Billing    Support    About Us    Contact Us    Shopping Cart
Blog    Discussion Board    Testimonials
Dec
22
2008

Customizing Webmail/cPanel/WHM Login Page

While resellers and dedicated server owners have much more branding options discussed here . Any user can create and customize their own login page easily without having to edit any files or settings within cPanel.

By default, when someone tries to login to the control panel, webmail or WHM, they will be greeted with a pop up window asking them for their username and password. If they press cancel or guess the wrong password too many times, they will be forwarded to a web form that asks for the username and password.

By customizing the login page, you are essentially recreating that form using the HTML <form> tag. cPanel services run on the following ports:

  • cPanel: 2083 (https) or 2082 (http)
  • webmail: 2096 (https) or 2095 (http)
  • whm: 2087 (https) or 2086 (http)

You need to know these port settings since you’ll be POSTing the username and password to each port. For example, if we were to login to cPanel, we’d need to POST the login variables to http://server.arvixe.com:2082/login/ . Since Arvixe uses signed certificates for cPanel, you can also use https://server.arvixe.com:2083/login/ for an ecrypted connection to keep the username and password safe.

The login variables required for login are:

  • user
  • pass
  • login_theme (may be optional)

Optionally, you can specify the variable ‘failurl’ to have CPanel send the user back to a certain page if the username and password don’t match what is on the record.

For those that are completely confused at this point, the following simple web form provided by cPanel at http://www.cpanel.net/cpanel-login.phps should provide some guidance on how to construct the HTML <form> tag.

The contents of the file are also included below:

<?
#Login Configuration

#cPanel
$protocol = 'http';
$port = 2082;

#Secure cPanel
#$protocol = 'https';
#$port = 2083;

#WHM
#$protocol = 'http';
#$port = 2086;

#Secure WHM
#$protocol = 'https';
#$port = 2087;

#Webmail
#$protocol = 'http';
#$port = 2095;

#Secure Webmail
#$protocol = 'https';
#$port = 2096;
?>

<html>
<h1>[Web Hosting Company Name Here]</h1>

<b>cPanel Login</b><br>

<?php
if ($_GET['failed'] == "1") {
?>
<font color=#FF0000>Your login attempt failed!</font>
<?php
}
print "<form action=\"" . $protocol . "://" . $_SERVER['HTTP_HOST'] . ":" . $port . "/login/\"
method=POST>";
?>
User: <input type="text" name="user"><br>
Pass: <input type="password" name="pass"><br>
<?php
print "<input type=hidden name=failurl value=\"http://" .  $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . "?failed=1\">";
?>
<input type="hidden" name="login_theme" value="default">
<input type="submit" value="Login">
</form><br>
<a href="cpanel-login.phps">Source</a><br>
Note: This examples requires cPanel 9.4.1 or later!
The login theme option requests cPanel 11.1.0 or later!

</html>

Note: If you are going to be using the same file mentioned above, simply “uncomment” the proper service you wish to use (ie cPanel, webmail or WHM) by removing the # beside the lines for that service. Remember to place a # beside all the lines for the other services. The form will only allow you to login to one service at a time. The corresponding port numbers are mentioned above in this post for your reference.

Update on December 29th, 2008: MartinH on our forums at http://forum.arvixe.com/smf/general/customizing-webmail-interface/ mentioned that while the above script works, there is a notification your visitors will receive using the Opera browser. The following form found at http://www.wlscripting.com/tutorial/33 provides an alternate form that does not give the initial warning in Opera:

<form action="cpanelLogin.php" method="POST">
<?php
// Show an error if the login failed
if(($_GET['failed'] == "1") or ($error == 1)){
echo '<font color="#FF0000">Your login attempt failed!</font><br />';
}
?>
Domain: <input type="text" name="domain" value="" size="20" /><br />
Username: <input type="text" name="username" value="" size="20" /><br />
Password: <input type="password" name="pass" value="" size="20" /><br />
<?php
// This failurl allows cPanel to redirect back to this site
echo '<input type="hidden" name="failurl" value="http://'.$_SERVER['HTTP_HOST'].$_SERVER['PHP_SELF'].'?failed=1">';
?>
Options: <select name="port">
  <option value="2082">cPanel </option>
  <option value="2083">Secure cPanel </option>
  <option value="2086">WHM</option>
  <option value="2087">Secure WHM</option>
  <option value="2095">Webmail</option>
  <option value="2096">Secure Webmail</option>
</select><br />
<input type="submit" value="Login" />

</form>

Main instruction included with the code is as follows:

If you only want to allow cPanel logins you can change the
<select name=”port”> to <input type=”hidden” name=”port”
value=”2082″>. This allows you to only show the domain, username and
password fields.

One thing you will have to make sure you change is the action on the
<form> so that it points to the file you will be saving on the
next page of this article.

Leave a Reply

Copyright © 2003-2010 Arvixe, LLC. All trademarks are property of their legal owner.
Better Business Bureau Visa Card Accepted Master Card Accepted American Express Cards Accepted Discover Card Accepted Google Check Out Accepted Paypal Accepted
Better Business Bureau Member Visa Accepted Master Card Accepted American Express Accepted Discover Card Accepted Paypal Accepted Google Checkout Accepted

Web Hosting
Linux Hosting
ASP .NET Hosting
Business Hosting
Reseller Hosting
E-Commerce Hosting
Dedicated Servers

Acceptable Use Policy
Terms of Service

Affiliate Program
Site Map
Blog Hosting
WordPress Hosting
b2evolution Hosting
Nucleus CMS Hosting
Textpattern Hosting
Habari Hosting


CMS Hosting
Mambo Hosting
phpNuke Hosting
Geeklog Hosting
phpWCMS Hosting
phpWebSite Hosting
Shopping Cart Hosting
OpenCart Hosting
osCommerce Hosting
CubeCart Hosting
Buy Safe Hosting
Zen Cart Hosting


Video Sharing Software Hosting
VidiScript Hosting
iVidPlay Hosting
ClipBucket Hosting
ClipShare Hosting
osTube Hosting
Forum Hosting
XMB eXtreme Hosting
phpBB Hosting
Simple Machines Hosting
Vanilla Forum Hosting
AEF Hosting


Social Network and Community Website Hosting
SocialEngine Hosting
BoonEx Dolphin Hosting
BoonEx Software Hosting
Elgg Hosting
webNetwork Hosting
Media Sharing Hosting
PHPMotion Hosting
Media Share Suite Hosting
sMediaMax Hosting
AttachMax Hosting
Anova Hosting


Windows Extensions, Modules, and Libraries Hosting
ASP.net MVC Hosting
ASP .NET AJAX 3.5 Hosting
LINQ Hosting
DotNetPanel Hosting
IIS 7 Hosting