Jump to content

Can't get this multiple user/password form to work!


Mhs131

Recommended Posts

Ok.. My buddy made this for me and it was working but of course I messed it up and now I CAN't get it to work!!!

It's a form that points to a certain url when the right username and password are entered.  ( a very basic form) 

Here's the code I have.

 

Login.php--

 

<?

/*The below Var ($) is your error page,

feel free to replace it with your own page.*/

$error_page = "http://www.website.com/failedlogin.html";

 

$user = Array();

$links = Array();

 

#---Here is where you edit your list of usernames----#

 

/*test acct 1*/

$user['Jason'] = 'Photolocker';

$links['Jason'] = 'http://www.website.com/photolocker/index.html';

 

/*test acct 2*/

$user['Matt'] = 'Claire';

$links['Matt'] = 'http://www.website.com';

 

#---------------End user names list------------------#

 

$xuser = $_POST[user];

$xpass = $_POST[pass];

 

if (array_key_exists($xuser, $user)) {

   if ($xpass == $user[$xuser]){

echo ('Logging in...<br><br><br>');

echo ('<script language="javascript">location.href=\''.$links[$xuser].'\';</script>');

   }else{

echo ('<script language="javascript">location.href=\''.$error_page.'\';</script>');

   }

}else{

echo ('<script language="javascript">location.href=\''.$error_page.'\';</script>');

}

?>

 

 

and then the form.

<form name="Main" method="post" action="/login.php">

      <td width="45" height="5" class="style20">Sign in:</td>

      <td width="170">

      <label>

        <input type="text" name="textfield">

        </label>    </td>

    <td width="45" height="5" class="style20">Password:</td>

    <td width="170">

      <label>

        <input type="text" name="textfield2">

        </label>    </td>

    <td width="62">

      <label>

      <input type="submit" name="Submit" value="Submit">

        </label>

      </td>

    </form>

 

 

???Any help would be appreciated!

Thanks

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.