Er... yes. Yes, of course. :pQuote:
The untested code above was missing a few things... well 2... I figured you were testing me
I'm evidently tired (it's 0100 here). Here's the one that works:Nonono. The pages you're redirecting to must also check that the password is correct! It will be available as a GET variable.Code:<?php if(isset($_POST['id'])) {
$p = array(
1 => array('RED', '/red/index.php'),
2 => array('BLUE', '/blue/index.php'),
3 => array('YELLOW', '/yellow/index.php'),
4 => array('GREEN', '/green/index.php')
);
if($_POST['pass'] === $p[$_POST['id']][0])
header('Location: http://' . $_SERVER['HTTP_HOST'] . $p[$_POST['id']][1] . '?pass=' . $_POST['pass']);
else
header('Location: http://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['REQUEST_URI'], 0, strrpos($_SERVER['REQUEST_URI'], '/')) . '/error.php');
} else { ?>
