loading

This instructable is about how to make a username(s) with a password for a sign in form. (or really for whatever you want to do with it).

What you need:

Simple typing program (Notepad is preferred)

A computer

A brain

That's it!

Step 1: The Code:

<html>

<head>

<script>

function Login(form) { username = new Array("username goes here"); password = new Array("password goes here"); page = "Name of html file to open when you push log in goes here" + ".html"; if (form.username.value == username[0] && form.password.value == password[0] || form.username.value == username[1] && form.password.value == password[1] ||

form.username.value == username[2] && form.password.value == password[2] || form.username.value == username[3] && form.password.value == password[3] ||

form.username.value == username[4] && form.password.value == password[4] || form.username.value == username[5] && form.password.value == password[5] ||

form.username.value == username[6] && form.password.value == password[6] || form.username.value == username[7] && form.password.value == password[7] ||

form.username.value == username[8] && form.password.value == password[8] || form.username.value == username[9] && form.password.value == password[9]) { self.location.href = page; } else { alert("Either the username or password you entered is incorrect.\nPlease try again."); form.username.focus(); } return true; }

</script> </head> <body bgcolor="#eeeeee"> <form> <br> <center> <h5>Username: <input type="text" name="username" style="background:#bfbfbf;color:#212121;border-color:#212121;" onFocus="this.style.background = '#ffffff';"

onBlur="this.style.background = '#bfbfbf';"> <br> Password: <input type="password" name="password" style="background:#bfbfbf;color:#212121;border-color:#212121;" onFocus="this.style.background = '#ffffff';"

onBlur="this.style.background = '#bfbfbf';"> <br> <input type="button" value="Login" onClick="Login(this.form);" style="background:#bfbfbf;color:#000000;border-color:#212121;" onMouseOver="this.style.color =

'#404040';" onMouseOut="this.style.color = '#000000';" onFocusr="this.style.color = '#404040';" onBlur="this.style.color = '#000000';"></h5> </center> </form> </body> </html>

Step 2: The Outcome

Try it! The username is "instructables", and the password is gogoguy. When you push "login", it should take you to google.com.

http://drive-html-viewer.pansy.at/?state=%7B%22ids...

