<html>
<head>
<title>
Log in
</title>
 <style>
 body {
    width: 1000px;
    margin: 0 auto;
    text-align: justify;

}
body, .text, .justify, tr {
    color : #f0f0f0;
    font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 12px;
    font-weight: normal;
    }

.justify {
    text-align: justify;
}
 </style>
</head>
<body background="Dance_wallpapers_211.png">
<h1 style="font-family:Comic Sans Ms;text-align="center";font-size:20pt;
color:#00FF00;>
<bR>
<center><font face="arial" color="#00FF00">Welcome to RAZER ZONE</font></center>
<center><font face="arial" color="white">FOR </font><font face="arial" color="#00FF00">GAMERS. </font><font face="arial" color="white">BY </font><font face="arial" color="#00FF00">GAMERS.</font>
</h1>
<br>
<br>
<br>
<br>
<br>
<br>
<br>
<form name="login">
<h3><center><font face="arial" color="#00FF00">Username:<input type="text" name="userid"/></font></center>
<br>
<center><font face="arial" color="#00FF00">Password:<input type="password" name="pswrd"/></font></center></h3>
<center><input type="button" onclick="check(this.form)" value="Login"/>
<input type="reset" value="Cancel"/></center>
</form>
<script language="javascript">
function check(form)
{
if(form.userid.value == "yakuzajevin" || form.userid.value == "YAKUZAJEVIN" && form.pswrd.value == "yakuzajevin" || form.pswrd.value == "YAKUZAJEVIN")
{
window.location.assign('file:///H:/WEBPAGE/redirect.html');
}
else
{
alert("Access Denied")
}
}
</script>
<SCRIPT LANGUAGE="JavaScript">
var message="Please Log in!";
function clickIE() {if (document.all) {alert(message);return false;}}
function clickNS(e) {if 
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {alert(message);return false;}}}
if (document.layers) 
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")
</script>
<center><h2><font face = " arial " color = " white ">Note: <font face="arial" color="#00FF00">case</font> sensitive!</font></h2>
<iframe src="footer.html" name="mainframe" height="200" width="1024" frameborder="0" allowtransparency="true" scrolling="no">
</iframe>
</body>
</html>

when i use window.location.assign, the value needed for my password is being ignored, you can use any char, for the password even if there is a value assigned, for example, the value assigned is "yakuzajevin", even if you didn't use "yakuzajevin", the page will direct you to the homepage,

please help,

Member Avatar for stbuchok

If you are going to do any sort of security, do it through server side code. I can bypass this in half a second. You can't prevent someone from viewing source and finding the username and password.

While I firmly agree that using javascript for a login is not really a good idea, your issue is that you need another two sets of parenthesis... the problem is that your current if..else is evaluating as TRUE using your logic even if the pasword is incorrect...

[edit]... adding picture because I was unable to include sample code..

dfb6b38018045e252b7980877f33e0a5

Well guys thanks for the reponse :D, i will use this codes for my 7yrs old brother for his project :D, so no need for service side code XD

thanks for the reply :D

Ok, glad we were able to help and solve your issue with the if statement and the use of AND and OR.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.