PHP Manual Link Help

Hello,

I’m working on a site that is built with PHP and the CMS is so rigid there is no way to really add links manually to other pages that require the user to be logged in.

I’ve been presented with a page that dynamically loads links from a database that checks the user id and session. I have a general idea of what part of the code to focus on but am having trouble executing this. Can someone take a look at this?

I’ve uploaded the page that has the info I need to pull from but I’ll also copy and paste the code I feel is most relevant. I believe somehow sending the link through dload.php is key. Basically, I need advice on how to formulate an href tag out of this mess.


	// ADD PRODUCT NOTES ITEMS
	if(hm("content","ct=5 and st=1 and app=$apid")>0) {
		echo "<h3><a name=\"notes\"></a>Product Notes</h3>
";
      $md=split("
",selectDBdata("*","content","ct=5 and st=1 and app=$apid","order by title"));
      foreach($md as $td) {
      	$std=split("<X>",$td);
      	foreach($std as $tstd) {
      		$ststd=split("=",$tstd);
      		if($ststd[0]) $$ststd[0]=$ststd[1];
      	}
		$workingdt=split(" - ",$dt);
		echo "<p class=\"bodyNormal\">" . $title;
		if($stitle) echo "; " . $stitle;
		if($hco==1) {
			if($_COOKIE["session_id"]) echo "<span class=bodySmall> — <a href=\"$LINKPATH/dload.php?pub=" . $cid . "&fl=p&pa=notes\">PDF FILE</a> (" . fsize("$BASEPATH/dh/pdf/$afile") . ") </span>";
			else echo "<span class=bodySmall> — <a href=\"$SECUREPATH/login.php?co=" . $cid . "&fl=p&pa=notes\">PDF FILE</a> (" . fsize("$BASEPATH/dh/pdf/$afile") . ") </span>";
		}
		elseif($hco==0) {
				if($_COOKIE["session_id"]) echo "<span class=bodySmall> — <a href=\"$LINKPATH/linkto.php?pub=" . $urlid . "&fl=p&pa=notes\">LINK</a> </span>";
				else echo "<span class=bodySmall> — <a href=\"$SECUREPATH/login.php?co=" . $urlid . "&fl=p&pa=notes\">LINK</a> </span>";
		}
		else {
			if($_COOKIE["session_id"]) echo "<span class=bodySmall> — <a href=\"$LINKPATH/publications_mail.php?pub=" . $cid . "&fl=p&pa=notes\">REQUEST HARDCOPY</a> </span>";
			else echo "<span class=bodySmall> — <a href=\"$SECUREPATH/login.php?co=" . $cid . "&fl=p&pa=notes\">REQUEST HARDCOPY</a> </span>";
		}
		echo "</p>
";
			$idate=$udate=$pdate=$pn=$cid=$title=$stitle=$dt=$rpf=$ubsid="";
      }
      echo "
";
    }