<p>to open the link, right click it and then push &quot;go to http://drive-html-viewer.pansy.at/?state=%7B%22ids%22:%5B%220B1QDlKbOmLfiSGZnQUx2cmRfSTA%22%5D,%22action%22:%22open%22,%22userId%22:%22111715455346247284542%22%7D&quot; when you do that, and log in, it might not work because i'm using google drive to host the link. but don't worry, all you have to do is copy and paste the code into notepad, and then save it as &quot;whatever.html&quot;.</p>
<p>what do u save it as?</p>
<p>How do you add multiple <strong>usernames </strong>and <strong>passwords</strong>?</p>
<p>Re copy and paste the last function</p><p>function Login(form) { username = new Array(&quot;1&quot;); password = new Array(&quot;2&quot;); page = &quot;Name of html file to open when you push log in goes here&quot; + &quot;.html&quot;; if (form.username.value == username[0] &amp;&amp; form.password.value == password[0] || form.username.value == username[1] &amp;&amp; form.password.value == password[1] ||</p><p>form.username.value == username[2] &amp;&amp; form.password.value == password[2] || form.username.value == username[3] &amp;&amp; form.password.value == password[3] ||</p><p>form.username.value == username[4] &amp;&amp; form.password.value == password[4] || form.username.value == username[5] &amp;&amp; form.password.value == password[5] ||</p><p>form.username.value == username[6] &amp;&amp; form.password.value == password[6] || form.username.value == username[7] &amp;&amp; form.password.value == password[7] ||</p><p>form.username.value == username[8] &amp;&amp; form.password.value == password[8] || form.username.value == username[9] &amp;&amp; form.password.value == password[9]) { self.location.href = page; } else { alert(&quot;Either the username or password you entered is incorrect.\nPlease try again.&quot;); form.username.focus(); } return true; }</p><p>function Login(form) { username = new Array(&quot;3&quot;); password = new Array(&quot;4&quot;); page = &quot;Name of html file to open when you push log in goes here&quot; + &quot;.html&quot;; if (form.username.value == username[0] &amp;&amp; form.password.value == password[0] || form.username.value == username[1] &amp;&amp; form.password.value == password[1] ||</p><p>form.username.value == username[2] &amp;&amp; form.password.value == password[2] || form.username.value == username[3] &amp;&amp; form.password.value == password[3] ||</p><p>form.username.value == username[4] &amp;&amp; form.password.value == password[4] || form.username.value == username[5] &amp;&amp; form.password.value == password[5] ||</p><p>form.username.value == username[6] &amp;&amp; form.password.value == password[6] || form.username.value == username[7] &amp;&amp; form.password.value == password[7] ||</p><p>form.username.value == username[8] &amp;&amp; form.password.value == password[8] || form.username.value == username[9] &amp;&amp; form.password.value == password[9]) { self.location.href = page; } else { alert(&quot;Either the username or password you entered is incorrect.\nPlease try again.&quot;); form.username.focus(); } return true; }</p>
<p>Now when I tried to use another user it wouldn't let me sign into both it would only let me sign into the bottom one. What would I do to be able to use all of them?</p>
<p>Can I see your code.</p>
<p>Never mind I figured it out, but thank you. Also I had to change some of the coding.</p><p>Bolded what I had to do for it to work.</p><p>&lt;html&gt;</p><p>&lt;head&gt;</p><p>&lt;script&gt;</p><p>function Login(form) { username = new Array(<strong>&quot;u1&quot;,&quot;u2&quot;,&quot;u3&quot;</strong>); password = new Array(<strong>&quot;p1&quot;,&quot;p2&quot;,&quot;p3&quot;</strong>); page = &quot;Name of html file to open when you push log in goes here&quot; + &quot;.html&quot;; if (form.username.value == username[0] &amp;&amp; form.password.value == password[0] || form.username.value == username[1] &amp;&amp; form.password.value == password[1] ||</p><p>form.username.value == username[2] &amp;&amp; form.password.value == password[2] || form.username.value == username[3] &amp;&amp; form.password.value == password[3] ||</p><p>form.username.value == username[4] &amp;&amp; form.password.value == password[4] || form.username.value == username[5] &amp;&amp; form.password.value == password[5] ||</p><p>form.username.value == username[6] &amp;&amp; form.password.value == password[6] || form.username.value == username[7] &amp;&amp; form.password.value == password[7] ||</p><p>form.username.value == username[8] &amp;&amp; form.password.value == password[8] || form.username.value == username[9] &amp;&amp; form.password.value == password[9]) { self.location.href = page; } else { alert(&quot;Either the username or password you entered is incorrect.\nPlease try again.&quot;); form.username.focus(); } return true; }</p><p>&lt;/script&gt; &lt;/head&gt; &lt;body bgcolor=&quot;#eeeeee&quot;&gt; &lt;form&gt; &lt;br&gt; &lt;center&gt; &lt;h5&gt;Username: &lt;input type=&quot;text&quot; name=&quot;username&quot; style=&quot;background:#bfbfbf;color:#212121;border-color:#212121;&quot; onFocus=&quot;this.style.background = '#ffffff';&quot;</p><p>onBlur=&quot;this.style.background = '#bfbfbf';&quot;&gt; &lt;br&gt; Password: &lt;input type=&quot;password&quot; name=&quot;password&quot; style=&quot;background:#bfbfbf;color:#212121;border-color:#212121;&quot; onFocus=&quot;this.style.background = '#ffffff';&quot;</p><p>onBlur=&quot;this.style.background = '#bfbfbf';&quot;&gt; &lt;br&gt; &lt;input type=&quot;button&quot; value=&quot;Login&quot; onClick=&quot;Login(this.form);&quot; style=&quot;background:#bfbfbf;color:#000000;border-color:#212121;&quot; onMouseOver=&quot;this.style.color =</p><p>'#404040';&quot; onMouseOut=&quot;this.style.color = '#000000';&quot; onFocusr=&quot;this.style.color = '#404040';&quot; onBlur=&quot;this.style.color = '#000000';&quot;&gt;&lt;/h5&gt; &lt;/center&gt; &lt;/form&gt; &lt;/body&gt; &lt;/html&gt;</p>
<p>nice it worked supremely</p><p>i am a student of grade 8 studying in indian school dsm </p><p>i'll show this to all my friends</p>
<p>Good!</p>
<p>Hmmm interesting. Thanks for sharing!</p>
<p>You're welcome! did it work?</p>

About This Instructable

50,125views

37favorites

License:

Bio: I like coding.
More by gogoguy:The Bubbles of Awesomeness Sweet Child o' Mine - Solo Sweet Child of Mine 
Add instructable to: