Closed Thread Icon

Topic awaiting preservation: I know it's something really simple (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=8868" title="Pages that link to Topic awaiting preservation: I know it&amp;#039;s something really simple (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: I know it&#039;s something really simple <span class="small">(Page 1 of 1)</span>\

 
savagegerbil
Obsessive-Compulsive (I) Inmate

From: sarasofta
Insane since: Sep 2003

posted posted 09-25-2003 09:24

I am trying to make a login box where my customers can put their username, password, and domain name into some input boxes and once they click it they will be redirected into the control panel. heres the code I've been working on for the past I dont know how long...

<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="Password"> &nbsp;<br>
<input type="text" name="domainl" size="20" value="Domain.com"> &nbsp;<br>
<br>
<SCRIPT LANGUAGE="JavaScript">
var n = window.document.username
var p = window.document.password
var d = window.document.domain

document.writeln('<a href=');
document.writeln('\"');
document.writeln('https://');
document.writeln(n)
document.writeln(':')
document.writeln(p)
document.writeln('@');
document.writeln(d);
document.writeln(':2083')
document.writeln('"')
document.writeln('>');

</script>
<img border="0" src="bullet.jpg" width="11" height="11"><font face="Verdana" color="#FF6600" size="2">Submit</font>
</a>
</script>

any help or suggestions would be greatly appreciated!

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 09-25-2003 10:43

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

posted posted 09-25-2003 12:32

InI: Not to mention that document.writeln( "blah blah" ) actually inserts a new line feed after blah blah which ruins the tag savagegerbil is writting.

savagegerbil: I suggest you to follow InI's event driven solution and simply change the location of the document with parameters entered in the form

code:
<input type="button" onclick="answerToClickie( this.form )">
<script type="text/javascript">

function answerToClickie( formHandle )
{
newLocation = "https://"+ formHandle.name.value +":"+ formHandle.password.value +"@"+ formHandle.domainl.value +":2083"
document.location = newLocation
}

</script>

You should add some code to check the form fields are not empty or respect some rules ( i.e. 6 characters minimum for the password, etc ... )

Cheers,


Mathieu "POÏ" HENRI

savagegerbil
Obsessive-Compulsive (I) Inmate

From: sarasofta
Insane since: Sep 2003

posted posted 09-26-2003 10:33

ok, ive cleaned it up and did everything suggested but it just redirects it to the same page. and when I leave an input blank, the alert doesnt pop up.

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 Domain Name.");
}
}
// 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="Password"> &nbsp;<br>
<input type="text" name="domainl" size="20" value="Domain.com"> &nbsp;<br>
<br>
<input border="0" src="bullet.jpg" name="I1" width="62" height="11" type="image" onClick="Login()"></font>


</form>

poi
Paranoid (IV) Inmate

From: France
Insane since: Jun 2002

posted posted 09-26-2003 11:30

savagegerbil: You did another ( see your first post ) typo
you wrote var server = log1.domain1.value; while you've declared you form field <input type="text" name="domainl" size="20" value="Domain.com">. Be consistent with the naming of your variables and it should work. That kind of problem comes either from the font size in your editor or from a lack of attention.
Regarding the problem that occurs when you let an input blank, it comes from the way you test the variables. You consider them like some booleans ( or numbers ) while they are some strings, thus your test should be:

code:
if ( username!="" && password!="" && server!="" )

Now, for the redirection that goes to the same page, we forgot to mention that you must cancel the normal behavior of the button, for this you have to add ;return false right after calling the Login() function.

Cheers,

Mathieu "POÏ" HENRI

« BackwardsOnwards »

Show Forum Drop Down Menu