Web Hosting Talk







View Full Version : Login Box


ScionStatic(Stevo)
04-30-2005, 11:26 PM
Ive seen this on many hosting sites, and would like to add this to my new one im almost done with.

I have the box for username and password. I want it where when the page loads theres text in each that says "username" and the other "password". Then When they enter that and click the button, they enter their cpanel.

Do any of you know how to do this, or have any references for me to look at?

Thanks a bunch :)

namelayer
04-30-2005, 11:29 PM
There is a good how to in the cpanel forums for this. I have seen it done a few ways.

ScionStatic(Stevo)
05-01-2005, 12:11 AM
I looked in the control panel forum and didnt see anything, but i will continue to look. Links appreciated :D

mouldy_punk
05-01-2005, 03:08 AM
I'm not sure about cpanel, because I don't own a copy/have access to the files of it. But can you open the cpanel files and see where the form is, what the code is for it, then create a similar one in your website, eg, if the form in the cpanel code looks like;

<form action="login.php" method="post">
<input type="text" name="uname">
<input type="password" name="pword">
</form>

then you would create a form that will submit the details to the cpanel login.php file, and make sure the username and password fields are correctly named.

ScionStatic(Stevo)
05-01-2005, 11:00 AM
Thanks,

Do any of you know how to make it when the page loads in one box it has the text "username" and in the other "password" automatically?

mouldy_punk
05-01-2005, 12:46 PM
<input type="text" name="uname" value="Username">
<input type="password" name="pword" value="Password">

will7
05-01-2005, 02:41 PM
Add a bit of Javascript code so that when the box is clicked in, it makes the text disappear. Works more effectively:

onfocus="this.value=''";

Just add that to all your form fields. So, an example form field would be:

input type="text" name="nameHere" value ="Username" onfocus="this.value=''";

Will.

Oakii
05-01-2005, 06:39 PM
2 parts:

cplogin.php

<!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 = 'mydomain.com';

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>


login.html

<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>