Redirect multiple users using session

Coding Critique is the place to post source code for peer review by other members of DevNetwork. Any kind of code can be posted. Code posted does not have to be limited to PHP. All members are invited to contribute constructive criticism with the goal of improving the code. Posted code should include some background information about it and what areas you specifically would like help with.

Popular code excerpts may be moved to "Code Snippets" by the moderators.

Moderator: General Moderators

Post Reply
msnes
Forum Newbie
Posts: 1
Joined: Sun Jul 15, 2012 12:25 pm

Redirect multiple users using session

Post by msnes »

I am having problems with this code. It worked until I made it into a session, now I dont know how to change it to make it work.

Code: Select all

<?php
//let's start the session
session_start();
//now, let's register our session variables
session_register('username');

//finally, let's store our posted values in the session variables
$_SESSION['name'] = $_POST['name'];

if(isset($_POST['username']))
{
$users['admin'] = array('password' => 'admin', 'redirect' => 'admin.php');
$users[$username] = array('password' => $password, 'redirect' => 'form3.php');


?>
Can you help me find out why this code wont redirect me to the right pages. Right now I get a blank screen.
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Redirect multiple users using session

Post by requinix »

Besides the obvious syntax error, there's nothing in there that actually redirects.

Did you post all of the code? You need to post all of the code.
Post Reply