if (strlen($sanEventName) > 0) { $sanEventName = mysql_escape_string($sanEventName); $query = "SELECT EventID, EventName, CategoryID FROM Events WHERE SanitizedEventName='" . $sanEventName . "'"; if ($query_result = mysql_query($query)) { $num_rows = mysql_num_rows($query_result); $eventDetails = array(); # echo $num_rows . ' ' . $sanEventName; exit(); if ($num_rows == 1) { $table_row = mysql_fetch_row($query_result); $eventID = $table_row[0]; $eventName = $table_row[1]; $categoryID = $table_row[2]; } elseif ($num_rows > 1) { # go through category and find parent of event # if can't find parent redirect to closest category $event_details = resolve_ambiguous_event($smarty, $cats, $sanEventName); $eventID = $event_details['eventID']; $categoryID = $event_details['categoryID']; } else { # ($num_rows < 1) # go through category and find parent of event # if can't find parent redirect to closest category $categoryInfo = fixup_url($smarty, $cats); header('HTTP/1.1 301 Moved Permanently'); header('Location: http://www.mongotickets.com/' . $categoryInfo['categoryUrl']); exit; } # url fix beyond this point is the responsibility of the respective script if ($action == 'list tickets') { $_REQUEST['production_id'] = $pid; $_REQUEST['event_id'] = $eventID;
mysql_select_db('mongo_tickets2'); if ($sanEventName != '') { $sanEventName = mysql_escape_string($sanEventName); $query = "SELECT EventID, EventName, CategoryID FROM Events WHERE SanitizedEventName='" . $sanEventName . "'"; if ($query_result = mysql_query($query)) { $num_rows = mysql_num_rows($query_result); if ($num_rows == 1) { $table_row = mysql_fetch_row($query_result); $eventID = $table_row[0]; $eventName = $table_row[1]; $categoryID = $table_row[2]; $made_url = make_event_url($eventName, $categoryID); } elseif ($num_rows > 1) { # go through category and find parent of event # if can't find parent redirect to closest category $made_url = resolve_ambiguous_event($smarty, $cats, $sanEventName); } else { # ($num_rows < 1) # go through category and find parent of event # if can't find parent redirect to closest category fixup_url($smarty, $cats); header('HTTP/1.1 301 Moved Permanently'); header('Location: http://www.mongotickets.com/'); } if ($req_uri != $made_url) { header('HTTP/1.1 301 Moved Permanently'); header('Location: http://www.mongotickets.com/' . $made_url); } if ($list_tickets == 1) { $_REQUEST['id'] = $pid; mysql_close($dbh);