Results 1 to 3 of 3

Thread: external login form

  1. #1
    Registered User
    Join Date
    Jun 2012
    Posts
    2
    cPanel/WHM Access Level

    Root Administrator

    Question external login form

    Hi folks,

    I'm producing a form for my hosting site which will (hopefully) log users directly into cPanel on their account, but I'm having some difficulty with the script which handles the form submission.

    Whenever I test it it just shows me the cPanel login for the domain being submitted, it doesn't log in.

    Would anyone mind having a look at it?

    Code:
    <?php
    
    // using $_GET to test sending the variables, the final form will use $_POST for obvious reasons
    
    if($_GET == TRUE) {
    	$vars = array(
    		'domain' => $_GET['d'],
    		'user' => $_GET['u'],
    		'pass' => $_GET['p'],
    	);
    } else {
    	echo "no vars";
    	exit;
    }
    
    // the rest of this is the redirect
    
    $curlHandler = curl_init();
    
    $curlOpts = array(
    	CURLOPT_URL => "https://".$vars['domain'].":2083/login/",
    	CURLOPT_FRESH_CONNECT => true,
    	CURLOPT_HEADER => false,
    	CURLOPT_POSTFIELDS => http_build_query($vars, "", "&"),
    	CURLOPT_RETURNTRANSFER => true,
    	CURLOPT_USERAGENT => "SHcPanelReDirect/0.1"
    );
    
    curl_setopt_array($curlHandler, $curlOpts);
    
    if(false === ($responseString = curl_exec($curlHandler))) {
    	exit("0 - No connection to server.");
    }
    
    echo $responseString;
    
    ?>
    Thanks in advance


    Cheers,
    Robert

  2. #2
    Registered User
    Join Date
    Jun 2012
    Posts
    2
    cPanel/WHM Access Level

    Root Administrator

    Default Re: external login form

    ***bump***

  3. #3
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    7,611
    cPanel/WHM Access Level

    Root Administrator

    Default Re: external login form

    Hello Robert,

    I've moved this over to our developers section of the forum, since this is a coding question. You'll have better luck here getting assistance rather than in Themes & Branding area.

    Thanks!
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Technical Analyst III, Forums Specialist, cPanel Tech Support

    Submit a ticket | Check an existing ticket

Similar Threads

  1. External Login Form
    By Tempestshade in forum cPanel Developers
    Replies: 5
    Last Post: 05-11-2009, 04:45 PM
  2. cpanel login form
    By ZapX.net in forum cPanel & WHM Discussions
    Replies: 3
    Last Post: 04-28-2005, 05:38 PM
  3. MSIE Login Form
    By jimmshepard in forum cPanel & WHM Discussions
    Replies: 1
    Last Post: 02-05-2004, 03:57 PM
  4. Is it possible to login to cpanel using a form?
    By EdG in forum cPanel & WHM Discussions
    Replies: 3
    Last Post: 12-16-2003, 04:41 PM
  5. Cpanel Login Form
    By tsontag in forum cPanel & WHM Discussions
    Replies: 2
    Last Post: 06-19-2002, 01:51 PM