Home » PHP scripts » One click login to cPanel / WHM / Webmail

Lately, I’ve been working on a small PHP application to log in on cPanel, WHM and Webmail at a click of a button.

At the moment, there are two main ways of logging in, through submitting a form or through a PHP implementation of LogMeIn.

Form submitting method
When logging in to one of the three services, cPanel does not check the referral, so anyone can make an external HTTP request to log in.

1
2
3
4
5
<form action="https://host:2083/login/" method="post">
        <input type="hidden" name="user" value="mycpaneluser" />
    <input type="hidden" name="pass" value="mycpanelpass" />
    <input type="submit" value="Login">
</form>

Note: Make sure to send the form through HTTPS so the data won’t be captured.

LogMeIn method
Kevin Mark created a really awesome implementation of LogMeIn class that you can find here.

Here is an example of how to use it:

1
2
3
4
<?php
$whm = new LogMeIn();
echo '<a href="' . $whm->getLoggedInUrl("mycpaneluser","mycpanelpass","host","cpanel") . '">Login to cPanel</a>';
?>

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*