View Single Post
Old 12-01-2011, 12:31 AM   PM User | #10
drakerehfeld
New Coder

 
Join Date: Jun 2011
Posts: 17
Thanks: 1
Thanked 0 Times in 0 Posts
drakerehfeld is an unknown quantity at this point
So, after some testing, I have just one last (minor) problem.

I have changed username to account number in all of the code.

If they enter the wrong account number (lets say they enter "jsmith", jsmith is not one of the account numbers defined), the error popup opens just fine (explaining that they need to correct their account number), but, they are still progressed onto the page www.example.com/jsmith.html.

How do I stop them if they put in the wrong account number?

Here is my updated code:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
   "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="language" content="english"> 
<meta http-equiv="Content-Style-Type" content="text/css">
<meta http-equiv="Content-Script-Type" content="text/javascript">

<title>Login to ReInvestmentCloud.com</title>
<script type="text/javascript">

function init() {

/******* account numbers ******/

   numbers=[          
            'b1e9391411','cfd7bb95337','06b71981d0',
            '79a1bedc95','2dca8594d7','268415397','a8f91c64a8',
           ]; 

/*************************************************************/

   df=document.forms[0];
   df[0].focus(); 

df[0].onkeyup=function(){
   this.value=this.value.toLowerCase();
 }

   df[1].onclick=function() {


for(c=0;c<numbers.length;c++) {
if(numbers[c]==df[0].value) {   
   location.href=df[0].value+'.html';
   return;
  }
 }

if(numbers[c]!=df[0].value) {
alert('Please enter your account number again, there was an error.');
   df.reset();
   df[0].focus();
   return;
   }
  }
 }

if(window.addEventListener){
   window.addEventListener('load',init,false);
 }
else { 
if(window.attachEvent){
   window.attachEvent('onload',init);
  }
 }

</script>

</head>
<body>
<p><font face="verdana">Enter your account number:</font></p>
<form action="subdir.php" method="post">
<div id="container">
<h1></h1>
<input type="text" name="subdir">
<input type="submit" value="OK">
</div>
</form>

</body>
</html>
and PHP:
PHP Code:
<?php
$subdir 
$_POST['subdir']; 
header('location: http://reinvestmentcloud.darkearsi.com/Accounts/'.$subdir.'.html');
?>
drakerehfeld is offline   Reply With Quote