Web Hosting Talk







View Full Version : cPanel Login


WLHosting
04-03-2003, 08:54 PM
I was wondering if there was an easy way to have a login form on a site to log into cPanel? Is this just a javascript link address or something completely different? Thanks for your help.

null
04-03-2003, 09:15 PM
http://username:password@host/cpanel

digitok
04-03-2003, 09:33 PM
Save this as the file you want to have the login form on...

<html>
<head>
<title>cPanel Login</title>
</head>
<body>
<form method="post" action="cpanel.php">
Username: <input type="text" name="user"><br>
Password: <input type="password" name="pass"><br>
<input type="submit" name="submit" value="Login!">
</form>
</body>
</html>

Now save this as "cpanel.php"...

<?
// Note: Change "yoursite.com" to your domain
if ($_POST["submit"]) {
if ((!$_POST["user"]) || (!$_POST["pass"])) {
echo("Please complete all fields.");
}
else {
header("Location: http://$user:$pass@www.yoursite.com/cpanel");
}
}
?>

If the user doesn't enter a username or password it will tell
them to complete it, if they enter both, it will log them into cPanel.

Hope it helps.

WLHosting
04-03-2003, 11:05 PM
Thanks I will try it.

digitok
04-03-2003, 11:07 PM
No problems :)

LinuXpert
04-04-2003, 03:28 AM
Use https:// please.

digitok
04-04-2003, 03:54 AM
Yeah you probably should...