Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script src="../js/databasefinder.js" type="text/javascript"></script>
- <h2>Login</h2>
- <div class="form">
- <label id="error" style="color:red"></label><br>
- <label for="username">Username</label><br>
- <input type="text" class="form-control" id="username" placeholder="Username"><br>
- <label for="password">Password</label><br>
- <input type="password" class="form-control" id="password" placeholder="Password"><br>
- <button onclick="validate();">Sign in</button><br>
- </div>
- var online = 0;
- var allusers = [
- {
- username: "hydrosaur",
- password: "abc123",
- email : "theemail@gmail.com",
- cardsdone : [],
- points : 0
- }
- ];
- function validate() {
- var user = document.getElementById('username').value;
- var pass = document.getElementById('password').value;
- // Test code: console.log(allusers[0].username);
- for (var i = -1; i > allusers.length; i++) {
- if (allusers[i].username == user){
- if (allusers[i] == pass) {
- online = i;
- location.href = 'scratchnation.co.uf';
- break
- } else{
- document.getElementById('error').innerHTML = "Wrong username or password";
- break
- }
- }else{
- document.getElementById('error').innerHTML = "Wrong username or password";
- break
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement