Learn programming language

E-Learning Student Project

PHP

This project is meant for beginner though it needs your concentration to understand it because it uses Access database. But be sure of one thing if you need assistance just send me a message.

Click here to download

index code

<?php

session_start();

$uid = $_SESSION[‘uid’];

if($_POST[‘ev’] == “1”) {

$subj = ucwords($_POST[‘subj’]);
$msg = $_POST[‘msg’];
$lect = $_POST[‘lect’];
$dt = Date(“M d, Y”);

$sql = “INSERT INTO message VALUES (‘$lect’,’$uid’,’$subj’,’$dt’,’$msg’,’SENT’)”;
include(“util/DBCon.php”);
$rs = mysql_query($sql, $con);
mysql_close($con);
header(“Location: portal_msg.php?ul=1″);

}

?>

<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
<title>The Federal Polytechnic, Ede – Distance Learning</title>
<script language=”javascript” src=”jquery-1.4.2.js”></script>

<style type=”text/css”>

#fnt {
font-size: 8pt;
font-family: tahoma;
cursor:pointer;
cursor: hand;
}

#fnt2 {
font-size: 8pt;
font-family: tahoma;
}

BODY {
margin: 0pt;
background-color: #31343f;
}
</style>

<SCRIPT language=”javascript”>

function Redirect(url) {
window.location = url;
}

