| Reseller Hosting Questions about your reseller hosting account. |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread |
|
|
#1 (permalink) |
|
Bow before Surpass!
Super #1
Joined in Sep 2004
1,547 posts
Gave thanks: 91
Thanked 49 times
|
How to: cPanel Form on Website, v2
Alright now. Over a year later, here is a new version of the script that'll work no matter what browser you use. It requires a confirmation, however, in order for it to process the data entered by the form and then log into the cPanel. So, without further delay, here's how you do it!
Step 1: Form Code (html) Code:
<form action="cpanel.php" method="POST"> Username: <input type="text" name="user"><br /> Password: <input type="password" name="pass"><br /> <input type="hidden" name="port" value="2082"> <input type="hidden" name="server" value="website.com"> <input name="secure" type="checkbox" value="1" checked /> Secure Login?<br /> <input type="submit" name="submit" value="Login"> </form> Edit "website.com" with the website url of the cpanel you want to log into. Just the domain name without an ending slash or the www. This is the only editing needed in this whole script :O Step 2: Creating cPanel.php (PHP4/5) The following uses PHP commands to transfer the information from the form to the cPanel and perform a login. PHP Code:
This is helpful if you have many servers that you host clients on, and want one login form/php script to be able to point to any of those servers. I believe this works, haven't tested it (as in, if the server will accept the information or not). But this is how you would do it. Maybe adding access mask to allow it, not sure. Step 1: Replace the html form input field. Find the following html code from the login form: Code:
<input type="hidden" name="server" value="website.com"> Code:
<select name="server"> <option selected="selected">Select Server</option> <option value="website1.com">Server 1</option> <option value="website2.com">Server 2</option> <option value="website3.com">Server 3</option> </select><br /> Step 2: Make sure a server was selected... (optional) Wouldn't want a 404, because the user didn't select a server, right? Well, either way, let's do this... Find the following in cpanel.php PHP Code:
PHP Code:
Choose Service Have you wanted to allow the login to not only be able to log into cPanel, but into webmail as well? Ah, well, this will allow you to do so, without losing the cpanel form as well! However, you can just edit the numbers in the cpanel.php if you don't want a multi-functional form ![]() Standard Port Numbers Standard WHM - 2086 Secure WHM - 2087 Standard Webmail - 2095 Secure Webmail - 2096 Step 1: Replace the html form input field. Find the following html code from the login form: Code:
<input type="hidden" name="port" value="2082"> Code:
Select Service<br /> <input name="port" type="radio" value="2082" checked="checked" /> cPanel<br /> <input type="radio" name="port" value="2086" /> WHM<br /> <input type="radio" name="port" value="2095" /> Webmail<br /> Unlike the last version of this script, your clients will need to "Confirm" their attempt to login. This can actually be more benefiting than just a requirement to have the script work, slowing bots or etc. This is needed so that it actually will submit the information to the cpanel server, for cpanel.php only processes what it was told to on the form, but cannot automatically login without confirmation :P The first part asks if the "submit" button was clicked. then it checks to make sure both fields "user" (username) and "pass" (password) have information values, if not display the following error, "Please complete all fields." as well as a "go back" link. However, if all information is found, then it proceeds with checking if the "secure" value equals "1" (aka, if the user has checked that he/she wants a SSL connection). If so, it will login using "https" and port "2083" (the secure cPanel port), if the box was unchecked, it will login using "http" and port "2082" (the insecure cPanel standard port). Then it gives a confirmation-like message which is more so needed to submit the information that was processed, to the cpanel location. That process is the secure feature and server request checking, but not processing the username/password. You may edit the HTML parts of the code as you wish, but keep the names and values of the form input items as well as the <form> tag(s). You can reorder them anyway you wish, just do not put them outside the <form> tags or change those attributes. Well, you can change the submit button's value, of course, but the others should be left alone. And that's it! It should all work well as long as you edited just that one part in the html form. About to write up additional customizations possibly, in my next post.
__________________
Wii Hotspot - Upcoming project! -http://www.wiihotspot.com
Make a cPanel Login Form | Why is my Account Suspended? |
|
|
|
| This user thanks GamingHybrid for this great post! | H&M's (January 12th, 2008) |
|
|
#2 (permalink) |
|
Surpass Abuse Admin
Super #1
Joined in Mar 2005
Lives in Houston, TX
Hosted on NONE
7,797 posts
Gave thanks: 11
Thanked 278 times
|
Great guide. Cleaned up the posts a bit (deleted the one in the middle) so you should be good to go now.
__________________
Unofficial IRC Channel: #surpass EFNetUnofficial = No official support. Support requests can be submitted to our helpdesk. |
|
|
|
|
|
#3 (permalink) | |
|
Bow before Surpass!
Super #1
Joined in Sep 2004
1,547 posts
Gave thanks: 91
Thanked 49 times
|
Quote:
So, to anyone, please wait until removed confirms that he has edited the first post before using this tutorial.
__________________
Wii Hotspot - Upcoming project! -http://www.wiihotspot.com
Make a cPanel Login Form | Why is my Account Suspended? |
|
|
|
|
|
|
#4 (permalink) |
|
Surpass Abuse Admin
Super #1
Joined in Mar 2005
Lives in Houston, TX
Hosted on NONE
7,797 posts
Gave thanks: 11
Thanked 278 times
|
Everything is good to go now.
![]()
__________________
Unofficial IRC Channel: #surpass EFNetUnofficial = No official support. Support requests can be submitted to our helpdesk. |
|
|
|
| This user thanks removed for this great post! | Patty (January 12th, 2008) |
|
|
#5 (permalink) |
|
Bow before Surpass!
Super #1
Joined in Sep 2004
1,547 posts
Gave thanks: 91
Thanked 49 times
|
Thank you, removed
I appreciate it.To anyone needing support, I'll give it! I'm subscribing to this thread. However, everything should go fine.
__________________
Wii Hotspot - Upcoming project! -http://www.wiihotspot.com
Make a cPanel Login Form | Why is my Account Suspended? |
|
|
|
| This user thanks GamingHybrid for this great post! | Patty (January 12th, 2008) |
|
|
#7 (permalink) |
|
Registered User
Excelling Contributor
Joined in Feb 2005
540 posts
Gave thanks: 86
Thanked 24 times
|
Thank you very much, GamingHybrid!!!
It's working 100% now with both IE and FF. : ![]()
__________________
Patty Pass 57 |
|
|
|
| This user thanks Patty for this great post! | GamingHybrid (January 14th, 2008) |
|
|
#8 (permalink) | |
|
Bow before Surpass!
Super #1
Joined in Sep 2004
1,547 posts
Gave thanks: 91
Thanked 49 times
|
Quote:
The method being used isn't loose like the old one, so it is much more secure (which the other was too, in a sense, just not like this version)I also hope you like the new addon features Thought it'd help since in the old thread, people were considering using the code with multiple forms (this reduces that need)Anyways, hope you enjoy it and to anyone else, please do post feedback. It helps me improve as well as know if it is working correctly or not.
__________________
Wii Hotspot - Upcoming project! -http://www.wiihotspot.com
Make a cPanel Login Form | Why is my Account Suspended? |
|
|
|
|
|
|
#9 (permalink) |
|
Registered User
Excelling Contributor
Joined in Feb 2005
540 posts
Gave thanks: 86
Thanked 24 times
|
Yeah, I love the addons!!! It's the icing in the cake! Great job!!
![]()
__________________
Patty Pass 57 Last edited by Patty; January 14th, 2008 at 8:21 AM.. |
|
|
|
| This user thanks Patty for this great post! | GamingHybrid (January 14th, 2008) |