cPanel, WHM, Webmail login script
By: Daniel
The following code will allow you to login to several different ports that are used for cPanel.
<form action="cpanelLogin.php" method="POST"> // Show an error if the login failed if(($_GET['failed'] == "1") or ($error == 1)){ echo '<font color="#FF0000">Your login attempt failed!</font><br />'; } Domain: <input type="text" name="domain" value="" size="20" /><br /> Username: <input type="text" name="username" value="" size="20" /><br /> Password: <input type="password" name="pass" value="" size="20" /><br /> // 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: <select name="port"> <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 type="submit" value="Login" /> </form>
Above we created a very basic form to allow the users to login with. You can spice this up to match your site, you just have to make sure that the field names - the name=” some text ” - remains the same.
If you only want to allow cPanel logins you can change the <select name=”port”> to <input type=”hidden” name=”port” value=”2082″>. This allows you to only show the domain, username and password fields.
One thing you will have to make sure you change is the action on the <form> so that it points to the file you will be saving on the next page of this article.
On the next page is the processing of the code.
Pages: 1 2



(14 votes, average: 4.71 out of 5)
December 9th, 2006 at 6:50 am
i want cPanel, WHM, Webmail login account.
December 21st, 2006 at 7:57 am
Hi, thanks so much for sharing this out. I’ve looked for this for quite a lot of time but I am glad to have found a solution here. Please keep it up. However, I would like to know if there is a way I could skip the cPanel Management so that I go directly to Squirrelmail. On my host, I only have one email application squirelmail but still I have to go through cPanel Management
January 23rd, 2007 at 12:41 pm
Cant understand what changes i have to do in “the brains of this script” and where to put it?
January 23rd, 2007 at 8:18 pm
Very useful thank you!
February 28th, 2007 at 9:54 am
Excelent!
March 18th, 2007 at 12:29 am
Okay thanks for this.
^_^
April 3rd, 2007 at 9:37 am
Hi I really apreciate this kind of work but it was hard to find it on google I would spread the link of this website so as to appreciate the work
KEEP GOING
October 7th, 2007 at 12:16 am
Thank you for sharing!
January 12th, 2008 at 12:52 am
Thank you, keep it up.
March 20th, 2008 at 2:02 am
plese give me script for cpanelLogin.php
May 1st, 2008 at 2:42 pm
Dash, the cpanelLogin.php is on page 2 of this article: http://www.wlscripting.com/tutorial/33/2/
May 2nd, 2008 at 10:36 am
Thank you for sharing!
dash see : http://www.wlscripting.com/tutorial/33/2/
May 17th, 2008 at 6:16 pm
// This failurl allows cPanel to redirect back to this site
this not work. if all field is complete and the pass or user is wrong then show cpanel login page.
May 28th, 2008 at 4:04 am
I have tried this script but unable to login.
Where to add ip address in this script.
June 26th, 2008 at 1:59 am
Thanks for the most wanted script.
i followed all the instructions, but i got stuck when i input all required information correctly. the error is page can not be displayed.
i saved the cpanelLogin.php file on server in the same directory from where my page refering this to post. but the same error.
Yes my server is php enabled. all other php scripts working which are provided here at your site.(the ones that i checked).
hope to get solution soon as i needed this script.
thanks