<<?php
session_start();
//GroupAware
//Team 7
function redirect($page){
// redirect user to $page
echo '<script language="JavaScript">window.location.href="'.$page.'"</script>'."\n";
}
function logout() {
// log user out, unregister sessions
unset($_SESSION['sess_userid']);
session_unregister($sess_userid);
session_unset();
session_destroy();
}
if ($HTTP_GET_VARS['action'] == 'logout') {
logout();
redirect('index.php');
}
?>
<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">
<style type="text/css">
<!--
@import url("tabs.css");
-->
</style>
</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="200" height="25" border="0" cellpadding="0" cellspacing="0" bordercolor="#660000" class="tabs">
<tr valign="middle" class="tabs">
<td width="100" bgcolor="#660000" class="tabs">
<div align="center"><font color="#FFFFFF"><strong>Log In </strong></font></div></td>
<td width="100" bgcolor="#FFFFFF" class="tabs">
<div align="center"><strong><a href="register.php">Register</a></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>
<br>
<table width="100%" height="80%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td colspan="2" valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="820"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="420" class="css"> <div align="center"> <img src="groupAwareLogoLg2.gif" width="309" height="298"></div></td>
<td class="css"> <p><font color="#003366" size="5">I</font><font size="2">f
you forget your password, enter your email address and your
login information will be sent to you.</font><br>
(This function is not operation, but is a place holder for
future versions)<br>
</p>
<?php
//makes connection to database
require_once('Connections/dbsvr.php'); //connect to student server
require_once('Connections/groupaware.php'); //connect to testing server
//if type is blank or main it knows that it's first visit, asks you to log in
if($_POST['type'] != "log")
{?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td> <table width="250" border="0" cellpadding="0" cellspacing="3">
<form name="login" method="post" action="index.php">
<tr>
<td class="css"> <div align="right">email: </div></td>
<td> <input name="username" type="text" class="blocks"></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="Submit" value="Submit">
<input type="hidden" name="type" value="log"></td>
</tr>
</form>
</table></td>
</tr>
</table>
<?php
}
//if type is log, it process the form information from before
if($_POST["type"] == "log")
{
$name = $_POST['username'];
$pass = $_POST['password'];
//database query get information about user
mysql_select_db($database_dbsvr, $dbsvr);
$query_auth = "SELECT username, password FROM users WHERE username = '$name';";
$auth = mysql_query($query_auth, $dbsvr) or die(mysql_error());
$row_auth = mysql_fetch_assoc($auth);
$auth_TotalRows = mysql_num_rows($auth);
//if that user doesn't exist it notifies them
if($auth_TotalRows < 1)
{?>
<table width="100%" border="0">
<tr>
<td class="css">Username does not exist. Please <a href="index.php">return
to the main page</a> and try again. If you do not have
an account register <a href="register.php">here</a>.</td>
</tr>
</table>
<span class="css">
<?php
}
//if they do exist does more checks
if($auth_TotalRows > 0)
{
//checks to see if user and password are correct, if so displays that
if(($name == $row_auth['username']) && ($pass == $row_auth['password']))
{
//session_start();
session_register("sess_userid");
//$sess_userid = "valid";
//echo $sess_userid; //debug to verify session is set
$sess_userid = $row_auth['username'];
//header("Location:member.php"); //headers already sent w/ session - changed to redirect function
redirect('groups.php'); //redirects to group.php upon successful login and sets userid as session var
}
//if username is correct but pass isn't it denies
else
{?>
</span> <table width="100%" border="0">
<tr>
<td class="css">Password not correct, <a href="index.php">return
to the main page</a> and try again.</td>
</tr>
</table>
<?php
}
}
}
?>
<p align="center" class="css"> <br>
<br>
[<a href="register.php">Register</a>] </p></td>
</tr>
</table></td>
<td> </td>
</tr>
</table>
<p align="center" class="css"> </p></td>
</tr>
<tr>
<td height="20" colspan="2" valign="top"><div align="center"><font size="1" face="Arial, Helvetica, sans-serif">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>