Login into Control Panel from HTML File

rickintn

Registered
Aug 10, 2007
2
0
51
I have a hosting business and the template I am setting up has a place for my customers to login into the control panel. It is an HTML file. When someone tries to login, they enter their username and password. Then, when they hit login, it ask them to enter it again on the CPANEL screen. Is there a way to get it integrated into my HTML file so they only have to enter their information once?

To see an example of this, go to smokymountainhosting.com/index2.htm
 

rickintn

Registered
Aug 10, 2007
2
0
51
Figured it Out

I finally figured it out. I found this on a message board

As you know because of a recent IE patch the old form based cPanel logins directing to a url such as http://user:[email protected] no longer work for most people.

cPanel have added a built in form to cPanel 9.0 so you just need to send the values "user" and "pass" to that form and away you go.

You can post the values to any of the following:

http://yourdomain.com:2082/login/ (cPanel)
https://yourdomain.com:2083/login/ (secure cPanel)

http://yourdomain.com:2095/login/ (webmail)
https://yourdomain.com:2096/login/ (secure webmail)


Here's a little script you're welcome to use if you like, that gives people the choice of all four logins.

1. save this as cplogin.php (edit the line with your domain or ip)


<html>
<?php

#your domain or ip
$domain = "yourdomain.com";

if(!$_POST['login']) {
exit;
}

$user = $_POST['user'];
$pass = $_POST['pass'];
$port = $_POST['port'];

$port == "2083" || $port == "2096" ? $pre = "https://" : $pre = "http://";
?>
<body onLoad="setTimeout('document.forms[0].submit();',10)">
<form action="<?php echo "".$pre."".$domain.":".$port."/login/"; ?>" method="post">
<input type="hidden" name="user" value="<?php echo $user; ?>">
<input type="hidden" name="pass" value="<?php echo $pass; ?>">
</form>
</body>
</html>

2. Then the form to use on your site


<form action="cplogin.php" method="post">
<table cellspacing="4" cellpadding="0">
<tr><td>Username:</td><td><input type="text" name="user"></td></tr>
<tr><td>Password:</td><td><input type="password" name="pass"></td></tr>
<tr><td>Login To:</td>
<td align="right">
<select name="port">
<option value="2082">cPanel</option>
<option value="2083">Secure cPanel</option>
<option value="2095">Webmail</option>
<option value="2096">Secure Webmail</option>
</select>
</td></tr>
<tr><td align="right" colspan="2">
<input type="submit" name="login" value="login" style="cursor:pointer">
</td>
</tr>
</table>
</form>

This should work for most browsers, but remember you need to be running cPanel 9.0 or above.