What the hell is up!? I did your "include_once" change, and everything was cool, until I tried to add an "else" statement to the last bracket. That way, if the session isn't registered, it will prompt them to log in. Here's what it looks like now:
<?
session_start();
$tid = $_REQUEST['tid'];
$user_id = $_SESSION['user_id'];
$user_name = $_SESSION['user_name'];
?>
<html>
<head>
<title>Administrative Options</title>
<basefont face="Verdana">
<style type="text/css">
BODY {
SCROLLBAR-BASE-COLOR: #484848;
SCROLLBAR-ARROW-COLOR: #EB9E00;
}
SELECT {
FONT-FAMILY: Verdana,Arial,Helvetica,sans-serif;
FONT-SIZE: 11px;
COLOR: #000000;
BACKGROUND-COLOR: #CFCFCF
}
TEXTAREA, .bginput {
FONT-SIZE: 12px;
FONT-FAMILY: Verdana,Arial,Helvetica,sans-serif;
COLOR: #000000;
BACKGROUND-COLOR: #FFFFFF
}
A:link, A:visited, A:active {
COLOR: #000000;
}
A:hover {
COLOR: #008800;
}
#cat A:link, #cat A:visited, #cat A:active {
COLOR: #EB9E00;
TEXT-DECORATION: none;
}
#cat A:hover {
COLOR: #EB9E00;
TEXT-DECORATION: underline;
}
#ltlink A:link, #ltlink A:visited, #ltlink A:active {
COLOR: #000000;
TEXT-DECORATION: none;
}
#ltlink A:hover {
COLOR: #008800;
TEXT-DECORATION: underline;
}
.thtcolor {
COLOR: #000000;
}
.pagenumstatic {
color: #000000;
background-color: #EB9E00;
border-color: #000000;
border-style: solid;
border-width: 1px;
margin: 0px;
padding: 0px;
padding-left: 4px;
padding-right: 4px;
padding-top: 1px;
padding-bottom: 1px;
width: 1em;
text-decoration: none;
}
.pagenum A:link, .pagenum A:visited, .pagenum A:active {
color: #909090;
background-color: #484848;
border-color: #000000;
border-style: solid;
border-width: 1px;
margin: 0px;
padding: 0px;
padding-left: 4px;
padding-right: 4px;
padding-top: 1px;
padding-bottom: 1px;
width: 1em;
text-decoration: none;
}
.pagenum A:hover {
color: #000000;
background-color: #EB9E00;
text-decoration: none;
border-color: #000000;
border-style: solid;
border-width: 1px;
margin: 0px;
padding: 0px;
padding-left: 4px;
padding-right: 4px;
padding-top: 1px;
padding-bottom: 1px;
width: 1em;
text-decoration: none;
}
</style>
</head>
<?
if (session_is_registered('user_id'))
{
include_once("/home3/rizinc/public_html/conf.php");
include_once("/home3/rizinc/public_html/functions.php");
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
mysql_select_db($db) or die ("Unable to select database!");
$sql = "SELECT team_members.leader FROM team_members, user WHERE user.user_id = $user_id AND team_members.user_id = user.user_id AND team_members.team_id = $tid LIMIT 0 , 30";
$sqlr = mysql_query ($sql);
$array = mysql_fetch_array ($sqlr);
if ($array['leader'] == 0) {
print "You do not have the credentials required to use this page.";
exit();
} elseif (($array['leader'] == 1) || ($_SESSION['user_name'] == "admin")) {
?>
<body>
<?
if (!$tid)
{
print ("No team specified!");
} else {
// includes
include_once("/home3/rizinc/public_html/conf.php");
include_once("/home3/rizinc/public_html/functions.php");
// open database connection
$connection = mysql_connect($host, $user, $pass) or die ("Unable to connect!");
// select database
mysql_select_db($db) or die ("Unable to select database!");
// generate and execute query
$query = "SELECT id, title, tid, timestamp FROM team_news WHERE tid=$tid ORDER BY timestamp DESC";
$result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());
// if records present
if (mysql_num_rows($result) > 0)
{
// iterate through resultset
// print title with links to edit and delete scripts
while($row = mysql_fetch_object($result))
{
?>
<font size="-1"><b><? echo $row->title; ?></b> [<? echo formatDate($row->timestamp); ?>]</font>
<br>
<font size="-2"><a href="edit.php?id=<?=$row->id?>&tid=<?=$tid?>">edit</a> | <a href="delete.php?id=<?=$row->id?>&tid=<?=$tid?>">delete</a></font>
<p>
<?
}
}
// if no records present
// display message
else
{
?>
<font size="-1">No stories currently available</font><p>
<?
}
// close connection
mysql_close($connection);
?>
<font size="-2"><a href="add.php?tid=<?php print $tid; ?>">add new</a></font>
<?php
}
}
} Else {
print ("Please log in");
include("/home3/rizinc/public_html/login_form.html");
?>
</body>
</html>
And I get that God-awful "Unexpected $" error again. What the hell is going on?
Maybe it has something to do with "login_form.html". Here's that:
<html>
<body>
<table cellspacing="5" cellpadding="5">
<form action="................................login.php" method="POST">
<tr>
<td valign="top"><b><font size="-1">Username</font></b></td>
<td><input size="20" maxlength="20" type="text" name="username"></td>
</tr>
<tr>
<td valign="top"><b><font size="-1">Password</font></b></td>
<td><input size="20" maxlength="20" type="text" name="password"></td>
</tr>
<tr>
<td colspan=2><input type="Submit" name="submit" value="Login"></td>
</tr>
</form>
</table>
</body>
</html>