Mhs131 Posted April 3, 2007 Share Posted April 3, 2007 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 Link to comment https://forums.phpfreaks.com/topic/45368-cant-get-this-multiple-userpassword-form-to-work/ Share on other sites More sharing options...
dough boy Posted April 3, 2007 Share Posted April 3, 2007 You are looking for $_POST['user'] & $_POST['pass'] but do not have those as the field names in the form Link to comment https://forums.phpfreaks.com/topic/45368-cant-get-this-multiple-userpassword-form-to-work/#findComment-220291 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.