Hi folks,
I recently converted the script below from PHP/FI to PHP 3+. For some reason, I get tons of parse errors when I try to run it on my linux box with the latest versions of PHP, MySQL, and Apache. My other scripts(newer scripts) work fine, but this old script doesn't work.
I included the code below and hopefully someone can spot mistakes.
Thanks
<h2><b>Geological Sciences Faculty</b></h2>
</center>
<hr>
<?
$database = "faculty";
$table = "facinfo";
/ only ns > 1 and ie > 2 seem to recognize space symbol /
if (ereg("(ozilla.[2-9]|MSIE.[3-9])",$HTTP_USER_AGENT)):
$space = " ";
else:
$space = " ";
endif;
/ This first if is for no argument passes.
if that is the case lets give them the entire list. /
if ($argv[0] == ""):
$result = mysql($database, "select uid, fname, lname, email from $table order by lname");
$num = mysql_numrows($result);
$i = 0;
if ($num<1):
echo "The $database.$table database seems to be empty.... Strange, very strange.";
else:
/* Create table header */
echo "<center><table border=2><tr><th bgcolor=\"#c2c2c2\">Name:</th><th bgcolor=\"#c2c2c2\">Email address:</th>";
while ($i<$num):
$uid = mysql_result($result,$i,"uid");
$fname = mysql_result($result,$i,"fname");
$lname = mysql_result($result,$i,"lname");
$email = mysql_result($result,$i,"email");
echo "<tr>";
echo "<td align=left>";
if ($lname != "Elliot") {
echo "<a href=\"$PHP_SELF?$uid\">$fname $lname</a>";
}else{
echo "<a href=\"http://www.geology.ohio-state.edu/intranet/people/faculty/elliot/index.html\">$fname $lname</a>";
}
echo "<td align=left><a href=\"mailto:$email\">$email</a>";
echo "</tr>";
$i++;
endwhile;
/* finish the table */
echo "</table></center>";
endif;
/ Get a specific person /
else:
$uid = "$argv[0]";
$result = mysql($database, "select * from $table where uid='$uid'");
$num = mysql_numrows($result);
$i=0;
if ($num<1):
echo "<p align=center>Sorry, we don't have any $database by that name";
else:
while($i<$num):
$uid = mysql_result($result,$i,"uid");
$date = mysql_result($result,$i,"idate");
$nicedate = date("D M d, Y",$date);
$prefix = mysql_result($result,$i,"prefix");
$fname = mysql_result($result,$i,"fname");
$mname = mysql_result($result,$i,"mname");
$lname = mysql_result($result,$i,"lname");
$title1 = mysql_result($result,$i,"title1");
$title2 = mysql_result($result,$i,"title2");
$special1 = mysql_result($result,$i,"special1");
$special2 = mysql_result($result,$i,"special2");
$address1 = mysql_result($result,$i,"address1");
$address2 = mysql_result($result,$i,"address2");
$address3 = mysql_result($result,$i,"address3");
$city = mysql_result($result,$i,"city");
$state = mysql_result($result,$i,"state");
$zip = mysql_result($result,$i,"zip");
$phone = mysql_result($result,$i,"phone");
$fax = mysql_result($result,$i,"fax");
$email = mysql_result($result,$i,"email");
$www = mysql_result($result,$i,"www");
$class = mysql_result($result,$i,"class");
echo "<img src=\"/people/$database/images/$uid.jpg\" align=right border=0>";
/* Print out the name line (check to see if certain fields exist) */
echo "<font size=+3><b>";
if ($prefix != ""):
echo "$prefix ";
endif;
if ($fname != ""):
echo "$fname ";
endif;
if ($mname != ""):
echo "$mname ";
endif;
echo "$lname</b></font>";
echo "<br><br>";
if ($title1 != "" || $title2 != ""):
echo "<font size=+1><b>$title1</b><br>";
echo "<b>$title2</b><br><br></font>";
endif;
if ($special1 != "" || $special2 != ""):
echo "<u><i><b>Areas of specialization:</b></i></u><br>";
echo "$space$space$space $special1<br>";
echo "$space$space$space $special2<br>";
endif;
echo "<br>";
if ($city != "" || $state != "" || $zip != ""):
echo "<u><i><b>Contact Information:</b></i></u><br>";
if ($address1 != ""):
echo "$space$space$space $address1<br>";
endif;
if ($address2 != ""):
echo "$space$space$space $address2<br>";
endif;
if ($address3 != ""):
echo "$space$space$space $address3<br>";
endif;
echo "$space$space$space $city, $state $zip<br>";
echo "<br>";
if ($phone != ""):
echo "$space$space$space<i>Office</i> - $phone<br>";
endif;
echo "$space$space$space<i>Department</i> - 614-292-2721<br>";
if ($fax != ""):
echo "$space$space$space<i>Fax</i> - $fax<br>";
endif;
if ($email != ""):
echo "<br>";
echo "$space$space$space<i>E-mail</i> - <a href=\"mailto: $email\">$email</a><br>";
endif;
if ($www != ""):
echo "<br>";
echo "$space$space$space<b><i>Personal WWW Page</i></b> - <a href=\"$www\" target=_top>$www</a><br>";
echo "<br>";
endif;
endif;
$modfname = ereg_replace(" ","_",$fname);
$modlname = ereg_replace(" ","_",$lname);
echo "<br>";
echo "<hr><center>";
echo "<a href=\"/people/faculty/qacademic.phtml?$uid+$modfname+$modlname\">Academic Background</a> | <a href=\"/people/faculty/qpublication.phtml?$uid+$modfname+$modlname\">Publications</a> | <a href=\"/people/faculty/qgrant.phtml?$uid+$modfname+$modlname\">Grants & Contracts</a>";
echo "</center><hr>";
echo "<br><font size=-2>Page last updated: <i>$nicedate</i></font>";
$i++
endwhile;
endif;
endif;
?>
</body>