Script to add cPanel/Wemail Login to Website

bribur

Registered
May 29, 2010
3
1
51
I couldn't find a good script to add a simple webmail login to our domain homepage, so I cut and paste and tweaked until I got something to work for us. Maybe it can work for others too. You'll have to replace the https://yourdomain.com:2096 in the first line with your webmail server info. Here is the script:

Code:
<div id="content-wrap"><form action="https://yourdomain.com:2096/login/" method="post"> <input name="login_theme" type="hidden" value="cpanel" /> 
<table class="login" style="width: 200px;" border="0" cellspacing="0" cellpadding="0">
<tbody style="text-align: left;">
<tr style="text-align: left;">
<td style="text-align: left;"><strong>Login</strong></td>
<td style="text-align: left;">&nbsp;</td>
</tr>
<tr style="text-align: left;">
<td class="login_lines" style="text-align: left;">Email:</td>
<td class="login_lines" style="text-align: left;"><input id="user" name="user" size="16" type="text" tabindex="1" /></td>
</tr>
<tr class="row2" style="text-align: left;">
<td class="login_lines" style="text-align: left;">Password:</td>
<td class="login_lines" style="text-align: left;"><input id="pass" name="pass" size="16" type="password" tabindex="2" /></td>
</tr>
<tr style="text-align: left;">
<td style="text-align: left;" colspan="2"><input id="login" class="input-button" type="submit" value="Login" tabindex="3" /></td>
</tr>
</tbody>
</table>
<input name="goto_uri" type="hidden" value="/?login_theme=cpanel" /> </form> <br /> <br />
<script type="text/javascript"><!--
/* Must not include external javascript -jnk 06.20.09 */
    var init = function() {
        document.getElementById("user").value = '';
        document.getElementById("pass").value = '';
        document.getElementById("user").focus();
    };
if( window.addEventListener ) {
    window.addEventListener('load',init,false);
} else if( document.addEventListener ) {
    document.addEventListener('load',init,false);
}
// --></script>
</div>
 
Last edited by a moderator:
Jun 5, 2010
5
0
51
Houston, TX
You might want to remove the <script> block

If you remove the <script>...</script> block from the code in the original post, it will allow the browser to auto-populate the input fields so you'll most likely only need to fill out the form once. The script makes your webmail more secure (in case anyone gets access to your browser); the absence of the script makes the form much more convenient to use.