secure cPanel auto login with PHP

irshad

Registered
Dec 18, 2014
2
0
1
cPanel Access Level
DataCenter Provider
i am trying to built an php page where users can click on button and login to cPanel as many of websites already have this feature.

i am searching for code on Internet from last 1 week and found one code mostly uses is

using hidden variable with form and submit the form.

PHP:
<?php 
    $domain ='dname'; 
    $user ='duser'; 
    $pass = 'dpass'; 
    $port = '2083'; 
    
	$port == "2083" || $port == "2096" ? $pre = "https://" : $pre = "http://"; 
	$action = $pre."".$domain.":".$port."/login/";
	
?> 
<body onLoad="setTimeout('document.forms[0].submit();',10)"> 
<form action="<?php echo $action;?>" method="post">
<input type="hidden" name="user" value="<?php echo $user; ?>"> 
<input type="hidden" name="pass" value="<?php echo $pass; ?>"> 
</form> 
</body> 
</html>
this works perfect but my concern is that these hidden fields can be viewed by source code or firebug.
is there any other way to login to cPanel without having user name & passwords in page or at least not viewable to user.
 

irshad

Registered
Dec 18, 2014
2
0
1
cPanel Access Level
DataCenter Provider
Hello,

Thanks for your reply but i am vary new to cpanel and all this stuff.

where do i put this code ?

can i put this code in any PHP file in any hosting account on any server ?

or i need to put this code in special php file in special directory of that server i am trying to login users?

Thanks