trumpetblast

Registered
Apr 15, 2010
4
1
51
Everything I've found on the web says that you should be able to login to cPanel automatically via a URL that looks like this:

http://DOMAINNAME:2082/login/?user=YOURUSERNAME&pass=YOURPASSWORD

However, this is not working for me. I just get the login page with "Login Attempt Failed!" in red text.

Any ideas on how to fix this? Any alternative url structures? Or perhaps there's some setting in cPanel/WHM that needs to be changed to allow for this?
 

trumpetblast

Registered
Apr 15, 2010
4
1
51
OK let me elaborate.

We are on a VPS. I spoke with HostGator support and they have the same problem, cannot login by using a URL in the above-mentioned format. However, such a format works just fine on their shared hosting.

The tech told me there must be some switch to flip somewhere that will allow this to work, but he had no idea where.

I've been looking around in our WHM, specifically in Security section of Tweak Settings. However, I've yet to find anything that resolves this problem.

Any ideas?
 

trumpetblast

Registered
Apr 15, 2010
4
1
51
Good God, this really should not have been so difficult to resolve. But finally I have, so here's the answer for the benefit of future fellow hair-puller-outters:

If the URL format mentioned above doesn't work for you, try making a form and posting the required information to the URL instead.

I could swear that I tried this at one point and it didn't work, but it does work now, so no complaints.

There's a rather thorough example in PHP here: SampleBrandedLogin < AllDocumentation < TWiki

The following, however, is my somewhat simplified version, which will work for logging into cPanel (2082) only:

Code:
<?php
    $href = 'example.com:2082/login/';
    echo "<form action=\"$href\" method=\"POST\"";
    echo "<input type=\"hidden\" name=\"user\" value=\"$user\"";
    echo "<input type=\"hidden\" name=\"pass\" value=\"$pass\"";
    echo "<input type=\"hidden\" name=\"failurl\" value=\"$href\"";
    echo "<input type=\"hidden\" name=\"login_theme\" value=\"default\"";
    echo "<input type=\"submit\" value=\"Login\"";
?>
Since I already know the user's username & password, no need to ask them for it, I just pass it in variables.

Hope this helps someone.