How to Add a Login Form to My Site
From ReduxWiki
(Redirected from CPanel/WHM (How to Add a Login form to my Site))
Create a new file with a .php extension, then add the following code.
<?php
#cPanel
$protocol = 'http';
$port = 2082;
#Secure cPanel
#$protocol = 'https';
#$port = 2083;
#Webmail
$mail_protocol = 'http';
$mail_port = 2095;
#Secure Webmail
#mail_$protocol = 'https';
#$mail_port = 2096;
?>
<h2>cPanel Login</h2>
<?php
if ($_GET['failed'] == "1") {
?>
<div style="color: red; font-size: x-small;">login attempt failed!</div>
<?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=submit value=Login>
</form>
<h2>WebMail Login</h2>
<?php
if ($_GET['failed'] == "2") {
?>
<div style="color: red; font-size: x-small;">
<?php
}
print "<form action=\"" . $mail_protocol . "://" . $_SERVER['HTTP_HOST'] . ":" . $mail_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=2\">";
?>
<input type=submit value=Login>
</form>
If you want to have this file output within your layout you may call it using the following.
<?php include('file.php');?>

