Click to See Complete Forum and Search --> : using a form to log into a domain control panel


savagegerbil
09-26-2003, 08:45 PM
Hey, i am trying to use a form to log into a domain control panel. cpanel. but something is up with my code, and I have no idea where the problem is. can anyone tell me what they think might be the problem? basicly the user put's in their username, password and domain name, once they hit submit it pulls the login function and supposed to redirect the url to their panel but it just refreshes the screen and nothing happens.

heres what I got...


<form name="log1">
<SCRIPT LANGUAGE="JavaScript">
function Login() {
var username = log1.username.value;
var password = log1.password.value;
var server = log1.domain1.value;
if (username && password && server) {
var dsite = "https://" + username + ":" + password + "@" + server + ":2083";
document.location = dsite;
}
else {
alert("Please enter your username, password, and FTP server's address.");
}
}
// End -->
</script>

<input type="text" name="username" size="20" value="username"><font size="2">
</font><b><font face="Verdana" size="1" color="#666666"><br>
<input type="password" name="password" size="20" value="123456"> &nbsp;<br>
<input type="text" name="domain1" size="20" value="domain.com"> &nbsp;<br>
<br>
<input border="0" src="bullet.jpg" name="I1" width="62" height="11" type="image" onClick="Login();return=false"></font>


</form>

Jupac
09-26-2003, 08:59 PM
try document.log1.blah.value;

savagegerbil
09-26-2003, 10:45 PM
no, that didnt do it either. aw pooty. this thing has been giving me fits for the past 2 days. I know it's something really simple I just cant figure it out

Jupac
09-27-2003, 12:48 PM
<SCRIPT LANGUAGE="JavaScript">
function Login() {
var username = document.log1.username.value;
var password = document.log1.password.value;
var server = document.log1.domain1.value;
if (username && password && server) {
var dsite = "https://" + username + ":" + password + "@" + server + ":2083";
document.location.href = dsite;
}
else {
alert("Please enter your username, password, and FTP server's address.");
}
}
// End -->
</script>



<form name="log1">
<input type="text" name="username" size="20" value="username"><font size="2">
</font><b><font face="Verdana" size="1" color="#666666"><br>
<input type="password" name="password" size="20" value="123456"> <br>
<input type="text" name="domain1" size="20" value="domain.com"> <br>
<br>
<input type="button" onClick="Login();"></font>


</form>

i no y u put <form>then<script>

savagegerbil
09-27-2003, 12:56 PM
ya,

put <form> <script> code</script> form code</form>

Jupac
09-27-2003, 01:05 PM
the code i posted works

savagegerbil
09-27-2003, 01:44 PM
oh sorry, I misunderstood what you meant. I guess being up for 25 hrs straight makes me stupid like that :D

Awesome, it works! and now I know what was causing the problem, the stupid image I was using for the form submit button

Jupac
09-27-2003, 01:52 PM
happy to help