Hello guys! This is my 1° thread here. I'm' sorry my english ,but lets go ..i need your help!
I have 2 pages HTML , with javascript login (without database) .
Works with text file where username and password = txt file name ( leo123.txt)
I need get the username (when someone enter username) and pass data to next page.
Example : username : leo (Login.html) >>>>>>> (Main.html) Label Username = Leo
If username in Main.html page <> leo close this page
This is my code LOGIN.HTML
<script>
function click() {
if (event.button==2||event.button==3) {
oncontextmenu='return false';
}
}
document.onmousedown=click
document.oncontextmenu = new Function("return false;")
</script>
<script type="text/javascript">
<!--
function authPass(u,p) {
if (u && p) self.location = "Auth.html?" + u + p;
return false;
}
// -->
</script>
<div>
<script type="text/javascript">
<!--
if (location.search.indexOf("auth=failed") != -1) {
document.write("<span style=\"color:#cad439\">Error! Check your username or password</span>");
}
-->
</script>
HTML Code:
<form id="form1" action="javascript://" onsubmit="return authPass(this.user.value,this.pass.value)">
<table>
<tr>
<td>Login box</td><td></td></tr>
<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 colspan="4" align="left"><input type="submit" value="Login" /><input name="Lembrar" type="button" onclick="window.open('https://Main.html')" value="Lost your username?" /></td>
</tr>
</table>
</form>
AUTH.HTML ( CHECK OUR LOGIN )
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" >
<head>
<script type="text/javascript">
<!--
var authstring = "<script type=\"text/javascript\" src=\"" + location.search.substring(1) + ".txt\"><\/script>";
if (location.search) document.write(authstring);
// -->
</script>
</head>
<body>
<script type="text/javascript">
<!--
window.auth ? location.replace(redirect) : location.replace("index.html?auth=failed");
// -->
</script>
</body>
</html>