Logging Into cPanel In the Background

cardine

Member
May 17, 2006
14
0
151
Right now I am trying to set-up a customized cPanel. I have one master cPanel account, and I am using databases to sort out which ftp and mysql goes to which account. For me this has been the easiest way.

Now here is where the trouble is. I have been able to script creating the FTP accounts, MySQL, and everything else fine. The only problem is I can run the scripts after I enter in the master username and password (when it pops up on my page). Now I couldn't possibly give the log-in informations to my customers because then they could just log right into cPanel and have control over everything!

So I need to automatically log into cPanel in the background, so the user isn't even prompted for a username and password, and I'll let my databases do the rest of the sorting out.

Right now I have this script (which is a modified version of a manual log-in script I found on this forum):

PHP:
<?php
  $domain = 'domain.com';
	$user = 'usernamel';
	$pass = 'password';
	$port = '2082';
    $pre = 'http://';
?>
<body onLoad="setTimeout('document.forms[0].submit();',10);">
<form action="<?php echo $pre.$domain.':'.$port.'/login/'; ?>" method="post">
            
            
    <p><input type="hidden" name="user" value="<?php echo $user; ?>" />
      <input type="hidden" name="pass" value="<?php echo $pass; ?>" />
</p>
</form>
Now when I run the script, it automatically logs me in, and brings me to the main cPanel page. However I do not want to be redirected there because I do not want my customers to have access to all of the accounts, or to even access cPanel at all. So I tried using it in an inline frame, and that didn't work (I don't know why), and if I load it from a popup, I have no way to close it, so the user can still use it.

So I would like to know if there is another alternative, or if there is another way to manipulate this code to allow me to automatically log-in without my users even knowing.

Thank-you! :D
 
Last edited:

Genius45

Registered
Jan 21, 2005
2
0
151
They have some other tools in PHP that do something like what your asking. You're safest bet to achieve this is to use PHP to open the page itself and parse the data. I suggest you look into the fopen function and use the format "protocol://username:[email protected]" which by your script variables would be something like "http://username1:[email protected]"

I don't recommend really having an iframe, frame, page, popup, or anything else available to your customers that contains information that they shouldn't see.

This isn't the best class, and it uses fsockopen instead of fopen, but its basically the same idea.

Cpanel X PHP Class