The Community Forums

Interact with an entire community of cPanel & WHM users.
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Login Script

Discussion in 'General Discussion' started by SimplyJoeB, Aug 2, 2007.

  1. SimplyJoeB

    SimplyJoeB Registered

    Joined:
    Jul 7, 2007
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    I have searched the forums and I can't seem to locate the working answer. I have CPanel 11 and WHM and I have been testing some of the login scripts so I can have a log in box directly on my customer support page. However when I test them, they all take me to the x theme log in screen. I can't seem to get them to work. I see that there are some posts about changes in WHM to the Tweak settings. Any and all help will be greatly appreciated.

    Thanks
    Joe
     
  2. wsenter

    wsenter Well-Known Member

    Joined:
    Aug 5, 2003
    Messages:
    88
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Texas
    Post some script so that we can take a look at it. Otherwise it is not really possible to troubleshoot this.
     
  3. SimplyJoeB

    SimplyJoeB Registered

    Joined:
    Jul 7, 2007
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
  4. wsenter

    wsenter Well-Known Member

    Joined:
    Aug 5, 2003
    Messages:
    88
    Likes Received:
    0
    Trophy Points:
    6
    Location:
    Texas
    Post the ACTUAL script that you are using right now and I will help you go through it. You should have 2 main components..

    1. A simple form with a username / password box

    2. A script that it "posts" to the cpanel page.

    For example say you had the following variables (I'm writing this in php)

    PHP:
    $domain "domain.com";
    $username "bobby245";
    $password "pass2323";
    You would then build the URL like this...
    PHP:
    $url "http://".$username.":".$password."@".$domain.":2082/";
    Then either insert a static link on page OR use something like the http redirect to get the user to that page. Try writing out the code, testing it and then posting your results here.
     
  5. SimplyJoeB

    SimplyJoeB Registered

    Joined:
    Jul 7, 2007
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Here is the last one I was playing with

    Two PHP Script
    1)docpanellogin.php
    2)include_anywhere.php

    Code for docpanellogin.php

    <?php
    error_reporting(E_ALL ^ E_NOTICE);
    //Here we check if any field was missed / left empty and act accordingly
    if ($_POST['domain'] && $_POST['username'] && $_POST['pass'] && !($_GET['failed'] == "1"))
    {
    switch ($_POST['login_option'])
    {
    case "2082": $port = "2082";
    $protocol = "http://";
    break;
    case "2083": $port = "2083";
    $protocol = "https://";
    break;
    case "2086": $port = "2086";
    $protocol = "http://";
    break;
    case "2087": $port = "2087";
    $protocol = "https://";
    break;
    case "2095": $port = "2095";
    $protocol = "http://";
    break;
    case "2096": $port = "2096";
    $protocol = "https://";
    break;
    }

    $redirectlocation = $protocol.$_POST['domain'].":".$port."/login/?user=".$_POST['username']."&pass=".$_POST['pass']."&failurl=".$_POST['failurl'];
    header ("Location: ".$redirectlocation);
    }
    else
    {
    $error = 1;
    header ("Location: ".$_POST['failurl']);
    }
    ?>


    code for include_anywhere.php

    <?php
    $postlocation = "docpanellogin.php";
    print "<form action=\"" . $postlocation . "\" method=\"POST\">";

    if (($_GET['failed'] == "1") or ($error == 1))
    {
    ?>
    <font color=#FF0000 face=verdana size=1>Your login attempt failed!</font><br>
    <?php
    }
    ?>
    <font face="Verdana" size="1">Domain:</font>
    <input name="domain" class="input2" type="text" value="" style="width:110;height:18;font-family:Verdana; font-size:8pt" size="20" /><br>
    <font face="Verdana" size="1">Username:</font>
    <input name="username" class="input2" type="text" value="" style="width:110;height:18;font-family:Verdana; font-size:8pt" size="20" /><br>
    <font face="Verdana" size="1">Password:</font>
    <input name="pass" class="input2" type="password" value="" style="width:110;height:18;font-family:Verdana; font-size:8pt" size="20" />
    <?php
    print "<input type=hidden name=failurl value=\"http://" . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF'] . "?failed=1\">";
    ?>
    <br>
    <font face="Verdana" size="1">Options:</font>
    <select name="login_option" style="font-family: Verdana; font-size: 8pt;width:110;height:18">
    <option value="2082">cPanel </option>
    <option value="2083">Secure cPanel </option>
    <option value="2086">WHM</option>
    <option value="2087">Secure WHM</option>
    <option value="2095">Webmail</option>
    <option value="2096">Secure Webmail</option>
    </select>
    <br>
    <input class="input2" type="submit" value=" Click to Login " style="width:100;height:20;font-family:Verdana; font-size:8pt" onmouseout="blur(this);" />
    </form>
     
Loading...

Share This Page