I have made small changes to this script which allows you to include the login script anywhere and still catch incorrect logins and redirect them to your website. I have tested the script before posting the details here, however incase it doesn't work for you do let me know.Originally Posted by bdraco
Hope this helps someone.
dpcpanellogin.php
include_anywhere.phpCode:<?php error_reporting(E_ALL ^ E_NOTICE); //Here we check if any field was missed / left empty and act accordingly if ($_POST['domain'] && $_POST['username'] && $_POST['pass'] && !($_GET['failed'] == "1")) { switch ($_POST['login_option']) { case "2082": $port = "2082"; $protocol = "http://"; break; case "2083": $port = "2083"; $protocol = "https://"; break; case "2086": $port = "2086"; $protocol = "http://"; break; case "2087": $port = "2087"; $protocol = "https://"; break; case "2095": $port = "2095"; $protocol = "http://"; break; case "2096": $port = "2096"; $protocol = "https://"; break; } $redirectlocation = $protocol.$_POST['domain'].":".$port."/login/?user=".$_POST['username']."&pass=".$_POST['pass']."&failurl=".$_POST['failurl']; header ("Location: ".$redirectlocation); } else { $error = 1; header ("Location: ".$_POST['failurl']); } ?>
Just include the code in include_anywhere.php inside your page and place the docpanellogin.php file in the same directory. The rest should workCode:<?php $postlocation = "docpanellogin.php"; print "<form action=\"" . $postlocation . "\" method=\"POST\">"; if (($_GET['failed'] == "1") or ($error == 1)) { ?> <font color=#FF0000 face=verdana size=1>Your login attempt failed!</font><br> <?php } ?> <font face="Verdana" size="1">Domain:</font> <input name="domain" class="input2" type="text" value="" style="width:110;height:18;font-family:Verdana; font-size:8pt" size="20" /><br> <font face="Verdana" size="1">Username:</font> <input name="username" class="input2" type="text" value="" style="width:110;height:18;font-family:Verdana; font-size:8pt" size="20" /><br> <font face="Verdana" size="1">Password:</font> <input name="pass" class="input2" type="password" value="" style="width:110;height:18;font-family:Verdana; font-size:8pt" size="20" /> <?php print "<input type=hidden name=failurl value=\"http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . "?failed=1\">"; ?> <br> <font face="Verdana" size="1">Options:</font> <select name="login_option" style="font-family: Verdana; font-size: 8pt;width:110;height:18"> <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 class="input2" type="submit" value=" Click to Login " style="width:100;height:20;font-family:Verdana; font-size:8pt" onmouseout="blur(this);" /> </form>
The reason why this script was written was because we have too many servers and its very hard to come back each time to the script and insert the new server name. Instead here we just take the domain from the user. Anyone who wants to embed the domain name should replace the following lines from include_anywhere.php
and replace withCode:<font face="Verdana" size="1">Domain:</font> <input name="domain" class="input2" type="text" value="" style="width:110;height:18;font-family:Verdana; font-size:8pt" size="20" /><br>
replacing the "YOUR_SERVER_NAME" with your server name. (I haven't test this part but it should workCode:<input name="domain" type="hidden" value="YOUR_SERVER_NAME"/>)
I will post all these files and information on my website and post the url here so it can refered by anyone.



LinkBack URL
About LinkBacks
)
Reply With Quote





