Jump to content

Recommended Posts

I am working with an old script someone else wrote that pulls data from this year as well as prior year.  A global is set: $thisyear = '2012'  According to my understanding this code:

<?php require 'main_include.php'; ?>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>Conference</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="http://conferencecenter.edu/favicon.png" rel="shortcut icon">
<style type="text/css">
@import url("http://www.conferencecenter.edu/conference/style.css");

</style>
</head>
<body>

<?php
$includeFile = file_get_contents("http://www.conferencecenter.edu/conference/header.php");
	echo $includeFile;



//	Builds a list of all presenters and their sessions; ECHOs each individual entry for faster to-browser dumping in these long lists.
function general_lister($type, $year='') {
global $thisyear,$splitchar;
if ($year=='') $year = $thisyear;
if ($type=='featured') { echo "<h1>Conference $year Presenters and Topics</h1>"; }
else { echo "<h1>Conference $year Contributed Presenters and Topics</h1>"; }

// echo '<p><a href="presenters.php?type=featured&year='.$year.'">Featured Presenters</a> • <a href="presenters.php?type=contributed&year='.$year.'">Contributed Papers</a></p>';
echo '<p>Notice: the information presented here is subject to change without notice.</p>';

$bigList = presentersForYear($year,$type);

if (count($bigList)>0) {
	foreach ($bigList as $value) {
		echo general($value,$year);
	}
} else {
	echo "<h4>No $type sessions have been confirmed yet, but please check back soon.</h4>";
}
}

if (isset($_GET['presenter'])) { echo longbio($_GET['presenter'],$useyear); }
else if (isset($_GET['session'])) { echo sessAbstract($_GET['session'],$useyear); }
else if (isset($_GET['type'])) { echo general_lister($_GET['type'],$useyear); }
else { echo general_lister('featured',$year); }

$includeFile = file_get_contents("http://conferencecenter.edu/conference/footer.php");
	echo $includeFile; ?>
</body>
</html>

 

should pull the current data with the url being set at conferencecenter.edu/conference/presenters.php and pull the prior year with this URL: conferencecenter.edu/conference/presenters.php?year=2010 (or any other year).  It doesn't work.  No matter what the URL it only pulls current 2012 data.  I know this code has javascript in it - old javascript - and I just can't figure it out let alone where the problem is.  Here is some code from the main include file:

<?php
//	This PHP script contains routines used by the database-driven pages of the conference website.

//	First let's set up some global values:
global $keywordspage,$presenterspage,$calendarpage,$splitchar,$useyear,$returns;

require_once '/www/universal.php';
require_once 'prices_etc.php';
require_once 'formatting_functions.php';
require_once 'db_functions.php';

$splitchar = "\n";	//	This is the delimiter character for use in lists
$returns = array("\r\n","\r","\n");	// Break characters; generally used to convert all these to single standard one

if (!isset($_GET['year']) || $_GET['year']==$thisyear) {
$useyear = $thisyear;
$templateDIR = "http://www.conferencecenter.edu/conference";
} else {
$useyear = mysql_real_escape_string($_GET['year']);
$templateDIR = "http://www.conferencecenter.edu/conference/old/$useyear";
}

$calendarpage = 'schedule.php';
$presenterspage = 'presenters.php';
$keywordspage = 'keywords.php';

function pWrap($string) {
if (strpos(strtolower($string),'<p')===FALSE) $string = "<p>$string</p>";
return $string;
}

function sortSessions($sessionsArray,$fieldName) {
if (count($sessionsArray)<2) return $sessionsArray;

$qString = 'SELECT `id` FROM `sessions` WHERE';
$count = 0;
foreach ($sessionsArray as $session) {
	$session = mysql_real_escape_string($session);
	if ($count!=0) $qString .= ' OR';
	$qString .= " `id`='$session'";
	++$count;
}
$fieldName = mysql_real_escape_string($fieldName);
$qString .= " ORDER BY `$fieldName`;";
$result = mysql_query($qString);
$output = array();
while ($row = mysql_fetch_assoc($result)) {
	$output[] = $row['id'];
}
return $output;
}

function presentersForYear($year, $type) {	// Type can be "all" for all presenters
global $splitchar;
if ($type=='all') $type = "invited' OR type='contributed";
else $type = mysql_real_escape_string($type);
$year = mysql_real_escape_string($year);

	$bigList = array();
$result = mysql_query("SELECT `name` FROM `presenters` WHERE `type`='$type' AND `hidden`!='yes';");
while ($row = mysql_fetch_assoc($result)) {
	if (inYear($row['name'],$year)) $bigList[] = $row['name'];
}

$bigList = array_unique($bigList);
sort($bigList);

return $bigList;
}



 

Any help would be greatly appreciated.

 

Link to comment
https://forums.phpfreaks.com/topic/268030-url-with-yearxxxx-not-working/
Share on other sites

OP: In the start of your post you say

$thisyear = '2012'

 

Then your code is

$useyear = mysql_real_escape_string($_GET['year']);
$templateDIR = "http://www.conferencecenter.edu/conference/old/$useyear";

 

$_GET['year'] is not the same as $thisyear. So I don't follow. Your whole post is confusing. Narrow it down to the section that doesn't work,

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.