Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Page 1 of 6 1 2 3 ... LastLast
Results 1 to 15 of 90
  1. #1
    Member Planet_Master's Avatar
    Join Date
    Apr 2002
    Location
    New Yorker
    Posts
    260

    Exclamation Webmail, Cpanel, WHM Logon scripts

    I noticed sites are actually charging for these scripts which is a sham. The script below allow your users to login to WHM, Cpanel, or Webmail on any server. These scripts can be easily modified for secure login and individual servers as well

    Webmail Login:

    In head section of page add:

    PHP Code:
    <script language="javascript"
    <!-- 
    Begin 
    function Login(form) { 
    var 
    username form.username.value
    var 
    password form.password.value
    var 
    server form.server.value
    if (
    username && password && server) {
    var 
    webmail="http://" username "+" server ":" password "@" server "/webmail" "/" username "+" server
    window.location webmail

    else { 
    alert("Please enter your username and password."); 


    // End --> 
    </script> 


    Add anywhere where you want the login box to appear, this can be fitted to match your site as well.

    PHP Code:
    <form name=login
    <
    table border=1 cellpadding=3
    <
    tr
    <
    td colspan=2 align=center
    <
    h2><b>Logon to NeoMail </b></h2
    </
    td
    </
    tr
    <
    tr
    <
    td>Username:</td
    <
    td
    <
    input type=text name=username size=20 maxlength="36"
    </
    td
    </
    tr
    <
    tr
    <
    td>Password:</td
    <
    td
    <
    input type=password name=password size=20
    </
    td
    </
    tr
    <
    tr
    <
    td>Your Domain:</td
    <
    td
    <
    input type=server value=domain.com name=server size=20
    </
    td
    </
    tr
    <
    tr
    <
    td colspan=2 align=center
    <
    input type=button value="Login!" onClick="Login(this.form)" name="button"
    </
    td
    </
    tr
    </
    table
    </
    form
    *****************************

    Cpanel Login:

    First create file named cpanel.php and insert the code below

    PHP Code:
    <?   
          
    if ($_POST["submit"]) {   
              if ((!
    $_POST["user"]) || (!$_POST["pass"]) || (!$_POST["yourdomain"])) {   
                  echo(
    "Please complete all fields.");   
              }   
              else {   
     
    ?>   
     <HTML> 
     <HEAD> 
     <META HTTP-EQUIV="refresh" content="0;URL=http://<?=$_POST["user"]?>:<?=$_POST["pass"]?>@<?=$_POST["yourdomain"]?>:2082"  
     </HEAD> 
     </HTML> 
     <? 
              
    }   
          }   
     
    ?>

    Then add this to where you want the login box, of course can be modified as long as input fields are correct.

    PHP Code:
    <form method="post" action="cpanel.php"
    <
    table border=1 cellpadding=3
    <
    tr
    <
    td colspan=2 align=center
    <
    h2><b>Logon to Cpanel </b></h2
    </
    td
    </
    tr
    <
    tr
    <
    td>Username:</td
    <
    td
    <
    input type="text" name="user" size='10'><br>
    </
    td
    </
    tr
    <
    tr
    <
    td>Password:</td
    <
    td
    <
    input type="password" name="pass" size='10'><br>
    </
    td
    </
    tr
    <
    tr
    <
    td>Your Domain:</td
    <
    td
    [
    url]www.[/url]<input type="text" name="yourdomain" size='20'>
    </
    td
    </
    tr
    <
    tr
    <
    td colspan=2 align=center
    <
    input type="submit" name="submit" value="Login!">
    </
    td
    </
    tr
    </
    table
    </
    form

    In cpanel.php change 2082 to 2083 for secure login.


    *****************************

    WHM Login:

    First create file named whm.php and insert the code below

    PHP Code:
    <?   
          
    if ($_POST["submit"]) {   
              if ((!
    $_POST["user"]) || (!$_POST["pass"]) || (!$_POST["yourdomain"])) {   
                  echo(
    "Please complete all fields.");   
              }   
              else {   
     
    ?>   
     <HTML> 
     <HEAD> 
     <META HTTP-EQUIV="refresh" content="0;URL=http://<?=$_POST["user"]?>:<?=$_POST["pass"]?>@<?=$_POST["yourdomain"]?>:2086"  
     </HEAD> 
     </HTML> 
     <? 
              
    }   
          }   
     
    ?>

    Then add the login box:

    PHP Code:
    <form method="post" action="whm.php"
    <
    table border=1 cellpadding=3
    <
    tr
    <
    td colspan=2 align=center
    <
    h2><b>Logon to Cpanel </b></h2
    </
    td
    </
    tr
    <
    tr
    <
    td>Username:</td
    <
    td
    <
    input type="text" name="user" size='10'><br>
    </
    td
    </
    tr
    <
    tr
    <
    td>Password:</td
    <
    td
    <
    input type="password" name="pass" size='10'><br>
    </
    td
    </
    tr
    <
    tr
    <
    td>Your Domain:</td
    <
    td
    [
    url]www.[/url]<input type="text" name="yourdomain" size='20'>
    </
    td
    </
    tr
    <
    tr
    <
    td colspan=2 align=center
    <
    input type="submit" name="submit" value="Login!">
    </
    td
    </
    tr
    </
    table
    </
    form


    In whm.php change 2086 to 2087 for secure login.

    These are basic scripts, nothing fancy, but they do work well.

    You can name the php files whatever you like just make sure to change the form method URL. You can modify these as far as the HTML look of the login boxes and the PHP coding to allow only individual servers. I posted the basics for all. In the webmail script, if you just want neomail replace "/webmail" with ":2095"
    Last edited by Planet_Master; 01-14-2004 at 06:11 PM.
    Vision Plateau Web Services - Total Control Hosting
    http://www.visionplateau.com

  2. #2
    Member
    Join Date
    Nov 2003
    Posts
    148

    Default

    This is fantastic! Thank you for the code... Just one question, does the webmail form work for Horde as well?

    Thanks,
    Alex
    Last edited by AlexF; 01-15-2004 at 11:26 AM.

  3. #3
    Member Planet_Master's Avatar
    Join Date
    Apr 2002
    Location
    New Yorker
    Posts
    260

    Default

    The webmail code sends you to the page with all 3 mail programs, Horde, Neomail, and squirrelmail. I guess it could be modified for just horde and squirrelmail as well.
    Vision Plateau Web Services - Total Control Hosting
    http://www.visionplateau.com

  4. #4
    Member
    Join Date
    Nov 2003
    Posts
    148

    Default

    Thanks for the quick reply, Planet_Master.

  5. #5
    Member
    Join Date
    Jun 2003
    Location
    New York
    Posts
    219

    Default

    You want to do some thing real cool with the web mail log on?

    add this little java script before the one planet_master has here:

    In order like this,
    +++++++++++++++++++++++++++++++++
    <script language="javascript">
    <!-- Begin
    var uri = '<!--#echo var="HTTP_HOST" -->'

    function urival() {
    document.login.server.value=uri;
    }
    window.onload=urival
    // End -->
    </script>

    <script language="javascript">
    <!-- Begin
    function Login(form) {
    var username = form.username.value;
    var password = form.password.value;
    var server = form.server.value;
    if (username && password && server) {
    var webmail="http://" + username + "+" + server + ":" + password + "@" + server + "/webmail" + "/" + username + "+" + server;
    window.location = webmail;
    }
    else {
    alert("Please enter your username and password.");
    }
    }
    // End -->
    </script>

    +++++++++++++++++++++++++++++++++++
    and change the domain name table inside the form to read :

    <tr>
    <td>
    Your Domain:</td>
    <td>
    <input type="text" value="" name="server" size=20>
    </td>
    </tr>
    <tr>
    ++++++++++++++++++++++++++++++++++++

    I had named the entire page webmail.shtml "remember .shtml" and uploaded it to my main account.

    Now here's the cool part if you don't mind adding entries to your httpd.conf

    open your httpd.conf in your fav editor you use on your server.

    scroll down to the bottom where cpanel adds their alias
    and right before them add:

    ScriptAlias /wmail /home/username/public_html/webmail.shtml

    of course username=name of main account you uploaded to

    I have chosen /wmail since this script does not work with default email accounts.

    you need to restart apache after you add the ScriptAlias

    Now you can go to any domian name on the server without the www. in front and the domain name will automatically be entered into the Domain Name area of the form.

    your webmail log on would be yourdomain.com/wmail

    Cool scripts Planet_Master!
    Last edited by pagedeveloping; 01-20-2004 at 08:05 AM.

  6. #6
    Registered User a66fm's Avatar
    Join Date
    Jul 2003
    Location
    Greece
    Posts
    78

    Default

    could this be altered so that you get directly to horde or sqmail

  7. #7
    Member
    Join Date
    Aug 2003
    Posts
    144

    Default

    This will probably not work anymore

    http://forums.cpanel.net/showthread....threadid=19740

  8. #8
    Member qbert1987's Avatar
    Join Date
    Dec 2003
    Location
    Canberra, Australia
    Posts
    130

    Default

    lol, nice work mate, i read the forums and thote, great, finaly somthing i can help with. but seems you where telling not asking. Awsem work mate, i realy dont like people trying to carge for an houer of coading.

  9. #9
    Registered User
    Join Date
    Feb 2004
    Posts
    4

    Default

    Originally posted by Planet_Master
    The webmail code sends you to the page with all 3 mail programs, Horde, Neomail, and squirrelmail. I guess it could be modified for just horde and squirrelmail as well.
    what would need to be changed to get it to go direct to squirrel ???

    the webmail code that is, nice one by the way I have it working here http://www.technosage.co.uk/test/techmail.htm

  10. #10
    Registered User a66fm's Avatar
    Join Date
    Jul 2003
    Location
    Greece
    Posts
    78

    Default

    nice look but it's not working

  11. #11
    Registered User
    Join Date
    Feb 2004
    Posts
    4

    Default

    Originally posted by a66fm
    nice look but it's not working
    how not working????

  12. #12
    Registered User a66fm's Avatar
    Join Date
    Jul 2003
    Location
    Greece
    Posts
    78

    Default

    i get script error on internet explorer 6.1, myie 0.9.16, mozilla firefox 0.8 and opera 7.23 does nothing when i press the logon button

  13. #13
    Registered User
    Join Date
    Feb 2004
    Posts
    4

    Default

    you have to allow cookies for the scripts to work

  14. #14
    Registered User a66fm's Avatar
    Join Date
    Jul 2003
    Location
    Greece
    Posts
    78

    Default

    i do!!

  15. #15
    Registered User
    Join Date
    Feb 2004
    Posts
    4

    Default

    you probs only allow session cookies ???

+ Reply to Thread
Page 1 of 6 1 2 3 ... LastLast
Similar Threads & Tags
Similar threads

  1. WHM changes site's IP on each logon
    By bastek72pl in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 05-13-2006, 06:08 AM
  2. Logon to Cpanel behind Nat?
    By xtscyah in forum New User Questions
    Replies: 1
    Last Post: 06-09-2005, 02:28 PM
  3. WHM and cPanel custom scripts - PWS Scripts Club
    By PWSowner in forum cPanel and WHM Discussions
    Replies: 5
    Last Post: 06-22-2004, 10:51 PM
  4. logon to whm
    By ClayW in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 03-05-2004, 01:55 AM
  5. Control Panel/Webmail logon problem
    By leigh in forum cPanel and WHM Discussions
    Replies: 1
    Last Post: 02-19-2004, 12:56 AM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube