CPanel simple anywhere form script

Posted by: fay

Just realize that form that user can login from anywhere to cpanel especially webmail function.

so here i did for one of my creature

<form action="./modules/mod_cblogin/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 />';
}
?>
<b>Login Webmail</b>
<input type="hidden" name="domain" value="pradas.org.my" size="20" /><br />
Username: <i><font size="-1"><br />(mel penuh anda)</font></i><br />
<input type="text" name="username" value="prXX@pradas.org.my" size="20" style="border:1px solid #C0C0C0; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1" /><br />
Password: <br>
<input type="password" name="pass" value="" size="20" style="border:1px solid #C0C0C0; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1" /><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: <br>
<select name="port">
<option value="2095">Webmail</option>
<option value="2096">Secure Webmail</option>
</select><br />
<input type="submit" value="Login" />
</form> 


cpanelLogin.php

<?php
// make sure all needed information is provided
if($_POST['domain'] && $_POST['username'] && $_POST['pass'] && !($_GET['failed'] == "1")) {
$port = $_POST['port']; // sets the port number to login to
// Get the protocol to use for this connection
switch($port) {
case '2082': // cPanel
case '2086': // WHM
case '2095': // Webmail
$protocol = 'http://';
break;
case '2083': // Secure cPanel
case '2087': // Secure WHM
case '2096': // Secure Webmail
$protocol = 'https://';
break;
}
// Build the URL
$redirectlocation = $protocol.$_POST['domain'].':'.$port.'/login/?user='.$_POST['username'].'&pass='.$_POST['pass'].'&failurl='.$_POST['failurl'];
header ("Location: ".$redirectlocation); // Send URL
} else {
$error = 1;
header ("Location: ".$_POST['failurl']); // Send URL if all neede information is not provided
}
?>

 


moded from wlscripting 

[ Single viewed: 4848 times (counter reset 21 Oct 2008) ]
« Prev item - Next Item »
---------------------------------------------

Comments

No comments yet. You can be the first!

Leave comment

 




Soalan bonus untuk anda
Bonus Question for yah