Sending a Form
Posted: Sun Apr 01, 2007 6:38 pm
Burrito | Please use
My question is how I would create the form to read this the ones I have when submitted go right to the failedlogin.html
Any help would be appreciated.
Thanks
Burrito | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Ok, I'm very much a newby at php, but I have a code here that when the correct username and password is created it points to a url.Code: Select all
<?
/*The below Var ($) is your error page,
feel free to replace it with your own page.*/
$error_page = "http://www.test.com/failedlogin.html";
$user = Array();
$links = Array();
#---Here is where you edit your list of usernames----#
/*account 1*/
$user['Jason'] = 'Photolocker';
$links['Jason'] = 'http://www.test.com/test.html;
/*account 2*/
$user['Gary'] = 'Claire';
$links['Gary'] = 'http://www.test.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>');
}
?>Any help would be appreciated.
Thanks
Burrito | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]