When using an include file of functions, I get the following error:
Parse error: parse error, unexpected $ in /usr/local/apache_1.3.20/htdocs/dev/functions.php on line 195
In my include file there is not line 195! My closing php bracket is on line 186! I have no clue to fix this, any ideas?
Here's my include file:
<?
//display functions
function pageheaders($title)
{
echo "<head><title>$title</title>";
echo "<style type=\"text/css\">";
echo "<!--";
echo "body {";
echo "background-attachment : scroll;";
echo "background-color : #FFFFFF;";
echo "background-image : url(\"gbg.gif\"";
echo "background-repeat : no-repeat;";
echo "}";
echo "-->";
echo "</style></head><body>";
}
function userheaders($title, $redirect, $time)
{
echo "<head><title>$title</title>";
echo "<style type=\"text/css\">";
echo "<!--";
echo "body {";
echo "background-attachment : scroll;";
echo "background-color : #FFFFFF;";
echo "background-image : url(\"gbg.gif\"";
echo "background-repeat : no-repeat;";
echo "}";
echo "-->";
echo "</style></head><body onLoad=window.setTimeout(\"location.href='$redirect'\",$time)>";
}
function headermenu()
{
echo "<center><table width=\"100%\" border=\"0\">";
echo "<tr><td width=\"16%\"><div align=\"center\">Chat</div></td>";
echo "<td width=\"16%\"><div align=\"center\">email</div></td>";
echo "<td width=\"16%\"><div align=\"center\">reports</div></td>";
echo "<td width=\"16%\"><div align=\"center\">add workorder</div></td>";
echo "<td width=\"16%\"><div align=\"center\">personal data</div></td>";
echo "<td width=\"20%\"><div align=\"center\">logout</div></td></tr></table></center>";
}
function footermenu()
{
echo "<table width=\"100%\" border=\"0\" bordercolor=\"#00cf63\" bgcolor=\"#00Cf63\">";
echo "<tr><td><table width=\"100%\" border=\"0\">";
echo "<tr><td width=\"16%\"><div align=\"center\">chat</div></td>";
echo "<td width=\"16%\"><div align=\"center\">email</div></td>";
echo "<td width=\"16%\"><div align=\"center\">reports</div></td>";
echo "<td width=\"16%\"><div align=\"center\">add workorder</div></td>";
echo "<td width=\"16%\"><div align=\"center\">personal data</div></td>";
echo "<td width=\"20%\"><div align=\"center\">logout</div></td></tr></table></td></tr>";
echo "<tr><td><div align=\"center\"><p>";
echo "This internal website is for LTD Direct employees. Unauthorized use";
echo " or access is prohibited. <br>";
echo "To report abuse or bugs email amiller@ltddirect.com";
echo "</p></div></td></tr></table>";
}
function pagefooters()
{
echo "</body>";
echo "";
}
function loginform()
{
echo "<a href=\"registerform.php\">Not a member?</a>";
echo "<form method=post action=\"member.php\">";
echo "<table>";
echo "<tr>";
echo "<td colspan=2>Members log in here:</td>";
echo "<tr>";
echo "<td>Username:</td>";
echo "<td><input type=text name=username></td></tr>";
echo "<tr>";
echo "<td>Password:</td>";
echo "<td><input type=password name=passwd></td></tr>";
echo "<tr>";
echo "<td colspan=2 align=center>";
echo "<input type=submit value=\"Log in\"></td></tr>";
echo "<tr>";
echo "<td colspan=2><a href=\"forgot_form.php\">Forgot your password?</a></td>";
echo "</tr>";
echo "</table></form>";
}
function regform()
{
echo "<form method=post action=\"register_new.php\">";
echo "<table>";
echo "<tr><td>Email address:</td>";
echo "<td><input type=text name=email size=30 maxlength=100></td></tr>";
echo "<tr><td>Preferred username <br>(max 16 chars):</td>";
echo "<td valign=top><input type=text name=username size=16 maxlength=16></td></tr>";
echo "<tr><td>Password <br>(between 6 and 16 chars):</td>";
echo "<td valign=top><input type=password name=passwd size=16 maxlength=16></td></tr>";
echo "<tr><td>Confirm password:</td>";
echo "<td><input type=password name=passwd2 size=16 maxlength=16></td></tr>";
echo "<tr><td colspan=2 align=center><input type=submit value=\"Register\"></td></tr>";
echo "</table></form>";
//authorization functions
function userlogin($username, $password)
//check username and password with db
//if yes, return true
//else return false
{
//connect to db
$conn = userdbconnect();
if (!$conn)
return 0;
//check username
$result = mysql_query("select * from user where username='$username'
and passwd = password('$password')"
if (!result)
return 0;
if (mysql_num_rows($result)>0)
return 1;
else
return 0;
}
function checkvaliduser()
//see if somebody is logged in and notify them if not
{
global $validuser;
global $validfirst;
global $validlast;
global $validemail;
global $validext;
global $validlocation;
if (session_is_registered("validuser", "validfirst", "validlast", "validemail", "validext", "validlocation")
{
echo "Logged in as $validuser.";
echo "<br>";
}
else
{
pageheaders("Problem:"
echo "You are logged in.<br>
You must be logged in to view this page.<br>
Click <a href=\"login.php\">here</a> to login.";
pagefooters();
exit;
}
}
//db functions
function userdbconnect()
{
$result = mysql_pconnect("localhost", "wouser", "09fowler23"
if (!$result)
return false;
if (!mysql_select_db("workorder")
return false;
return $result;
}
?>
Parse error: parse error, unexpected $ in /usr/local/apache_1.3.20/htdocs/dev/functions.php on line 195
In my include file there is not line 195! My closing php bracket is on line 186! I have no clue to fix this, any ideas?
Here's my include file:
<?
//display functions
function pageheaders($title)
{
echo "<head><title>$title</title>";
echo "<style type=\"text/css\">";
echo "<!--";
echo "body {";
echo "background-attachment : scroll;";
echo "background-color : #FFFFFF;";
echo "background-image : url(\"gbg.gif\"";
echo "background-repeat : no-repeat;";
echo "}";
echo "-->";
echo "</style></head><body>";
}
function userheaders($title, $redirect, $time)
{
echo "<head><title>$title</title>";
echo "<style type=\"text/css\">";
echo "<!--";
echo "body {";
echo "background-attachment : scroll;";
echo "background-color : #FFFFFF;";
echo "background-image : url(\"gbg.gif\"";
echo "background-repeat : no-repeat;";
echo "}";
echo "-->";
echo "</style></head><body onLoad=window.setTimeout(\"location.href='$redirect'\",$time)>";
}
function headermenu()
{
echo "<center><table width=\"100%\" border=\"0\">";
echo "<tr><td width=\"16%\"><div align=\"center\">Chat</div></td>";
echo "<td width=\"16%\"><div align=\"center\">email</div></td>";
echo "<td width=\"16%\"><div align=\"center\">reports</div></td>";
echo "<td width=\"16%\"><div align=\"center\">add workorder</div></td>";
echo "<td width=\"16%\"><div align=\"center\">personal data</div></td>";
echo "<td width=\"20%\"><div align=\"center\">logout</div></td></tr></table></center>";
}
function footermenu()
{
echo "<table width=\"100%\" border=\"0\" bordercolor=\"#00cf63\" bgcolor=\"#00Cf63\">";
echo "<tr><td><table width=\"100%\" border=\"0\">";
echo "<tr><td width=\"16%\"><div align=\"center\">chat</div></td>";
echo "<td width=\"16%\"><div align=\"center\">email</div></td>";
echo "<td width=\"16%\"><div align=\"center\">reports</div></td>";
echo "<td width=\"16%\"><div align=\"center\">add workorder</div></td>";
echo "<td width=\"16%\"><div align=\"center\">personal data</div></td>";
echo "<td width=\"20%\"><div align=\"center\">logout</div></td></tr></table></td></tr>";
echo "<tr><td><div align=\"center\"><p>";
echo "This internal website is for LTD Direct employees. Unauthorized use";
echo " or access is prohibited. <br>";
echo "To report abuse or bugs email amiller@ltddirect.com";
echo "</p></div></td></tr></table>";
}
function pagefooters()
{
echo "</body>";
echo "";
}
function loginform()
{
echo "<a href=\"registerform.php\">Not a member?</a>";
echo "<form method=post action=\"member.php\">";
echo "<table>";
echo "<tr>";
echo "<td colspan=2>Members log in here:</td>";
echo "<tr>";
echo "<td>Username:</td>";
echo "<td><input type=text name=username></td></tr>";
echo "<tr>";
echo "<td>Password:</td>";
echo "<td><input type=password name=passwd></td></tr>";
echo "<tr>";
echo "<td colspan=2 align=center>";
echo "<input type=submit value=\"Log in\"></td></tr>";
echo "<tr>";
echo "<td colspan=2><a href=\"forgot_form.php\">Forgot your password?</a></td>";
echo "</tr>";
echo "</table></form>";
}
function regform()
{
echo "<form method=post action=\"register_new.php\">";
echo "<table>";
echo "<tr><td>Email address:</td>";
echo "<td><input type=text name=email size=30 maxlength=100></td></tr>";
echo "<tr><td>Preferred username <br>(max 16 chars):</td>";
echo "<td valign=top><input type=text name=username size=16 maxlength=16></td></tr>";
echo "<tr><td>Password <br>(between 6 and 16 chars):</td>";
echo "<td valign=top><input type=password name=passwd size=16 maxlength=16></td></tr>";
echo "<tr><td>Confirm password:</td>";
echo "<td><input type=password name=passwd2 size=16 maxlength=16></td></tr>";
echo "<tr><td colspan=2 align=center><input type=submit value=\"Register\"></td></tr>";
echo "</table></form>";
//authorization functions
function userlogin($username, $password)
//check username and password with db
//if yes, return true
//else return false
{
//connect to db
$conn = userdbconnect();
if (!$conn)
return 0;
//check username
$result = mysql_query("select * from user where username='$username'
and passwd = password('$password')"
if (!result)
return 0;
if (mysql_num_rows($result)>0)
return 1;
else
return 0;
}
function checkvaliduser()
//see if somebody is logged in and notify them if not
{
global $validuser;
global $validfirst;
global $validlast;
global $validemail;
global $validext;
global $validlocation;
if (session_is_registered("validuser", "validfirst", "validlast", "validemail", "validext", "validlocation")
{
echo "Logged in as $validuser.";
echo "<br>";
}
else
{
pageheaders("Problem:"
echo "You are logged in.<br>
You must be logged in to view this page.<br>
Click <a href=\"login.php\">here</a> to login.";
pagefooters();
exit;
}
}
//db functions
function userdbconnect()
{
$result = mysql_pconnect("localhost", "wouser", "09fowler23"
if (!$result)
return false;
if (!mysql_select_db("workorder")
return false;
return $result;
}
?>