View Single Post
Old 02-01-2008, 14:34   #30 (permalink)
brucec
Podcaster on Web Design
 
Join Date: Jan 2008
Posts: 27
Send a message via AIM to brucec Send a message via Skype™ to brucec
Used for security redirects while users log in. It works well.

PHP Code:
function LoginRedirect($u,$p)
{
$users=fill with 2 dimensional array of users and passwords;
$error CREATE LOGIN ERROR HERE;
$url URL to redirect user to.

    
$enteredUsername $u
    $enteredPassword 
$p;

    for(
$r=0$r<sizeOf($users); $r++)
    {
        if(
$users[$r][0]==$enteredUsername)
        {
            if(
$users[$r][1]==$enteredPassword)
            {
                
$_SESSION['loggedin']="yes";
                
$_SESSION['username']=$enteredUsername;
                
$_SESSION['contact']=$users[$r][2];
                
header("Location:$url");
            } 

            break;
        }
    }

}
return 
$error;

  Reply With Quote