coursefeedback-devs Mailing List for Course Feedback System
Status: Planning
Brought to you by:
legaloslotr
You can subscribe to this list here.
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(4) |
---|
From: <leg...@us...> - 2009-12-24 20:38:17
|
Revision: 8 http://coursefeedback.svn.sourceforge.net/coursefeedback/?rev=8&view=rev Author: legaloslotr Date: 2009-12-24 20:38:07 +0000 (Thu, 24 Dec 2009) Log Message: ----------- Improve css design. Added Menu Bar. Modified Paths: -------------- trunk/course.php trunk/css/2col.css trunk/css/style.css trunk/includes/header.php Added Paths: ----------- trunk/css/images/ trunk/css/images/navbg.jpg Modified: trunk/course.php =================================================================== --- trunk/course.php 2009-12-24 18:03:23 UTC (rev 7) +++ trunk/course.php 2009-12-24 20:38:07 UTC (rev 8) @@ -18,7 +18,8 @@ } if (mysqli_num_rows($r)==0) { //courseId not found echo '<h2 class="largeHeading">Invalid Course Id</h2>'; - echo '<p>Click <a href="javascript:window.back();">here</a> to go back or <a href="course.php">here</a> to view all the courses available.</p>'; + echo '<p>Click <a href="javascript:window.back();">here</a> to go back or <a href="course.php">here</a> to view all the courses available.</p></div>'; + require_once 'includes/footer.php'; exit(); } $rows=mysqli_fetch_array($r); Modified: trunk/css/2col.css =================================================================== --- trunk/css/2col.css 2009-12-24 18:03:23 UTC (rev 7) +++ trunk/css/2col.css 2009-12-24 20:38:07 UTC (rev 8) @@ -19,25 +19,9 @@ #header { padding:5px 10px; background:#ddd; + text-align: center; } -#nav { - padding:5px 10px; - background:#c99; -} - -#nav ul { - margin:0; - padding:0; - list-style:none; -} - -#nav li { - display:inline; - margin:0; - padding:0; -} - #main { float:right; width:70%; Added: trunk/css/images/navbg.jpg =================================================================== (Binary files differ) Property changes on: trunk/css/images/navbg.jpg ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Modified: trunk/css/style.css =================================================================== --- trunk/css/style.css 2009-12-24 18:03:23 UTC (rev 7) +++ trunk/css/style.css 2009-12-24 20:38:07 UTC (rev 8) @@ -55,4 +55,36 @@ border-left-width: 2px; border-bottom-width: 2px; border-top-width: 2px; +} + +div#nav { + background-image:url('images/navbg.jpg'); + background-repeat:repeat-x; + height:50px; + border-bottom:1px solid #416C9C; + border-top:1px solid #325277; +} +div#nav ul { + float:left; + margin:0; + padding:0; +} +div#nav ul li { + display:block; + float:left; +} +div#nav ul li a { + float:left; + border:none; + padding:15px 15px 0 15px; + height:35px; + font-family:"Trebuchet MS", Verdana, Arial; + font-size:1.2em; + color:#cccccc; + text-decoration:none; + display:block; +} +div#nav ul li a:hover { + color:#ffffff; + background-color:#1D2F43; } \ No newline at end of file Modified: trunk/includes/header.php =================================================================== --- trunk/includes/header.php 2009-12-24 18:03:23 UTC (rev 7) +++ trunk/includes/header.php 2009-12-24 20:38:07 UTC (rev 8) @@ -14,13 +14,12 @@ <body> <div id="wrap"> <div id="header"> - <!--Some header--> + <h1>Course FeedBack System</h1> </div> <div id="nav"> - <!-- menu links + <ul> - <li><a href="addData.php">Add Data</a></li> - <li><a href="stats.php">View Statistics</a></li> - </ul> - --> - </div> \ No newline at end of file + <li><a href="index.php">Home</a></li> + <li><a href="course.php">Courses</a></li> + <li><a href="student.php">Student Page</a></li> + </ul></div> \ No newline at end of file This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <leg...@us...> - 2009-12-24 18:03:31
|
Revision: 7 http://coursefeedback.svn.sourceforge.net/coursefeedback/?rev=7&view=rev Author: legaloslotr Date: 2009-12-24 18:03:23 +0000 (Thu, 24 Dec 2009) Log Message: ----------- Created course.php. Improved 2 column css layout. Bugfix in login system. Modified Paths: -------------- trunk/css/style.css trunk/includes/footer.php trunk/includes/functions.php trunk/includes/header.php trunk/index.php trunk/loggedIn.php trunk/login/login.php trunk/login/login_box.php trunk/login/logout.php trunk/student.php Added Paths: ----------- trunk/course.php trunk/css/2col.css Added: trunk/course.php =================================================================== --- trunk/course.php (rev 0) +++ trunk/course.php 2009-12-24 18:03:23 UTC (rev 7) @@ -0,0 +1,70 @@ +<?php +$pagetitle="Course"; +require_once 'includes/header.php'; +?> +<div id="main"> +<h1>Courses @IITD</h1> + +<?php +//connect to db +require_once 'conf/conf.php'; +$dbc=mysqli_connect(dbConf::$dbHostname, dbConf::$dbUser, dbConf::$dbPasswd,dbConf::$dbName); + +if (isset($_GET['courseId'])) { //if visitor wants particular course + $q='SELECT * FROM courses WHERE courseId="'.$_GET['courseId'].'";'; + $r=mysqli_query($dbc,$q); + if ($r ==false) { + echo "<br> ".mysqli_error($dbc)."<br>"."Query: ".$q; + } + if (mysqli_num_rows($r)==0) { //courseId not found + echo '<h2 class="largeHeading">Invalid Course Id</h2>'; + echo '<p>Click <a href="javascript:window.back();">here</a> to go back or <a href="course.php">here</a> to view all the courses available.</p>'; + exit(); + } + $rows=mysqli_fetch_array($r); + //get instructor info + $q='SELECT * FROM professors WHERE profId = "'.$rows['instructorId'].'";'; + $r=mysqli_query($dbc,$q); + if ($r ==false) { + echo "<br> ".mysqli_error($dbc)."<br>"."Query: ".$q; + } + if (mysqli_num_rows($r)==0) { + //instructor not found + } + $row2=mysqli_fetch_array($r); + // print course info + echo '<table class="courseData">'; + echo '<tbody>'; + echo '<tr>'; + echo "<th>Course</th>"; + echo "<td>{$rows['courseCode']}-{$rows['courseName']}</td>"; + echo '</tr>'; + echo "<tbody>"; + echo "<tr>"; + echo "<th>Description</th>"; + echo "<td><p>{$rows['courseDesc']}</p></td>"; + echo "</tr>"; + echo "<tr>"; + echo "<th>Instructor</th>"; + echo "<td>{$row2['name']}</td>"; + echo "</tr>"; + echo "</tbody>"; + echo "</table>"; + +} +else { //display ability to choose course +} + + + echo "</div>"; +?> + +<div id="sidebar"> +<div id="login"> + <?php require_once('login/login_box.php'); ?> +</div> +</div> + +<?php +require_once 'includes/footer.php'; +?> Added: trunk/css/2col.css =================================================================== --- trunk/css/2col.css (rev 0) +++ trunk/css/2col.css 2009-12-24 18:03:23 UTC (rev 7) @@ -0,0 +1,64 @@ +/* + Document : 2col + Created on : 24 Dec, 2009, 10:22:54 PM + Author : ankur + Description: + Purpose of the stylesheet follows. +*/ + +body, html { + margin:0; + padding:0; + color:#000; +} + +#wrap { + margin:0 auto; +} + +#header { + padding:5px 10px; + background:#ddd; +} + +#nav { + padding:5px 10px; + background:#c99; +} + +#nav ul { + margin:0; + padding:0; + list-style:none; +} + +#nav li { + display:inline; + margin:0; + padding:0; +} + +#main { + float:right; + width:70%; + padding:2%; + background:#9c9; +} + +#sidebar { + float:left; + width:22%; + padding:2%; + background:#99c; +} + +#footer { + clear:both; + padding:5px 10px; + background:#cc9; +} + +/* STAR html hack for IE6 */ +* html #footer { + height:1px; +} Modified: trunk/css/style.css =================================================================== --- trunk/css/style.css 2009-12-23 09:15:52 UTC (rev 6) +++ trunk/css/style.css 2009-12-24 18:03:23 UTC (rev 7) @@ -7,12 +7,10 @@ */ /* - TODO customize this sample style Syntax recommendation http://www.w3.org/TR/REC-CSS2/ */ #login { - float:left; - + display:block; border-right-style: dotted; border-left-style: dotted; border-bottom-style: dotted; @@ -21,7 +19,6 @@ border-left-width: 2px; border-bottom-width: 2px; border-top-width: 2px; - width: 20%; padding-right: 4px; padding-left: 4px; padding-bottom: 4px; @@ -32,4 +29,30 @@ .error { color:red; text-align:center; +} + +.courseData { + + border-right-style: groove; + border-left-style: groove; + border-bottom-style: groove; + border-top-style: groove; + border-right-width: 2px; + border-left-width: 2px; + border-bottom-width: 2px; + border-top-width: 2px; + margin-right: 10px; + + margin-bottom: 10px; + margin-top: 10px; +} +.courseData td { + border-right-style: groove; + border-left-style: groove; + border-bottom-style: groove; + border-top-style: groove; + border-right-width: 2px; + border-left-width: 2px; + border-bottom-width: 2px; + border-top-width: 2px; } \ No newline at end of file Modified: trunk/includes/footer.php =================================================================== --- trunk/includes/footer.php 2009-12-23 09:15:52 UTC (rev 6) +++ trunk/includes/footer.php 2009-12-24 18:03:23 UTC (rev 7) @@ -1,5 +1,6 @@ <div id="footer"> <!--Some footer--> </div> +</div> </body> </html> \ No newline at end of file Modified: trunk/includes/functions.php =================================================================== --- trunk/includes/functions.php 2009-12-23 09:15:52 UTC (rev 6) +++ trunk/includes/functions.php 2009-12-24 18:03:23 UTC (rev 7) @@ -71,4 +71,22 @@ return $res; } } + + /** + * Cookies and sessioning for the login_box + */ + function loginBoxCheck () { + global $_COOKIE; + $loginError=false; + if ($_COOKIE['loginError']) { + $loginError=true; + setcookie('loginError',null,null,'/'); + } + else { + //start session for login box + session_start(); + } +return $loginError; + + } ?> Modified: trunk/includes/header.php =================================================================== --- trunk/includes/header.php 2009-12-23 09:15:52 UTC (rev 6) +++ trunk/includes/header.php 2009-12-24 18:03:23 UTC (rev 7) @@ -1,3 +1,7 @@ +<?php +require_once 'includes/functions.php'; +$loginError=loginBoxCheck(); +?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> @@ -3,7 +7,10 @@ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title><?php echo $pageTitle; ?></title> + + <link rel="stylesheet" type="text/css" href="css/2col.css"> <link rel="stylesheet" type="text/css" href="css/style.css"> </head> <body> + <div id="wrap"> <div id="header"> <!--Some header--> @@ -16,8 +23,4 @@ <li><a href="stats.php">View Statistics</a></li> </ul> --> - </div> -<!-- - </body> -</html> ---> \ No newline at end of file + </div> \ No newline at end of file Modified: trunk/index.php =================================================================== --- trunk/index.php 2009-12-23 09:15:52 UTC (rev 6) +++ trunk/index.php 2009-12-24 18:03:23 UTC (rev 7) @@ -1,16 +1,16 @@ <?php $pagetitle="Index"; -if ($_COOKIE['loginError']) { - $loginError=true; - setcookie('loginError'); -} require_once 'includes/header.php'; ?> +<div id="main"> <h1>Index Page</h1> +</div> + +<!--sidebar--> +<div id="sidebar"> <div id="login"> <?php require_once('login/login_box.php'); ?> </div> -<div id="content"> </div> <?php Modified: trunk/loggedIn.php =================================================================== --- trunk/loggedIn.php 2009-12-23 09:15:52 UTC (rev 6) +++ trunk/loggedIn.php 2009-12-24 18:03:23 UTC (rev 7) @@ -1,9 +1,9 @@ <?php $pagetitle="Logged IN"; +require_once 'includes/header.php'; session_start(); -require_once 'includes/header.php'; -//session_start(); ?> + <h1>LoggedIn</h1> <div id="login"> <?php require_once('login/login_box.php'); ?> Modified: trunk/login/login.php =================================================================== --- trunk/login/login.php 2009-12-23 09:15:52 UTC (rev 6) +++ trunk/login/login.php 2009-12-24 18:03:23 UTC (rev 7) @@ -17,12 +17,13 @@ $_SESSION['studentId']=$loginData['studentId']; } //successfully loggedIn. now transfer to appropriate page - header("Location: ".absUrl('../loggedIn.php')); + header("Location: ".$_SERVER['HTTP_REFERER']); exit (); } else { + //loginError setcookie('loginError','true',time()+60,"/"); - header("Location: ".absUrl('../index.php')); + header("Location: ".$_SERVER['HTTP_REFERER']); exit(); } } Modified: trunk/login/login_box.php =================================================================== --- trunk/login/login_box.php 2009-12-23 09:15:52 UTC (rev 6) +++ trunk/login/login_box.php 2009-12-24 18:03:23 UTC (rev 7) @@ -2,7 +2,7 @@ /** * Contains the login "module" that displays login form. */ - + $loggedIn=isset($_SESSION['name'])?true:false; if ($loggedIn) { Modified: trunk/login/logout.php =================================================================== --- trunk/login/logout.php 2009-12-23 09:15:52 UTC (rev 6) +++ trunk/login/logout.php 2009-12-24 18:03:23 UTC (rev 7) @@ -9,7 +9,10 @@ $_SESSION=array(); session_destroy(); setcookie('PHPSESSID','',time()-3600,'/','',0,0); - header("Location: ".absUrl('../index.php')); + header("Location: ".$_SERVER['HTTP_REFERER']); exit(); } +else { + header("Location: ".absUrl('../index.php')); +} ?> Modified: trunk/student.php =================================================================== --- trunk/student.php 2009-12-23 09:15:52 UTC (rev 6) +++ trunk/student.php 2009-12-24 18:03:23 UTC (rev 7) @@ -9,11 +9,9 @@ $pagetitle="Student - ".$_SESSION['name']; require_once 'includes/header.php'; ?> +<div id="main"> <h1>Student</h1> -<div id="login"> - <?php require_once('login/login_box.php'); ?> -</div> -<div id="content"> + <div class="info"> <table> <tr> @@ -28,6 +26,12 @@ <p class="button_link"><a href="">Edit Profile</a></p> </div> </div> + +<div id="sidebar"> + <div id="login"> + <?php require_once('login/login_box.php'); ?> +</div> +</div> <?php require_once 'includes/footer.php'; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <leg...@us...> - 2009-12-23 09:16:01
|
Revision: 6 http://coursefeedback.svn.sourceforge.net/coursefeedback/?rev=6&view=rev Author: legaloslotr Date: 2009-12-23 09:15:52 +0000 (Wed, 23 Dec 2009) Log Message: ----------- Bugfixes. Modified loginError to use cookies. student.php is just a demo file. Modified Paths: -------------- trunk/includes/header.php trunk/index.php trunk/loggedIn.php trunk/login/login.php trunk/login/login_box.php Added Paths: ----------- trunk/student.php Modified: trunk/includes/header.php =================================================================== --- trunk/includes/header.php 2009-12-21 13:44:12 UTC (rev 5) +++ trunk/includes/header.php 2009-12-23 09:15:52 UTC (rev 6) @@ -1,4 +1,3 @@ -<?php session_start(); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> Modified: trunk/index.php =================================================================== --- trunk/index.php 2009-12-21 13:44:12 UTC (rev 5) +++ trunk/index.php 2009-12-23 09:15:52 UTC (rev 6) @@ -1,5 +1,9 @@ <?php $pagetitle="Index"; +if ($_COOKIE['loginError']) { + $loginError=true; + setcookie('loginError'); +} require_once 'includes/header.php'; ?> <h1>Index Page</h1> Modified: trunk/loggedIn.php =================================================================== --- trunk/loggedIn.php 2009-12-21 13:44:12 UTC (rev 5) +++ trunk/loggedIn.php 2009-12-23 09:15:52 UTC (rev 6) @@ -1,5 +1,6 @@ <?php -$pagetitle="Logged IN\n"; +$pagetitle="Logged IN"; +session_start(); require_once 'includes/header.php'; //session_start(); ?> Modified: trunk/login/login.php =================================================================== --- trunk/login/login.php 2009-12-21 13:44:12 UTC (rev 5) +++ trunk/login/login.php 2009-12-23 09:15:52 UTC (rev 6) @@ -21,7 +21,8 @@ exit (); } else { - header("Location: ".absUrl('../index.php?loginError=1')); + setcookie('loginError','true',time()+60,"/"); + header("Location: ".absUrl('../index.php')); exit(); } } Modified: trunk/login/login_box.php =================================================================== --- trunk/login/login_box.php 2009-12-21 13:44:12 UTC (rev 5) +++ trunk/login/login_box.php 2009-12-23 09:15:52 UTC (rev 6) @@ -17,7 +17,7 @@ echo 'User Name:<input type="text" name="userName" value="" /><br>'; echo 'Password:<input type="password" name="password" value="" /><br>'; //echo 'inv:'.$invalidLogin; - if ($_GET['loginError']) { + if ($loginError) { echo '<p class="error">The username or password you entered is incorrect.</p>'; } echo '<input type="submit" value="Sign in" />'; Added: trunk/student.php =================================================================== --- trunk/student.php (rev 0) +++ trunk/student.php 2009-12-23 09:15:52 UTC (rev 6) @@ -0,0 +1,34 @@ +<?php +session_start(); +if (! isset ($_SESSION['studentId'])) { + //Invalid access of file. Redirect to index page. + echo '<h2>Please login first!</h2>'; + echo 'Click <a href="index.php">here</a> to go to main page.'; + exit; +} +$pagetitle="Student - ".$_SESSION['name']; +require_once 'includes/header.php'; +?> +<h1>Student</h1> +<div id="login"> + <?php require_once('login/login_box.php'); ?> +</div> +<div id="content"> + <div class="info"> + <table> + <tr> + <td>Name:</td> + <td><?php echo $_SESSION['name']; ?></td> + </tr> + <tr> + <td>Entry Number</td> + <td><?php echo $_SESSION['entryNumber']; ?></td> + </tr> + </table> + <p class="button_link"><a href="">Edit Profile</a></p> + </div> +</div> +<?php + +require_once 'includes/footer.php'; +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <leg...@us...> - 2009-12-21 13:44:19
|
Revision: 5 http://coursefeedback.svn.sourceforge.net/coursefeedback/?rev=5&view=rev Author: legaloslotr Date: 2009-12-21 13:44:12 +0000 (Mon, 21 Dec 2009) Log Message: ----------- Implemented login/logout functionality. Modified Paths: -------------- trunk/conf/conf.php trunk/includes/header.php trunk/index.php Added Paths: ----------- trunk/css/ trunk/css/style.css trunk/includes/functions.php trunk/loggedIn.php trunk/login/ trunk/login/login.php trunk/login/login_box.php trunk/login/logout.php Modified: trunk/conf/conf.php =================================================================== --- trunk/conf/conf.php 2009-12-19 13:01:09 UTC (rev 4) +++ trunk/conf/conf.php 2009-12-21 13:44:12 UTC (rev 5) @@ -8,7 +8,7 @@ */ class dbConf { public static $dbHostname="localhost"; -public static $dbName="ssd"; +public static $dbName="cofee"; public static $dbUser="ankur"; public static $dbPasswd="ankurd"; } Added: trunk/css/style.css =================================================================== --- trunk/css/style.css (rev 0) +++ trunk/css/style.css 2009-12-21 13:44:12 UTC (rev 5) @@ -0,0 +1,35 @@ +/* + Document : style.css + Created on : 21 Dec, 2009, 3:21:26 PM + Author : ankur + Description: + Purpose of the stylesheet follows. +*/ + +/* + TODO customize this sample style + Syntax recommendation http://www.w3.org/TR/REC-CSS2/ +*/ +#login { + float:left; + + border-right-style: dotted; + border-left-style: dotted; + border-bottom-style: dotted; + border-top-style: dotted; + border-right-width: 2px; + border-left-width: 2px; + border-bottom-width: 2px; + border-top-width: 2px; + width: 20%; + padding-right: 4px; + padding-left: 4px; + padding-bottom: 4px; + padding-top: 4px; + text-align:right; +} + +.error { + color:red; + text-align:center; +} \ No newline at end of file Added: trunk/includes/functions.php =================================================================== --- trunk/includes/functions.php (rev 0) +++ trunk/includes/functions.php 2009-12-21 13:44:12 UTC (rev 5) @@ -0,0 +1,74 @@ +<?php +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +/** + * + * @param String $date Date to be converted + * @return String + * Converts dd-mm-yyyy to yyyy-mm-dd and vice-versa. + */ + +function convDate ($date) { + $date1=explode('-', $date); + $date2=$date1[2].'-'.$date1[1].'-'.$date1[0]; + return $date2; +} + +/** + * + * @param String $page Page whose absolute address is required. + * @return String + * Converts a relative address to absolute address. + */ + +function absUrl($page="index.php") { + $url = 'http://'.$_SERVER['HTTP_HOST'].dirname($_SERVER['PHP_SELF']); + $url = rtrim($url, '/\\'); + $url .= '/' . $page; + return $url; +} + + /** + * @param String $userName Username to check + * @param String $pass Password to check + * @return String[] + * Checks the username and password against the database + * and returns the user details on success. + */ + +function checkLogin ($userName,$pass) { + require_once '../conf/conf.php'; + $dbc=mysqli_connect(dbConf::$dbHostname, dbConf::$dbUser, dbConf::$dbPasswd,dbConf::$dbName); + //check in students db + $q='SELECT * FROM students WHERE (entryNumber="'.$userName.'" AND password=sha1("'.$pass.'"));'; + //echo $q; + $r=mysqli_query($dbc,$q); + if ($r ==false) { + echo "<br> ".mysqli_error($dbc)."<br>"."Query: ".$q; + } + //echo 'rows='.mysqli_num_rows($r); + + if (mysqli_num_rows($r)==1) { + $row=mysqli_fetch_array($r); + $res['name']=$row['name']; + $res['studentId']=$row['studentId']; + return $res; + } + + //check in professors db + $q='SELECT * FROM professors WHERE userName LIKE BINARY "'.$userName.'" AND password=sha1("'.$pass.'");'; + $r=mysqli_query($dbc,$q); + if ($r ==false) { + echo "<br> ".mysqli_error($dbc)."<br>"."Query: ".$q; + } + if (mysqli_num_rows($r)==1) { + $row=mysqli_fetch_array($r); + $res['name']=$row['name']; + $res['profId']=$row['profId']; + return $res; + } + } +?> Modified: trunk/includes/header.php =================================================================== --- trunk/includes/header.php 2009-12-19 13:01:09 UTC (rev 4) +++ trunk/includes/header.php 2009-12-21 13:44:12 UTC (rev 5) @@ -1,3 +1,4 @@ +<?php session_start(); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> @@ -3,11 +4,5 @@ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title><?php echo $pageTitle; ?></title> - - <!-- Code to link a stylesheet - <link rel="stylesheet" type="text/css" href="templates/beta/styles.css"> - --> - - - + <link rel="stylesheet" type="text/css" href="css/style.css"> </head> <body> Modified: trunk/index.php =================================================================== --- trunk/index.php 2009-12-19 13:01:09 UTC (rev 4) +++ trunk/index.php 2009-12-21 13:44:12 UTC (rev 5) @@ -1,7 +1,14 @@ <?php -$pagetitle="Title"; +$pagetitle="Index"; require_once 'includes/header.php'; +?> +<h1>Index Page</h1> +<div id="login"> + <?php require_once('login/login_box.php'); ?> +</div> +<div id="content"> +</div> +<?php -//some content require_once 'includes/footer.php'; ?> Added: trunk/loggedIn.php =================================================================== --- trunk/loggedIn.php (rev 0) +++ trunk/loggedIn.php 2009-12-21 13:44:12 UTC (rev 5) @@ -0,0 +1,20 @@ +<?php +$pagetitle="Logged IN\n"; +require_once 'includes/header.php'; +//session_start(); +?> +<h1>LoggedIn</h1> +<div id="login"> + <?php require_once('login/login_box.php'); ?> +</div> +<div id="content"> + <p> + Name=<?php echo $_SESSION['name']; ?><br> + profId=<?php echo $_SESSION['profId']; ?><br> + studentId=<?php echo $_SESSION['studentId']; ?><br> + </p> +</div> +<?php +//some content +require_once 'includes/footer.php'; +?> Added: trunk/login/login.php =================================================================== --- trunk/login/login.php (rev 0) +++ trunk/login/login.php 2009-12-21 13:44:12 UTC (rev 5) @@ -0,0 +1,32 @@ +<?php +/* + * Contains code to login. + */ +require_once ('../includes/functions.php'); + +if (isset($_POST['userName'])) { + + $loginData=checkLogin($_POST['userName'],$_POST['password']); + if ($loginData) { + session_start(); + $_SESSION['name']=$loginData['name']; + if (isset($loginData['profId'])) { + $_SESSION['profId']=$loginData['profId']; + } + else if (isset($loginData['studentId'])) { + $_SESSION['studentId']=$loginData['studentId']; + } + //successfully loggedIn. now transfer to appropriate page + header("Location: ".absUrl('../loggedIn.php')); + exit (); + } + else { + header("Location: ".absUrl('../index.php?loginError=1')); + exit(); + } + } + else { + header("Location: ".absUrl('../index.php')); + exit(); + } +?> Added: trunk/login/login_box.php =================================================================== --- trunk/login/login_box.php (rev 0) +++ trunk/login/login_box.php 2009-12-21 13:44:12 UTC (rev 5) @@ -0,0 +1,26 @@ +<?php +/** + * Contains the login "module" that displays login form. + */ + + $loggedIn=isset($_SESSION['name'])?true:false; + + if ($loggedIn) { + echo "Hi, ".$_SESSION['name'].".<br>"; + echo '<form action="login/logout.php" method="post">'; + echo '<input type="submit" value="Logout" />'; + echo '<input type="hidden" name="logout" value="true" />'; + echo '</form>'; + } + else { + echo '<form action="login/login.php" method="post">'; + echo 'User Name:<input type="text" name="userName" value="" /><br>'; + echo 'Password:<input type="password" name="password" value="" /><br>'; + //echo 'inv:'.$invalidLogin; + if ($_GET['loginError']) { + echo '<p class="error">The username or password you entered is incorrect.</p>'; + } + echo '<input type="submit" value="Sign in" />'; + echo '</form>'; + } +?> \ No newline at end of file Added: trunk/login/logout.php =================================================================== --- trunk/login/logout.php (rev 0) +++ trunk/login/logout.php 2009-12-21 13:44:12 UTC (rev 5) @@ -0,0 +1,15 @@ +<?php +/* + * Contains code for logging out. + */ +require_once ('../includes/functions.php'); + +if (isset($_POST['logout'])) { + session_start(); + $_SESSION=array(); + session_destroy(); + setcookie('PHPSESSID','',time()-3600,'/','',0,0); + header("Location: ".absUrl('../index.php')); + exit(); + } +?> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |