<?php require_once('Connections/groupaware.php');
?>
<?php
session_start();
//connect to database
$suserid = $sess_userid;
mysql_select_db($database_groupaware, $groupaware);
//grab the user's current group affiliations
$query_groups = "SELECT group_detail.groupid, groups.groupID, groups.leader, groups.name FROM groups, group_detail WHERE groups.name like group_detail.groupid AND group_detail.userid like '$sess_userid' GROUP BY group_detail.groupid";
//$query_groups = "SELECT groups.groupID, groups.leader, groups.name FROM groups, group_detail WHERE group_detail.userID = '$userid' AND group_detail.groupID = groups.name";
//$groups = mysql_query("SELECT groups.groupID, groups.leader, groups.name FROM groups, group_detail WHERE group_detail.userID = '$suserid' AND group_detail.groupID = groups.name", $groupaware) or die(mysql_error());
$groups = mysql_query($query_groups, $groupaware) or die(mysql_error());
$row_groups = mysql_fetch_assoc($groups);
$totalRows_groups = mysql_num_rows($groups);
function redirect($page){
// redirect user to $page
echo '<script language="JavaScript">window.location.href="'.$page.'"</script>'."\n";
}
function checkSession($sess_userid) {
// check if session userid is active
// if not, redirect to login page
if($sess_userid=='') {
//echo 'invalid user'; //debug code
redirect('index.php'); //redirect back to login screen if session is not set
}
}
checkSession($sess_userid) //checks for session
//GroupAware
//Team 7
?>
<html>
<head>
<title>GroupAware</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="group.css" rel="stylesheet" type="text/css">
<link href="blocks.css" rel="stylesheet" type="text/css">
<link href="tabs.css" rel="stylesheet" type="text/css">
</head>
<body link="#003366" vlink="#003366" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" height="125" border="0" cellpadding="0" cellspacing="0">
<tr>
<td height="75" valign="bottom" bgcolor="#CCCCCC"><table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td width="125" height="110"><font size="7" face="Arial, Helvetica, sans-serif"><strong><a href="index.php"><img src="groupAwareLogoSm2.gif" alt="logo" width="103" height="99" border="0" align="absmiddle"></a></strong></font></td>
<td><img src="spacer.gif" width="20" height="8"><font size="7" face="Arial, Helvetica, sans-serif"><strong>Group<font color="#003366">Aware</font>
<font size="4"><br>
<img src="spacer.gif" width="150" height="1">Meeting Time Organizer</font></strong></font></td>
<td width="200" valign="top" class="css">
<div align="right"><strong><font size="1"><a href="about.php"> <font size="2">About</font></a><font size="2">
| <a href="faq.php">FAQ</a> | <a href="contact.php">Contact</a><img src="spacer.gif" width="10" height="8"></font></font></strong> </div></td>
</tr>
</table>
<div align="right">
<table width="500" height="25" border="0" cellpadding="0" cellspacing="0" bordercolor="#660000" class="tabs">
<tr valign="middle" class="tabs">
<td width="100" bgcolor="#FFFFFF" class="tabs">
<div align="center"><a href="edit_schedule.php"><strong>Edit Schedule</strong></a></div>
</td>
<td width="100" bgcolor="#660000" class="tabs">
<div align="center"><font color="#FFFFFF"><strong>View My Groups</strong></font></div>
</td>
<td width="100" bgcolor="#FFFFFF" class="tabs">
<div align="center"><strong><a href="create.php">Create a Group</a></strong></div>
</td>
<td width="100" bgcolor="#FFFFFF" class="tabs">
<div align="center"><strong><a href="account.php">My Account</font></a></strong></div>
</td>
<td width="100" nowrap bgcolor="#FFFFFF" class="tabs">
<div align="center"><strong><a href="index.php?action=logout">Log Out </a></font></strong></div>
</td>
</tr>
</table>
</div>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="5" bgcolor="#660000"><img src="spacer.gif" width="1" height="1"></td>
</tr>
</table>
</td>
</tr>
<!--
<tr>
<td height="7" colspan="2" bgcolor="#660000"><img src="spacer.gif" width="1" height="1"></td>
</tr>
-->
</table>
<table width="100%" height="80%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2" valign="top"><div align="left">
<p><span class="css"><font size="1"><a href="index.php"><strong>Home</strong></a>
<strong>> My Groups</strong></font></span> </p>
<table width="800" border="0" align="center" cellpadding="0" cellspacing="0" class="css">
<tr>
<td><p align="center"><strong><font size="4">My Groups (<?php echo $HTTP_SESSION_VARS['sess_userid']; ?>)</font></strong></p>
<table width="409" border="0" align="center" cellpadding="5" cellspacing="0" class="tabs">
<tr bgcolor="#003366">
<td width="161"><font color="#FFFFFF" size="2"><strong>Group
Name</strong></font></td>
<td width="93"> <div align="center"><font color="#FFFFFF" size="2"><strong>Group
Leader</strong></font></div></td>
<td width="25"><font color="#FFFFFF" size="2"> </font></td>
<td width="40"><font color="#FFFFFF" size="2"> </font></td>
</tr>
<?php
//---- displaying groups ---
$i=1;
do {
if ($i%2) $color = "#CCCCCC"; //sets bg color to gray for every other row
else $color = "#FFFFFF"; //sets bg color to white
?>
<tr bgcolor="<?php echo $color; ?>">
<td><a href="group_view.php?id=<?php echo $row_groups['groupID']; ?>"><?php echo $row_groups['name']; ?></a></td>
<td>
<div align="center"><?php echo $row_groups['leader']; ?></div></td>
<td width="25">
<div align="center"><font size="1"><font size="1"><font size="2"><a href="group_view.php?id=<?php echo $row_groups['groupID']; ?>">view</a></font></font><font size="2"></font></font></div></td>
<td width="40">
<div align="center"><font size="1"><font size="1"><font size="2">delete</font></font></font></div></td>
</tr>
<?php
$i++;
} while ($row_groups = mysql_fetch_assoc($groups));
?>
</table>
<br>
<p align="center"><a href="create.php">Create a New Group</a> |
<a href="edit_schedule.php">Edit My Schedule</a></p>
<p> </p></td>
</tr>
</table>
<p> </p>
</div>
</td>
</tr>
<tr>
<td height="20" colspan="2" valign="top"><div align="center"><font size="1" face="Arial, Helvetica, sans-serif"><br>
<br>
This site was created by IST students at The Pennsylvania State University.
Use of this system is subject to the terms and conditions set forth.<br>
Copyright 2005</font><font size="1"><br>
<br>
</font></div></td>
</tr>
</table>
</body>
</html>
<?php
mysql_free_result($groups);
?>