| Current Path : /var/www/cesa.co.za/mentanet/ |
| Current File : /var/www/cesa.co.za/mentanet/login.php |
<?php include("inc_functions.php"); ?>
<?php
if (!empty($_POST["username"]) && !empty($_POST["password"])) {
$sql = "SELECT * FROM CCMStudents WHERE WebUsername='".$_POST["username"]."' AND WebPassword='".$_POST["password"]."' AND BlockAccess='n'";
$recStudents = mysql_query($sql);
if ($rowStudents = mysql_fetch_assoc($recStudents)) {
$_SESSION["StudentID"] = $rowStudents["CCMStudentID"];
$_SESSION["UserType"] = "C";
$_SESSION["UserTypeDesc"] = "Candidate";
$_SESSION["ForumUsername"] = $rowStudents["FirstName"]." ".$rowStudents["Surname"];
$_SESSION["ForumPassword"] = $rowStudents["WebPassword"];
header("Location: http://www.cesa.co.za/mentanet/index.php");
} else {
$sql = "SELECT * FROM CCMMentors WHERE WebUsername='".$_POST["username"]."' AND WebPassword='".$_POST["password"]."' AND BlockAccess='n'";
$recStudents = mysql_query($sql);
if ($rowStudents = mysql_fetch_assoc($recStudents)) {
$_SESSION["StudentID"] = $rowStudents["CCMMentorID"];
$_SESSION["UserType"] = "M";
$_SESSION["UserTypeDesc"] = "Mentor";
$_SESSION["ForumUsername"] = $rowStudents["FirstName"]." ".$rowStudents["Surname"];
$_SESSION["ForumPassword"] = $rowStudents["WebPassword"];
header("Location: http://www.cesa.co.za/mentanet/index.php");
} else {
$sql = "SELECT * FROM CCMEmployers WHERE WebUsername='".$_POST["username"]."' AND WebPassword='".$_POST["password"]."' AND BlockAccess='n'";
$recStudents = mysql_query($sql);
if ($rowStudents = mysql_fetch_assoc($recStudents)) {
$_SESSION["StudentID"] = $rowStudents["CCMEmployerID"];
$_SESSION["UserType"] = "E";
$_SESSION["UserTypeDesc"] = "Employer";
$_SESSION["ForumUsername"] = $rowStudents["FirstName"]." ".$rowStudents["Surname"];
$_SESSION["ForumPassword"] = $rowStudents["WebPassword"];
header("Location: http://www.cesa.co.za/mentanet/index.php");
} else {
$sMsg = "Invalid username and/or password.";
}
}
}
mysql_free_result($recStudents);
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>MentaNet</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<!--[if IE 5]>
<style type="text/css">
/* place css box model fixes for IE 5* in this conditional comment */
.twoColFixLtHdr #sidebar1 { width: 230px; }
</style>
<![endif]--><!--[if IE]>
<style type="text/css">
/* place css fixes for all versions of IE in this conditional comment */
.twoColFixLtHdr #sidebar1 { padding-top: 30px; }
.twoColFixLtHdr #mainContent { zoom: 1; }
/* the above proprietary zoom property gives IE the hasLayout it needs to avoid several bugs */
</style>
<![endif]-->
</head>
<body class="twoColFixLtHdr">
<div id="container">
<?php include("inc_header.php"); ?>
<div id="mainContent">
<h1> Login</h1>
<?php
if (isset($sMsg) && !empty($sMsg)) echo "<span class='errmsg'>".$sMsg."</span>";
?>
<form id="form1" name="form1" method="post" action="login.php">
<table border="0" cellspacing="0" cellpadding="5">
<tr>
<td>Username:</td>
<td><label>
<input type="text" name="username" id="username" />
</label></td>
</tr>
<tr>
<td>Password:</td>
<td><label>
<input type="password" name="password" id="password" />
</label></td>
</tr>
<tr>
<td><label>
<input type="submit" name="button" id="button" value="Submit" />
</label></td>
<td> </td>
</tr>
</table>
</form>
<p><a href="forgotpwd.php">Have you forgotten your password?</a></p>
</div>
<?php include("inc_footer.php"); ?>
<!-- end #container --></div>
</body>
</html>