cPanel::LogMeIn::get_loggedin_url(). This module will create a unique, single-use URL that will allow visitors to access their cPanel, WHM, or webmail interfaces.
The following is an example of how you can call cPanel::LogMeIn::get_loggedin_url():
#!/usr/bin/perl
use lib '/usr/local/cpanel';
use Cpanel::LogMeIn ();
my $user =
USERNAME; #cPanel, WHM, or Webmail username entered at login
my $pass =
PASSWORD; #cPanel, WHM, or Webmail password entered at login
my $host = DOMAIN
; #Domain name associated with the cPanel, WHM or webmail account being pulled from a database
my $service =
'cpanel'; #The service we want to login to (cpanel or whm or webmail)
my ( $login_ok, $login_message, $login_url ) =
Cpanel::LogMeIn::get_loggedin_url(
'user' => $user,
'pass' => $pass,
'hostname' => $host,
'service' => $service,
'goto_uri' => '/'
);
if ($login_ok) {
print "Location: $login_url\r\n\r\n";
}
else {
print "Content-type: text/plain\r\n\r\n";
print "LOGIN FAILED: $login_message\n";
}
In the example above, the username, password, and domain are handed off to cPanel::LogMeIn::get_loggedin_url(). This module then returns the URL. Copyright © cPanel 2000–2011.