Page 1 of 2 12 LastLast
Results 1 to 40 of 63
  1. #1
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    4,695

    Form Based cPanel Login (after IE fix)

    As you know because of a recent IE patch the old form based cPanel logins directing to a url such as http://user:[email protected] no longer work for most people.

    cPanel have added a built in form to cPanel 9.0 so you just need to send the values "user" and "pass" to that form and away you go.

    You can post the values to any of the following:

    http://yourdomain.com:2082/login/ (cPanel)
    https://yourdomain.com:2083/login/ (secure cPanel)

    http://yourdomain.com:2095/login/ (webmail)
    https://yourdomain.com:2096/login/ (secure webmail)


    Here's a little script you're welcome to use if you like, that gives people the choice of all four logins.

    1. save this as cplogin.php (edit the line with your domain or ip)

    PHP Code:
    <html>
    <?php

      
    #your domain or ip
      
    $domain "yourdomain.com";

       if(!
    $_POST['login']) {
       exit;
       }

       
    $user $_POST['user'];
       
    $pass $_POST['pass'];
       
    $port $_POST['port'];

       
    $port == "2083" || $port == "2096" $pre "https://" $pre "http://";
    ?>
    <body onLoad="setTimeout('document.forms[0].submit();',10)">
    <form action="<?php echo "".$pre."".$domain.":".$port."/login/"?>" method="post">
    <input type="hidden" name="user" value="<?php echo $user?>">
    <input type="hidden" name="pass" value="<?php echo $pass?>">
    </form>
    </body>
    </html>
    2. Then the form to use on your site

    Code:
    <form action="cplogin.php" method="post">
    <table cellspacing="4" cellpadding="0">
     <tr><td>Username:</td><td><input type="text" name="user"></td></tr>
     <tr><td>Password:</td><td><input type="password" name="pass"></td></tr>
     <tr><td>Login To:</td>
     <td align="right">
     <select name="port">
     <option value="2082">cPanel</option>
     <option value="2083">Secure cPanel</option>
     <option value="2095">Webmail</option>
     <option value="2096">Secure Webmail</option>
     </select>
     </td></tr>
     <tr><td align="right" colspan="2">
     <input type="submit" name="login" value="login" style="cursor:pointer">
     </td>
    </tr>
    </table>
    </form>
    This should work for most browsers, but remember you need to be running cPanel 9.0 or above.

  2. #2
    Join Date
    Dec 2002
    Location
    The Shadows
    Posts
    2,913
    login.php also works on most CPanel installations.

    Give me a couple hours to get home, and I will approve this.

  3. #3
    Join Date
    Oct 2003
    Posts
    74
    hi,does this script work in cpanel 8 ? (the one you posted) I can't get it to work

  4. #4
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    4,695

    Re: Form Based cPanel Login (after IE fix)

    Originally posted by Loon
    remember you need to be running cPanel 9.0 or above.
    It will not work in versions prior to 9.0

  5. #5
    Join Date
    Jan 2001
    Location
    Illinois, USA
    Posts
    7,147
    Thanks

  6. #6
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    4,695
    A little update that somebody requested.

    If you add this line in cplogin.php below the line that starts $post == "2083" then people can login to webmail accounts without having to put the full domain name:

    e.g: somebody with [email protected] can just put the username as "john" or use "[email protected]" either will work, currently you need to use [email protected]

    PHP Code:
    $port == "2095" || $port == "2096" && !eregi("@"$user) ? $user "".$user."@".$domain."" $user $user
    * edit, it's one line copy + paste, the forum breaks it into two.

  7. #7
    Join Date
    Mar 2004
    Location
    TN, USA
    Posts
    35
    Hi Loon, I tried to install your script and it didn't work. I am using cPanel - 9.1.0-RELEASE 52. It takes me to a page "Access Denied" with a form for login where I can type my user name and password. But typing username and password in the 'Access denied" form is not a good way to go. I am hoping to get some lead from you...

    Thank you in advance

  8. #8
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    4,695
    There's no reason it shouldn't work, it'll take you to an access denied page if you have the username or pass wrong, just the same as it would logging in the regular way.

    If you're trying to log into webmail you need to use [email protected] as the username unless you made the edit and added the extra line i posted.

    Other than that just double check you have the domain right in cplogin.php and make sure there's no http:// or www at the beginging.

  9. #9
    Join Date
    Mar 2004
    Location
    TN, USA
    Posts
    35

  10. #10
    Join Date
    Mar 2004
    Location
    Ireland
    Posts
    2
    Are you sure you changed the domain variable??

    Someone requested this change over at the cpanel forums.

    One small question, how can we change it so that customers have to enter their domain name? Many of our customers have their own IP.
    Change the code to this :

    EDIT : I'm not allowed to post urls so to show you the code I've attached a text file.
    Attached Files Attached Files

  11. #11
    Hey, I love this script, but when i use it on my site, its takes a second for the wrong password screen to pop up but takes like 3 minutes to load when they use the right passwords, im using cpanel 9.4.1 does anyone knw what to do?

  12. #12
    hi i did this its works great but itts there a way, that you can hide the domaininsede the code?

    I mean to eliminate the form of the domain and have it automaticall inside the code..

    thx

  13. #13
    ok,thanks

  14. #14
    Join Date
    Mar 2003
    Location
    New York
    Posts
    54

  15. #15
    Join Date
    Jul 2002
    Location
    Kuwait
    Posts
    10,573
    change this line if u want to add WHM for cplogin.php
    from
    PHP Code:
    $port == "2083" || $port == "2096" $pre "https://" $pre "http://"
    to
    PHP Code:
       $port == "2083" || $port == "2096" || $port == "2087" $pre "https://" $pre "http://"
    and
    in the html file add those options
    Code:
     <option value="2086">WHM</option>
     <option value="2087">Secure WHM /option>
    Bashar Al-Abdulhadi - KuwaitNET Internet Services Serving customers since 1997
    Kuwait's First Webhosting and Domain Registration provider - an ICANN Accredited Registrar

    Twitter: Bashar Al-Abdulhadi

  16. #16
    Join Date
    Apr 2002
    Location
    Hollywood, CA
    Posts
    3,046
    Has anyone been able to get some thing like :

    <input type="image" src="/images/submit.png"

    I know the plain submit button works fine because i testedit, but i want to use an image for a submit button and it isnt working at all? Any suggestions ?

  17. #17
    Join Date
    Apr 2003
    Location
    London, UK
    Posts
    4,695
    make sure you specify the name for the input as "login" otherwise the script will just exit.

    Code:
    <input type="image" name="login" src="./img.gif" alt="Login" />

  18. #18
    Join Date
    Aug 2002
    Location
    Bharat
    Posts
    4,722
    Originally posted by Loon
    make sure you specify the name for the input as "login" otherwise the script will just exit.

    Code:
    <input type="image" name="login" src="./img.gif" alt="Login" />
    Nope

    Code:
    <input type="image" name="login" src="./img.gif" alt="Login" />
    is not working, its only

    Code:
    <input type="submit".....
    That works.

    So any one out there found something on it?
    Vinsar.Net - Quality Web Hosting at Economical Price on USA & European Servers
    Offering domains, shared, reseller & VPS hosting.
    Reliable Domain Reseller Account Resell Domains with Confidence

  19. #19
    Join Date
    Mar 2004
    Location
    TN, USA
    Posts
    35
    Just after closing the form tag (</FORM>), try the following code:

    <A href="javascript:document.cpanel.submit()"><IMG src="./img.gif" width="120" height="33" border="0" alt="Login"></A>

    [Note: In the above example 'cpanel' is the form name -- <FORM name="cpanel"...>]

  20. #20
    Dear Loon

    I am Peter. I have seen your post and have also enable the CPanel Login as well as Webmail Login by using the code which you posted. Its very nice and working fine with my domain. Here I want to tell you that I have my own Cpanel server and was founding the same code fot my Cpanel and Webmail requirements and I am very much pleased to got it.

    Now I need your help again to enable SMS service on my domain. So please help me out in this metter also and send me simple PHP code for SMS as like earlier that you have sent for Cpanel and Webmail Login Page. Pleae help me as I am so much confused and looking for your kind favor. I will be very thanful to you.

    Again requesting for your help.

    Regards
    Peter
    Last edited by PeterS; 11-06-2004 at 03:29 AM.

  21. #21
    Join Date
    Feb 2004
    Location
    Wisconsin
    Posts
    90
    I wonder if I'm missing something because I got the form to show up fine but when I click on the login button all that happens is I get the cplogin.php as PHP code showing up on my screen as text. What did I miss?

  22. #22
    Join Date
    Jul 2002
    Location
    Kuwait
    Posts
    10,573
    seems php isn't enabled?
    Bashar Al-Abdulhadi - KuwaitNET Internet Services Serving customers since 1997
    Kuwait's First Webhosting and Domain Registration provider - an ICANN Accredited Registrar

    Twitter: Bashar Al-Abdulhadi

  23. #23
    Join Date
    Feb 2004
    Location
    Wisconsin
    Posts
    90
    Nope, I figured out the problem... I saved the file wrong. Fixed it.

  24. #24
    Thank you for sharing this, I know it's a bit old thread but still useful!

  25. #25
    the code works great in firefox but I allways get login failed in IE

    Any clue/solution?

  26. #26
    Join Date
    Feb 2001
    Location
    UK
    Posts
    458

    Works great

    Have tried it on my site and seems to work perfect.

    Theres just one thing I'd like and thats for clients cpanels to open in a new window, is that possible?

    Thanks.

  27. #27
    Ok Im sorry I know this is an old topic but Im using this form and Im a form noob. Is there a way to make this form strictly for webmail? I removed the other options so it always logs in as webmail but i would like the option box to not be visible...so it would just be a name and password box type form...im sure you know what im talking about, also is there a way to make it go straight to neomail? Sorry these are probably very noob questions but I am very noob. So any help would be very much appreciated! Thanks!

    -Kodene

  28. #28
    Join Date
    Aug 2002
    Location
    Bharat
    Posts
    4,722
    Well here is what you want I think:

    For the Form
    HTML Code:
    <html>
    <head>
    <title>Webmail Login</title>
    </head>
    <body>
    <form name="Login" method="post" action="login.php">
      WebMail Login<br>
      User Id 
      <input name="domain" value="yourdomain.com" type="hidden"> 
    <input name="user" type="text" size="12">
      <br>
      Password 
      <input name="port2" value="2095" type="hidden">
    <input name="pass" type="password" size="12">
      <br>
      <input type="submit" name="login2" value="Submit">
    </form>
    </body>
    </html>
    And for the login script
    PHP Code:
    <?php
       
    #your domain or ip
       
    $domain $_POST['domain'];
       if(!
    $_POST['login']) {
       exit;
       }
       
    $user $_POST['user'];
       
    $pass $_POST['pass'];
       
    $port $_POST['port'];
       
    $port == "2083" || $port == "2096" $pre "https://" $pre "http://";
       
    $port == "2095" || $port == "2096" && !eregi("@"$user) ? $user "".$user."@".$domain."" $user $user;
    ?>
    <HTML>
    <HEAD>
    <TITLE>WebMail Login</TITLE>
    </HEAD>
    <BODY LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 onLoad="setTimeout('document.forms[0].submit();',10)">
    <form action="<?php echo "".$pre."".$domain.":".$port."/login/"?>" method="post">
    <input type="hidden" name="user" value="<?php echo $user?>">
    <input type="hidden" name="pass" value="<?php echo $pass?>">
    </form>
    <br><br><br><br>
    <div align="center">Wait till we log you in!!!</div>
    </BODY>
    </HTML>
    Vinsar.Net - Quality Web Hosting at Economical Price on USA & European Servers
    Offering domains, shared, reseller & VPS hosting.
    Reliable Domain Reseller Account Resell Domains with Confidence

  29. #29
    Hey Vinsar thank you for posting that code. But it doesnt work. When you go to login in just goes to a black screen which I am certain is the php page. Is supposed to go straight to neomail? Do you know what might be wrong with it? Like I said I have no idea what im doing when it comes to forms! So sorry if this just seems like a stupid question. Thanks again!

    -Kodene

    PS: now that im thinking about, it is there a way to make the domain a choice of two? For instance have a drop menu or option menu or whatever its call to select the domain they want to log into?

  30. #30
    Join Date
    Aug 2002
    Location
    Bharat
    Posts
    4,722
    Sorry for the late reply I had been away for a while.

    Well you know the code above is for two pages, first one is the HTML FORM page and second one is a PHP page, so when you type in the values in the first page they are passed on to the PHP script which in turn process the login and send you to cPanel Mail management page from where you can select Neomail Horde or Squirrelmail.

    BTW have you changed the yourdomain.com to proper name?
    Vinsar.Net - Quality Web Hosting at Economical Price on USA & European Servers
    Offering domains, shared, reseller & VPS hosting.
    Reliable Domain Reseller Account Resell Domains with Confidence

  31. #31
    Quote Originally Posted by vinsar
    Sorry for the late reply I had been away for a while.

    Well you know the code above is for two pages, first one is the HTML FORM page and second one is a PHP page, so when you type in the values in the first page they are passed on to the PHP script which in turn process the login and send you to cPanel Mail management page from where you can select Neomail Horde or Squirrelmail.

    BTW have you changed the yourdomain.com to proper name?
    Oh, I wasnt even paying attention. Didnt notice it was php and html, thats whay it doesnt work. I already have a form like this that works but is what Im looking for is one that will open directly into a neomail account. Is this possible? Yes I did change the "domain.com" to my domain. Also is there a way to make it where you can choose the domain? For instance have a drop down option box to select the domain of choice? Thanks again for your time!

  32. #32
    Join Date
    Aug 2002
    Location
    Bharat
    Posts
    4,722
    Well going directly to neomail is not possible at the moment as far as I know, and for the drop down menu option you may change the "yourdomain.com" attribute from hidden to list/menu. Like

    Code:
      <select name="select">
        <option selected>Select Domain</option>
        <option value="1stdomain.com">1stdomain.com</option>
        <option value="2nddomain.com">2nddomain.com</option>
        <option value="3rddomain.com">3rddomain.com</option>
      </select>
    Or you may use the original code provided by Loon to type in the complete email id as user name.
    Vinsar.Net - Quality Web Hosting at Economical Price on USA & European Servers
    Offering domains, shared, reseller & VPS hosting.
    Reliable Domain Reseller Account Resell Domains with Confidence

  33. #33
    Quote Originally Posted by vinsar
    Well going directly to neomail is not possible at the moment as far as I know, and for the drop down menu option you may change the "yourdomain.com" attribute from hidden to list/menu. Like

    Code:
      <select name="select">
        <option selected>Select Domain</option>
        <option value="1stdomain.com">1stdomain.com</option>
        <option value="2nddomain.com">2nddomain.com</option>
        <option value="3rddomain.com">3rddomain.com</option>
      </select>
    Or you may use the original code provided by Loon to type in the complete email id as user name.
    Thanks Again!

  34. #34
    Join Date
    Sep 2005
    Posts
    152
    Very useful thread this

    Anyone know how you would get it to log into a billing system, like ClientExec?
    Big Wow Web Hosting
    Cheap and Reliable Shared and Reseller Hosting
    •99.9% Uptime •MailScanner •Free Setup and Sitebuilder •Plesk, cPanel or DirectAdmin
    •Fast, Secure Servers •Great Free Extras •100% White Label

  35. #35
    Hi,
    I was wondering if anyone could help me.
    Ive got this script on my site, works fine...except
    the login to box with the selections in is to big and because my sites made up with tables and the login is on the left its pushed half of my site out to the right,

    Does anyone know how to get the login into box to move down, ive tried <br> ect and everything else i can think of to try and move it,

    Heres an example of what i mean:

    Username: [------------]
    Password: [------------]
    Login to:
    [-----------------]

    [Login]

    Thanks

  36. #36
    Join Date
    Jun 2005
    Location
    USA
    Posts
    31
    I would also be interested in adapting this to log into Clientexec and directi to allow my customers to manage billing and domain issues.

    If anyone has suggestions on how this could be done, I'd love to hear them.

  37. #37
    Join Date
    Apr 2002
    Location
    New York City!
    Posts
    311
    Quote Originally Posted by jsgilly20
    Hi,
    I was wondering if anyone could help me.
    Ive got this script on my site, works fine...except
    the login to box with the selections in is to big and because my sites made up with tables and the login is on the left its pushed half of my site out to the right,

    Does anyone know how to get the login into box to move down, ive tried <br> ect and everything else i can think of to try and move it,

    Heres an example of what i mean:

    Username: [------------]
    Password: [------------]
    Login to:
    [-----------------]

    [Login]

    Thanks
    I beleive you can add those log-in sections into another ROW in the table to get it to all line up evenly.

    So you can have:

    USER
    -------------------
    log-in section
    -------------------
    PASSWORD
    -------------------
    log-in section
    -------------------
    SUBMIT



    David K.

  38. #38
    I have recently tried this script and for some reason it takes me to cplogin.php and it is just a blank page.
    Thanks, Kevin

  39. #39
    Join Date
    Sep 2005
    Posts
    152
    You did put the content in the cplogin.php page?
    Big Wow Web Hosting
    Cheap and Reliable Shared and Reseller Hosting
    •99.9% Uptime •MailScanner •Free Setup and Sitebuilder •Plesk, cPanel or DirectAdmin
    •Fast, Secure Servers •Great Free Extras •100% White Label

  40. #40
    of course, here it is

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <title>Logging In ...</title>
    <?php

    # domain or ip (no http://)
    $domain = 'my ip';

    if(!$_POST['login']) exit;

    $user = $_POST['user'];
    $pass = $_POST['pass'];
    $port = $_POST['port'];

    $port == '2083' || $port == '2096' ? $pre = 'https://' : $pre = 'http://';
    $port == '2095' || $port == '2096' && !eregi('@', $user) ? $user = $user.'@'.$domain : $user = $user;

    ?>
    <meta http-equiv="Content-Language" content="en" />
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
    <body onLoad="setTimeout('document.forms[0].submit();',10)">
    <form action="<?php echo $pre.$domain.':'.$port.'/login/'; ?>" method="post">
    <input type="hidden" name="user" value="<?php echo $user; ?>" />
    <input type="hidden" name="pass" value="<?php echo $pass; ?>" />
    </form>
    </body>
    </html>
    Thanks, Kevin

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •