about.php
account.php
auth.php
contact.php
create.php
edit_schedule.php
faq.php
group_view.php
groups.php
index.php
password.php
register.php
results.php
schedules.ph
p



download
all files

Auth.php Source Code
<?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>
<b><u>Authentication:</u></b> Log In Below
</td>
</tr>
<tr>
<td>&nbsp;</td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<form name="login" method="post" action="auth.php">
<tr>
<td>Username: <input type="text" name="username"></td>
</tr>
<tr>
<td>Password: <input type="password" name="password"></td>
</tr>
<tr>
<td><input type="submit" name="Submit" value="Login">
<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>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><?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('user');

$user = $row_auth['username'];

header("Location:member.php");
}

//if username is correct but pass isn't it denies

else
{?>
<table width="100%" border="0">
<tr>
<td>Password not correct, <a href="index.php">return to the main page</a> and try again.</td>
</tr>
</table><?php
}
}
}
?>