$(document).ready(function() {

$(“.btn”).toggle(function(){
$(“#alt”).slideUp(‘1000’);
$(“#uploader”).slideDown(‘1000’);
}, function(){
$(“#uploader”).slideUp(‘1000’);
});

$(“.sentbtn”).toggle(function(){
$(“#senter”).slideDown(‘1000’);
}, function(){
$(“#senter”).slideUp(‘1000’);
});

});

</SCRIPT>

</head>

<body>

<TABLE align=”center” cellpadding=”0″ cellspacing=”0″ style=”border:1px solid #111111″>
<TR>
<TD width=”905″ height=”347″ background=”images/logo2.png” style=”background-repeat:no-repeat”>&nbsp;</TD>
</TR>
<TR>
<TD height=”368″ style=”padding:10pt” bgcolor=”#e3e4e8″ valign=”top”>

<table>
<tr>
<td width=”680″ height=”308″ id=”fnt2″ valign=”top”><p><strong style=”font-size:13pt”>SEND MESSAGE TO LECTURERS</strong></p>
<p>For any comment, complaint, advise, please contact us today for more information.</p><p>
<?php
if(isset($_GET[‘ul’]))
{
echo ‘<b id=”alt” style=”color:green”><blink>Message Sent Successfully.</blink></b>’;
}

?>
<p><input type=”button” class=”btn” value=”Send New Message” id=”fnt”>
<input type=”button” class=”sentbtn” value=”Sent Messages” id=”fnt”>
<p>

<div style=”padding-left:50pt; display:none” id=”uploader”>
<FORM name=”Up_Asg” action=”portal_msg.php” method=”post”>
<table>
<tr>
<td width=”112″ id=”fnt2″>Subject:</td>
<td width=”286″>
<input type=”text” size=”37″ name=”subj” id=”fnt2″ style=”padding:2pt; border: 1px solid #666666; font-family: Tahoma; font-size: 8pt”>
</td>
</tr>

<tr>
<td width=”112″ id=”fnt2″>Lecturer-In-Charge:</td>
<td width=”286″>

<SELECT name=”lect” style=”font-family: Tahoma; font-size: 8pt; padding:2pt; border: 1px solid #666666″ onChange=”getCourseCode()”>
<?php

$sql = “SELECT * FROM lecturers ORDER BY name”;
include(“./util/DBCon.php”);
$rs = mysql_query($sql, $con);
while( $rw = mysql_fetch_row($rs) )  {
echo ‘<OPTION>’.$rw[0].'</OPTION>’;
}

?>
</SELECT>

</td>
</tr>
<tr>
<td width=”112″ id=”fnt2″ valign=”top”>Message:</td>
<td width=”286″>
<input type=”hidden” name=”ev” value=”1″>
<textarea cols=”60″ rows=”4″ name=”msg” id=”fnt2″ style=”padding:2pt; border: 1px solid #666666; font-family: Tahoma; font-size: 8pt”></textarea>
</td>
</tr>
<tr>
<td width=”112″ id=”fnt2″></td>
<td width=”286″>
<input type=”submit” value=”Send Message” style=”font-family: Tahoma; font-size: 8pt; color: #FFFFFF; border: 1px solid #333333; background-color: #336699; padding:2pt;”></td>
</tr>
</table>
</FORM>
</div>

<div style=”display:none” id=”senter”><br><br>
<strong id=”fnt2″ style=”font-size:13pt”>Sent Messages</strong><br><br>
<table cellpadding=”0″ cellspacing=”0″ border=”0″>
<tr>
<td width=”119″ height=”27″ id=”fnt2″ style=”padding:2pt; padding-left: 10pt; background-color:#EFEFEF; border-top:1px solid #666666; border-bottom: 1px solid #666666; border-left: 1px solid #666666″><strong>To</strong></td>
<td width=”148″ height=”27″ id=”fnt2″ style=”padding:2pt; padding-left: 10pt; background-color:#EFEFEF; border-top:1px solid #666666; border-bottom: 1px solid #666666; border-left: 1px solid #666666″><strong>Subject</strong></td>
<td width=”103″ height=”27″ id=”fnt2″ style=”padding:2pt; padding-left: 10pt; background-color:#EFEFEF; border-top:1px solid #666666; border-bottom: 1px solid #666666; border-left: 1px solid #666666″><strong>Date Sent</strong></td>
<td width=”310″ height=”27″ id=”fnt2″ style=”padding:2pt; padding-left: 10pt;background-color:#EFEFEF; border:1px solid #666666″><strong>Message</strong></td>

</tr>

<?php

$sql = “SELECT * FROM message WHERE type=’SENT’ AND sender=’$uid’ ORDER BY date”;
include(“./util/DBCon.php”);

$rs = mysql_query($sql, $con);
while( $rw = mysql_fetch_row($rs) )  {

echo ‘
<tr>
<td width=”134″ height=”25″ id=”fnt2″ valign=”top” title=”‘.$rw[0].'” style=”padding:5pt; padding-left: 10pt; background-color:#3A6A87;color:white;border-bottom: 1px solid white; border-left: 1px solid white”>’.$rw[0].'</td>
<td width=”68″ height=”25″ id=”fnt2″ valign=”top” title=”‘.$rw[2].'” style=”padding:5pt; padding-left: 10pt; background-color:#3A6A87;color:white; border-bottom: 1px solid white; border-left: 1px solid white”>’.$rw[2].'</td>
<td width=”68″ height=”25″ id=”fnt2″ title=”‘.$rw[3].'” valign=”top” style=”padding:5pt; padding-left: 10pt; background-color:#3A6A87;color:white;border-bottom: 1px solid white; border-left: 1px solid white”>’.$rw[3].'</td>
<td width=”132″ height=”25″ title=”‘.$rw[4].'” id=”fnt2″ valign=”top” style=”padding:5pt; padding-left: 10pt; background-color:#3A6A87;color:white;border-bottom: 1px solid white; border-left: 1px solid white; border-right: 1px solid white; padding:5pt”>’.$rw[4].'</td>

</tr>
‘;
}

?>
</table>

</div>

<br><br>
<strong id=”fnt2″ style=”font-size:13pt”>Received Messages</strong><br><br>

<table cellpadding=”0″ cellspacing=”0″ border=”0″>
<tr>
<td width=”119″ height=”27″ id=”fnt2″ style=”padding:2pt; padding-left: 10pt; background-color:#EFEFEF; border-top:1px solid #666666; border-bottom: 1px solid #666666; border-left: 1px solid #666666″><strong>From</strong></td>
<td width=”148″ height=”27″ id=”fnt2″ style=”padding:2pt; padding-left: 10pt; background-color:#EFEFEF; border-top:1px solid #666666; border-bottom: 1px solid #666666; border-left: 1px solid #666666″><strong>Subject</strong></td>
<td width=”103″ height=”27″ id=”fnt2″ style=”padding:2pt; padding-left: 10pt; background-color:#EFEFEF; border-top:1px solid #666666; border-bottom: 1px solid #666666; border-left: 1px solid #666666″><strong>Date Received</strong></td>
<td width=”310″ height=”27″ id=”fnt2″ style=”padding:2pt; padding-left: 10pt;background-color:#EFEFEF; border:1px solid #666666″><strong>Message</strong></td>

</tr>

<?php

$sql = “SELECT * FROM message WHERE type=’RECV’ AND recev=’$uid’ ORDER BY date”;
include(“./util/DBCon.php”);
$c = 0;
$rs = mysql_query($sql, $con);
while( $rw = mysql_fetch_row($rs) )  {
$c++;
echo ‘
<tr>
<td width=”134″ height=”25″ id=”fnt2″ valign=”top” title=”‘.$rw[1].'” style=”padding:5pt; padding-left: 10pt; background-color:white;border-bottom: 1px solid #666666; border-left: 1px solid #666666″>’.$rw[1].'</td>
<td width=”68″ height=”25″ id=”fnt2″ title=”‘.$rw[2].'” valign=”top” style=”padding:5pt; padding-left: 10pt; background-color:white; border-bottom: 1px solid #666666; border-left: 1px solid #666666″>’.$rw[2].'</td>
<td width=”68″ height=”25″ id=”fnt2″ title=”‘.$rw[3].'” valign=”top” style=”padding:5pt; padding-left: 10pt; background-color:white;border-bottom: 1px solid #666666; border-left: 1px solid #666666″>’.$rw[3].'</td>
<td width=”132″ height=”25″ id=”fnt2″ title=”‘.$rw[4].'” valign=”top” style=”padding:5pt; padding-left: 10pt; background-color:white;border-bottom: 1px solid #666666; border-left: 1px solid #666666; border-right: 1px solid #666666; padding:5pt”>’.$rw[4].'</td>

</tr>
‘;
}

?>

</table>

</p>
<p id=”fnt2″>
<?php
if($c == 0) {
echo ‘<b>No Message</b>’;
}
?>
</p></td>
<td width=”187″ align=”center” valign=”top”>
<table>
<tr>
<td width=”172″ height=”20″ id=”fnt2″><strong><center>
STUDENT OPTIONS
</center></strong></td>
</tr>
<tr>
<td height=”31″ id=”fnt2″ style=”padding:4pt; padding-left:15pt; border:1px solid #999999; background-color:white”><a href=”portal.php” style=”color:black; text-decoration: none”>Portal Home</a></td>
</tr>
<tr>
<td height=”31″ id=”fnt2″ style=”padding:4pt;padding-left:15pt;border:1px solid #999999; background-color:white”><a href=”portal_CA_grd.php” style=”color:black; text-decoration: none”>Assignment Grading</a></td>
</tr>
<tr>
<td height=”31″ id=”fnt2″ style=”padding:4pt; padding-left:15pt;border:1px solid #999999; background-color:white”><a href=”portal_msg.php” style=”color:black; text-decoration: none”><strong>Messages</strong></a></td>
</tr>
<tr>
<td height=”31″ id=”fnt2″ style=”padding:4pt; padding-left:15pt;border:1px solid #999999; background-color:white”><a href=”school_library.php” style=”color:black; text-decoration: none”>School Library</a></td>
</tr>
<tr>
<td height=”31″ id=”fnt2″ style=”padding:4pt; padding-left:15pt;border:1px solid #999999; background-color:white”><a href=”./?lg=1″ style=”color:black; text-decoration: none”>Log Out</a></td>
</tr>
</table>

</td>
</tr>
</table>

</TD>
</TR>
<TR>
<TD height=”46″ bgcolor=”#50525e” style=”border-top:1px solid #111111; color: white; padding:10pt” id=”fnt2″><p>2011 &copy; The Federal Polytechnic, Ede, All rights reserved. </p></TD>
</TR>
</TABLE>

</body>
</html>

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button