page redirect based on column value not working
Posted: Sat Jan 05, 2013 11:03 am
Hello
I have a page that is initially a customer signup page / application. The full application will consist of 4 pages in the end.
Going back to the first page to start this contains the fields where the user can add the username, email and password. This is then all stored in a php DB. Once each page has been complete (and only when complete) it sends a hidden field value to the database saying complete (or whatever) when submitted then when the user logs back in the are logged back in the page one but if this is complete they are then directed to the next page.
i am hitting a wall with the redirect though.
i have a column in the DB called progress
and a hidden value of
there are also the other values in the form for username, password, email etc...
thanks in advance
I have a page that is initially a customer signup page / application. The full application will consist of 4 pages in the end.
Going back to the first page to start this contains the fields where the user can add the username, email and password. This is then all stored in a php DB. Once each page has been complete (and only when complete) it sends a hidden field value to the database saying complete (or whatever) when submitted then when the user logs back in the are logged back in the page one but if this is complete they are then directed to the next page.
i am hitting a wall with the redirect though.
Code: Select all
<?php
if (!isset($_SESSION)) {
session_start();
}
$MM_authorizedUsers = "";
$MM_donotCheckaccess = "true";
// *** Restrict Access To Page: Grant or deny access to this page
function isAuthorized($strUsers, $strGroups, $UserName, $UserGroup) {
// For security, start by assuming the visitor is NOT authorized.
$isValid = False;
// When a visitor has logged into this site, the Session variable MM_Username set equal to their username.
// Therefore, we know that a user is NOT logged in if that Session variable is blank.
if (!empty($UserName)) {
// Besides being logged in, you may restrict access to only certain users based on an ID established when they login.
// Parse the strings into arrays.
$arrUsers = Explode(",", $strUsers);
$arrGroups = Explode(",", $strGroups);
if (in_array($UserName, $arrUsers)) {
$isValid = true;
}
// Or, you may restrict access to only certain users based on their username.
if (in_array($UserGroup, $arrGroups)) {
$isValid = true;
}
if (($strUsers == "") && true) {
$isValid = true;
}
}
return $isValid;
}
$MM_restrictGoTo = "failed.php";
if (!((isset($_SESSION['MM_Username'])) && (isAuthorized("",$MM_authorizedUsers, $_SESSION['MM_Username'], $_SESSION['MM_UserGroup'])))) {
$MM_qsChar = "?";
$MM_referrer = $_SERVER['PHP_SELF'];
if (strpos($MM_restrictGoTo, "?")) $MM_qsChar = "&";
if (isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']) > 0)
$MM_referrer .= "?" . $_SERVER['QUERY_STRING'];
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
$colname_rsTenant = "-1";
if (isset($_SESSION['MM_Username'])) {
$colname_rsTenant = $_SESSION['MM_Username'];
}
mysql_select_db($database_Letting, $Letting);
$query_rsTenant = sprintf("SELECT * FROM LettingsTenApp WHERE tenID = %s", GetSQLValueString($colname_rsTenant, "int"));
$rsTenant = mysql_query($query_rsTenant, $Letting) or die(mysql_error());
$row_rsTenant = mysql_fetch_assoc($rsTenant);
$totalRows_rsTenant = mysql_num_rows($rsTenant);
$status = $row_rsTenant['progress'];
// Redirect user if their application is completed
if($status == "P1complete")
{
header("location: application-formP2.php");
}
?>
and a hidden value of
Code: Select all
<input type="hidden" name="progress" value="P1complete" />thanks in advance