title: redirect html page if not login
body: <p>I have simple Login Form on my webpage. It uses javascript to login user and works fine.
  problem is that is user types the landing page url directly into the adress bar he directly can acess the page without login. i want to redirect him to the login page if he didn't login.
  below are the links of loding and target page.</p>
  
  <p>login: <a href="http://samdesign.comli.com/protected/index.html" rel="noreferrer">http://samdesign.comli.com/protected/index.html</a></p>
  
  <p>target: <a href="http://samdesign.comli.com/protected/user-soft.html" rel="noreferrer">http://samdesign.comli.com/protected/user-soft.html</a></p>
  
  <p>and here is the script used are below..</p>
  
  <pre><code>&lt;form&gt;
  &lt;table align=center&gt;
    &lt;tr&gt;
       &lt;td&gt;Username:&lt;/td&gt;
       &lt;td&gt;&lt;input type="text" name="username" style="background:#bfbfbf;color:#212121;border-color:#212121;" onFocus="this.style.background = '#ffffff';" onBlur="this.style.background = '#bfbfbf';"&gt;&lt;/td&gt;
    &lt;/tr&gt;
  
    &lt;tr&gt;
       &lt;td&gt;Password:&lt;/td&gt;
       &lt;td&gt;&lt;input type="password" name="password" style="background:#bfbfbf;color:#212121;border-color:#212121;" onFocus="this.style.background = '#ffffff';" onBlur="this.style.background = '#bfbfbf';"&gt;&lt;/td&gt;
    &lt;/tr&gt;
  
    &lt;tr&gt;
    &lt;td&gt;&lt;/td&gt;
    &lt;td align=right&gt;&lt;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';"&gt;&lt;/td&gt;
    &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>script is this</p>
  
  <pre><code>function Login(form) {
  username = new Array("numair","sam","u3","u4","u5","u6","u7","u8","u9","u10","temporary");
  password = new Array("nk1994","sf1993","p3","p4","p5","p6","p7","p8","p9","p10","user");
  page = "/protected/user-soft.html";
  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] || form.username.value == username[2] &amp;&amp; form.password.value == password[2] || form.username.value == username[3] &amp;&amp; form.password.value == password[3] || form.username.value == username[4] &amp;&amp; form.password.value == password[4] || form.username.value == username[5] &amp;&amp; form.password.value == password[5] || form.username.value == username[6] &amp;&amp; form.password.value == password[6] || form.username.value == username[7] &amp;&amp; form.password.value == password[7] || form.username.value == username[8] &amp;&amp; form.password.value == password[8] || form.username.value == username[9] &amp;&amp; form.password.value == password[9] || form.username.value == username[10] &amp;&amp; form.password.value == password[10]) {
  self.location.href = page;
  }
  else {
  alert("Either the username or password you entered is incorrect.\nPlease try again.");
  form.username.focus();
  }
  return true;
  }
  </code></pre>
  
  <p>can any one help with exapmle?</p>