Copy link to clipboard
Copied
I have a web page that used to work, but no longer does. It uses the dynamic select/value structure that I built using an earlier version of Dreamweaver. (I can't find that option in DW now. I'm using DW CC). It's been four or five years since I built this application; I decided to go back and convert it to HTML5 and now it doesn't work :-(. Has anything changed in PHP or HTML5 that would make this no longer functional?
The page content is shown below. The recordsets all seem work as they should.
When I open the page in a Firefox, I get an error that looks like this:
Your help would be greatly appreciated.
<?php require_once('Connections/connPartnership.php'); ?>
<?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 = "index.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($QUERY_STRING) && strlen($QUERY_STRING) > 0)
$MM_referrer .= "?" . $QUERY_STRING;
$MM_restrictGoTo = $MM_restrictGoTo. $MM_qsChar . "accesscheck=" . urlencode($MM_referrer);
header("Location: ". $MM_restrictGoTo);
exit;
}
?>
<?php if (!isset($_SESSION)) {session_start(); }; ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
//
// Part 1.
// Set up the game_venues recordset to find all the places that have games in the future.
// This is used in the select statement in the form.
//
mysql_select_db($database_connPartnership, $connPartnership);
$query_rsGameVenueID = "SELECT DISTINCT events.game_venue_id, game_venues.game_venue FROM events, game_venues WHERE events.game_venue_id = game_venues.game_venue_id AND events.game_date_time > NOW() ORDER BY game_venues.game_venue";
$rsGameVenueID = mysql_query($query_rsGameVenueID, $connPartnership) or die(mysql_error());
$row_rsGameVenueID = mysql_fetch_assoc($rsGameVenueID);
$totalRows_rsGameVenueID = mysql_num_rows($rsGameVenueID);
//
//Once the game venue has been selected and the form processed, assign the value of the game_venue_id session variable.
//
if (isset($_POST['game_venue_select'])) {
$_SESSION['game_venue_id'] = $_POST['game_venue_select'];
}
//
//Set up the recordset to get the game venue and assign the game_venue session variable.
//
$game_venue_id_variable_rsGameVenue = "-1";
if (isset($_SESSION['game_venue_id'])) {
$game_venue_id_variable_rsGameVenue = $_SESSION['game_venue_id'];
}
mysql_select_db($database_connPartnership, $connPartnership);
$query_rsGameVenue = sprintf("SELECT game_venues.game_venue FROM game_venues WHERE game_venue_id = %s", GetSQLValueString($game_venue_id_variable_rsGameVenue, "int"));
$rsGameVenue = mysql_query($query_rsGameVenue, $connPartnership) or die(mysql_error());
$row_rsGameVenue = mysql_fetch_assoc($rsGameVenue);
$totalRows_rsGameVenue = mysql_num_rows($rsGameVenue);
if (isset($row_rsGameVenue['game_venue'])) {
$_SESSION['game_venue'] = $row_rsGameVenue['game_venue'];
}
// Part 2
// Set up the recordset to get the game type ids and game types for the select statement in the form.
//
$game_venue_variable_rsGameTypeID = "-1";
if (isset($_SESSION["game_venue_id"])) {
$game_venue_variable_rsGameTypeID = $_SESSION["game_venue_id"];
}
mysql_select_db($database_connPartnership, $connPartnership);
$query_rsGameTypeID = sprintf("SELECT DISTINCT game_types.game_type_id,game_types.game_type FROM game_types, events WHERE game_types.game_type_id = events.game_type_id AND %s = events.game_venue_id AND events.game_date_time > NOW() ORDER BY game_type_id ASC", GetSQLValueString($game_venue_variable_rsGameTypeID, "int"));
$rsGameTypeID = mysql_query($query_rsGameTypeID, $connPartnership) or die(mysql_error());
$row_rsGameTypeID = mysql_fetch_assoc($rsGameTypeID);
$totalRows_rsGameTypeID = mysql_num_rows($rsGameTypeID);
//
// assign value of game_type_id session variable once it has been selected and the form posted.
//
if (isset($_POST['game_type_select'])) {
$_SESSION['game_type_id'] = $_POST['game_type_select'];
}
//
// set up the record set to get the game type once the game type id has been selected and assign the game type and Team_game session variables.
//
$colname_rsGameType = "-1";
if (isset($_SESSION['game_type_id'])) {
$colname_rsGameType = $_SESSION['game_type_id'];
}
mysql_select_db($database_connPartnership, $connPartnership);
$query_rsGameType = sprintf("SELECT * FROM game_types WHERE game_type_id = %s", GetSQLValueString($colname_rsGameType, "int"));
$rsGameType = mysql_query($query_rsGameType, $connPartnership) or die(mysql_error());
$row_rsGameType = mysql_fetch_assoc($rsGameType);
$totalRows_rsGameType = mysql_num_rows($rsGameType);
if (isset($row_rsGameType['game_type'])) {
$_SESSION['game_type'] = $row_rsGameType['game_type'];
$_SESSION['Team_game'] = $row_rsGameType['Team_game'];
}
//
// Set up the query to find the times of all the events with game type and game venues equal to the values previously selected.
//
$game_type_variable_rsgameDateTime = "-1";
if (isset($_SESSION["game_type_id"])) {
$game_type_variable_rsgameDateTime = $_SESSION["game_type_id"];
}
$game_venue_variable_rsgameDateTime = "-1";
if (isset($_SESSION["game_venue_id"])) {
$game_venue_variable_rsgameDateTime = $_SESSION["game_venue_id"];
}
mysql_select_db($database_connPartnership, $connPartnership);
$query_rsgameDateTime = sprintf("SELECT game_date_time, DATE_FORMAT(game_date_time, '%%W, %%b %%e at %%l:%%i %%p') AS formattedDateTime FROM events WHERE %s = game_type_id AND %s = game_venue_id AND game_date_time > NOW() ORDER BY events.game_date_time", GetSQLValueString($game_type_variable_rsgameDateTime, "int"),GetSQLValueString($game_venue_variable_rsgameDateTime, "int"));
$rsgameDateTime = mysql_query($query_rsgameDateTime, $connPartnership) or die(mysql_error());
$row_rsgameDateTime = mysql_fetch_assoc($rsgameDateTime);
$totalRows_rsgameDateTime = mysql_num_rows($rsgameDateTime);
//
//Once the a game time and date has been selected and the form posted, assign the session variables.
//
if (isset($_POST['game_date_time_select'])) {
$_SESSION['game_date_time'] = $_POST['game_date_time_select'];
}
//
// Now that we know the game time, game venue and game type, set up the query to get get the event ID.
//
$game_type_variable_rsEventID = "-1";
if (isset($_SESSION["game_type_id"])) {
$game_type_variable_rsEventID = $_SESSION["game_type_id"];
}
$game_venue_variable_rsEventID = "-1";
if (isset($_SESSION["game_venue_id"])) {
$game_venue_variable_rsEventID = $_SESSION["game_venue_id"];
}
$game_date_time_variable_rsEventID = "1900-01-01 10:00:00 AM";
if (isset($_SESSION["game_date_time"])) {
$game_date_time_variable_rsEventID = $_SESSION["game_date_time"];
}
mysql_select_db($database_connPartnership, $connPartnership);
$query_rsEventID = sprintf("SELECT event_id,DATE_FORMAT(game_date_time, '%%W, %%b %%e at %%l:%%i %%p') AS formattedDateTime FROM events WHERE %s = game_type_id AND %s = game_venue_id AND %s = game_date_time", GetSQLValueString($game_type_variable_rsEventID, "int"),GetSQLValueString($game_venue_variable_rsEventID, "int"),GetSQLValueString($game_date_time_variable_rsEventID, "text"));
$rsEventID = mysql_query($query_rsEventID, $connPartnership) or die(mysql_error());
$row_rsEventID = mysql_fetch_assoc($rsEventID);
$totalRows_rsEventID = mysql_num_rows($rsEventID);
//
// Assign the event ID session variable.
//
if (isset($row_rsEventID['event_id'])) {
$_SESSION['event_id'] = $row_rsEventID['event_id'] ;
$_SESSION['formatted_game_date_time'] = $row_rsEventID['formattedDateTime'];
} ;
//
// Go to either the specify partner page or the the submit request page, depending on whether the request is for a team game.
//
if ($_SESSION['Team_game'] == "Y") {
$updateGoTo = "specify_partner.php" ;
} else {
$updateGoTo = "submit_request.php";
};
if (isset($row_rsEventID['event_id'])) {
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
};
?>
<!DOCTYPE html><html lang="en"><!-- InstanceBegin template="/Templates/Partnership.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>
<meta charset=utf-8>
<title doc_title="Select event">Unit 174 Partnership Template</title>
<link rel="stylesheet" href="css/partnership.css" type="text/css">
<link rel="stylesheet" href="css/menu.css" type="text/css">
<link rel="stylesheet" href="css/table_design.css" type="text/css">
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
<!-- InstanceParam name="OptionalNav" type="boolean" value="true" -->
<!-- InstanceParam name="Doc_title" type="text" value="Select event" -->
</head>
<body>
<header>
<h1>Welcome to the Unit 174 online partnership desk!</h1>
<h2>This website can be used to request partners for all<br>Unit 174 clubs and tournaments</h2>
</header>
<nav>
<ul id="menu">
<li class="current"><a href="welcome.php">Home</a> </li>
<li><a href="update_profile.php">Update profile</a> </li>
<li><a href="select_event.php?new_request='yes' %20 ">Create request</a> </li>
<li><a href="check_request.php">Check requests</a> </li>
<li><a href="list_requests.php">Update requests</a> </li>
<li><a href="logout.php" title="Log out">Log out</a> </li>
<?php if (isset($_SESSION['MM_UserGroup']) and (($_SESSION['MM_UserGroup'] == 'Admin' ) or ($_SESSION['MM_UserGroup'] == 'Coord' )) ){ ?>
<li><a href="list_events.php" title="Update events">Admin</a>
<ul>
<?php if (isset($_SESSION['MM_UserGroup']) and ($_SESSION['MM_UserGroup'] == 'Admin' )) { ?>
<li><a href="list_events.php" title="Update scheduled events">Update events</a> </li>
<?php }; ?>
<?php if (isset($_SESSION['MM_UserGroup']) and ($_SESSION['MM_UserGroup'] == 'Admin' )) { ?>
<li><a href="list_game_types.php" title="Update game types">Update game types</a> </li>
<?php }; ?>
<?php if (isset($_SESSION['MM_UserGroup']) and ($_SESSION['MM_UserGroup'] == 'Admin' )) { ?>
<li><a href="list_game_venues.php" title="Update game venues">Update venues</a> </li>
<?php }; ?>
<li><a href="list_all_requests.php">List requests</a> </li>
<li><a href="Reports.php">Reports</a> </li>
</ul>
</li>
<?php };?>
</ul>
</nav>
<main>
<!-- InstanceBeginEditable name="main" -->
<!--First display the form to select the game venue.-->
<h1>Request a Partner</h1>
<?php print_r( $row_rsGameVenueID ); ?>
<p>First, to help us find you a partner, please tell us where you would like to play. </p>
<form id="game_venue_form" name="game_venue_form" method="post" action="<?php echo $editFormAction; ?>">
<p>
<label for="game_venue_select">Please choose a club or a tournament.</label>
</p>
<p>
<select name="game_venue_select" id="game_venue_select">
<option value="1" <?php if (!(strcmp(1, $_SESSION['game_venue_id']))) {echo "selected=\"selected\"";} ?>>Please select a club or tournament</option>
<?php
do {
?>
<option value="<?php echo $row_rsGameVenueID['game_venue_id']?>"<?php if (!(strcmp($row_rsGameVenueID['game_venue_id'], $_SESSION['game_venue_id']))) {echo "selected=\"selected\"";} ?>><?php echo $row_rsGameVenueID['game_venue']?></option>
<?php
} while ($row_rsGameVenueID = mysql_fetch_assoc($rsGameVenueID));
$rows = mysql_num_rows($rsGameVenueID);
if($rows > 0) {
mysql_data_seek($rsGameVenueID, 0);
$row_rsGameVenueID = mysql_fetch_assoc($rsGameVenueID);
}
?>
</select>
</p>
<p>
<input type="submit" name="game_venue_button" id="game_venue_button" value="Select" />
</p>
</form>
<!--Then display the form to select the type of game once the game venue has been selected. -->
<?php
if (isset($_SESSION["game_venue_id"]) ) { ?>
<p>Thanks. The <strong><?php echo $_SESSION['game_venue']; ?></strong> offers several types of games. </p>
<form id="game_type_form" name="game_type_form" method="post" action="<?php echo $editFormAction; ?>">
<p>
<label for="game_type_select">Please indicate what type of game you'd like to play in. </label>
</p>
<p>
<select name="game_type_select" id="game_type_select">
<option value="1" <?php if (!(strcmp(1, $_SESSION['game_type_id']))) {echo "selected=\"selected\"";} ?>>Please select the type of game in which you want to play.</option>
<?php
do {
?>
<option value="<?php echo $row_rsGameTypeID['game_type_id']?>"<?php if (!(strcmp($row_rsGameTypeID['game_type_id'], $_SESSION['game_type_id']))) {echo "selected=\"selected\"";} ?>><?php echo $row_rsGameTypeID['game_type']?></option>
<?php
} while ($row_rsGameTypeID = mysql_fetch_assoc($rsGameTypeID));
$rows = mysql_num_rows($rsGameTypeID);
if($rows > 0) {
mysql_data_seek($rsGameTypeID, 0);
$row_rsGameTypeID = mysql_fetch_assoc($rsGameTypeID);
}
?>
</select>
</p>
<p>
<input type="submit" name="game_type_button" id="game_type_button" value="Select" />
</p>
</form>
<?php };?>
<!--
Now display the form to select the game time once the game type and venue have been selected.
-->
<?php
if (isset($_SESSION["game_type_id"]) ) { ?>
<p>The <strong><?php echo $_SESSION['game_venue']; ?></strong> offers <strong><?php echo $_SESSION['game_type']; ?></strong> games at several different dates and times. </p>
<p>Please select when when you want a partner.</p>
<form id="game_date_time_form" name="game_date_time_form" method="post" action="<?php echo $editFormAction; ?>">
<p>
<select name="game_date_time_select" id="game_date_time_select">
<option value="1">Please select a game date and time</option>
<?php
do {
?>
<option value="<?php echo $row_rsgameDateTime['game_date_time']?>"><?php echo $row_rsgameDateTime['formattedDateTime']?></option>
<?php
} while ($row_rsgameDateTime = mysql_fetch_assoc($rsgameDateTime));
$rows = mysql_num_rows($rsgameDateTime);
if($rows > 0) {
mysql_data_seek($rsgameDateTime, 0);
$row_rsgameDateTime = mysql_fetch_assoc($rsgameDateTime);
}
?>
</select>
</p>
<p>
<input name="eventidhiddenfield" type="hidden" id="eventidhiddenfield" value="<?php echo $row_rsEventID['event_id']; ?>" />
<input type="submit" name="game_date_time_button" id="game_date_time_button" value="Select" />
<input name="formatteddatetime" type="hidden" id="formatteddatetime" value="<?php echo $row_rsgameDateTime['formattedDateTime']; ?>" />
</p>
</form>
<?php };?>
<!-- InstanceEndEditable -->
</main>
<footer>
<?php
$time = time () ;
//This line gets the current time stamp off of the server
$year= date("Y ",$time) . " ";
//This line formats it to display just the year by using a capitol Y
echo "<p>This site © Bert Onstott " .$year . ", all rights reserved. </p>"; //this line prints out the copyright date range, you need to edit 2001 to be the first year your site was active ?>
<p>Please report any errors or unexplained behavior on this site to<br />Bert Onstott at <a href="mailto:bertonstott@comcast.net">bertonstott@comcast.net</a>
</p>
</footer>
</body>
<!-- InstanceEnd --></html>
<?php
mysql_free_result($rsGameVenueID);
mysql_free_result($rsGameVenue);
mysql_free_result($rsGameTypeID);
mysql_free_result($rsGameType);
mysql_free_result($rsgameDateTime);
mysql_free_result($rsEventID);
?>
Have something to add?