Your IP : 216.73.216.40


Current Path : /var/www/html/mmishra/iws8/html/indem/
Upload File :
Current File : /var/www/html/mmishra/iws8/html/indem/iclab.inc

<h2>IC Lab - Regarding</h2>
Dear Student
<br><br>
Please furnish following details for better conduct of the IC Lab.<br>
<br>
Thanks,
<br><br>
<?php

$sections = array('A','B','C','R');
if (!$uid) {
	echo "Please <a href='?pg=login'>login</a> first";
} else if (!stripos($uid, '2011')) {
	echo "<h1>Sorry! not for you</h1>";
} else {
	$tbl = "iclab";

	//define section
	$rollno = $uid;

	$section = $_REQUEST["section"];
	if (stripos($rollno,'ri')) $section = 'R';
	$comment = $_REQUEST["comment"];
	$remoteip = $_SERVER["REMOTE_ADDR"];

	if ($_POST["submit"] == 'SUBMIT') {
        	if (mysql_num_rows(mysql_query("select * from $tbl where rollno='$rollno'"))) {
			echo "<h3 style='color:red;'>You have already submitted your desire as below.</h3>";
			$rs = mysql_query("select * from $tbl where rollno='$rollno'");
			while ($o = mysql_fetch_object($rs)) {
				echo "Section: ".strtoupper($o->section)."<dir style='margin-left: 50px; border: 1px'>$o->comment</dir>";
			}
			echo "<br><br>Do you want to overwrite ? 
			<a href='?pg=iclab&action=update&section=$section&comment=$comment'>Yes</a>
			<!--<a href='javascript: submitform()'>Yes</a>-->
			<a href='?pg=iclab'>No</a><br>";
		} else {
			mysql_query("insert into $tbl(rollno,section,comment,remoteip,dated) 
			values('$rollno','$section','$comment','$remoteip',now())"); 
			echo ("insert into $tbl(rollno,section,comment,remoteip,dated) 
			values('$rollno','$section','$comment','$remoteip',now())"); 
		}
	} else if ($action == "update") {
        	mysql_query("update $tbl set section='$section', comment='$comment',
		remoteip='$remoteip' where rollno='$rollno'");
	} else if ($action == "del") {
        	mysql_query("delete from $tbl where rollno='$rollno'");
	}

	$rs = mysql_query("select count(*) as no from $tbl");
	while ($o = mysql_fetch_object($rs)) {
		$no = $o->no;
	}
	$rs = mysql_query("select * from $tbl where rollno='$rollno'");
	while ($o = mysql_fetch_object($rs)) {
		$section = $o->section;
		$comment = $o->comment;
	}
	//echo "<div align='right'> <font color=red>Total submissions: $no </font></div> 
	echo "<table width='98%' border='1' align='center'>
	<tr><td>RollNo</td><td>$rollno</td></tr>
	<tr><td>Section</td><td nowrap><select name='section' style='width: 180'>";
	foreach ($sections as $sec) {
		echo "<option value='$sec'";
		if ($section == $sec) echo " selected";
		echo ">$sec</option>";
	}
	echo "</select> (R for RGIIT students)</td></tr>
	<tr valign='top'><td>Topics that you want to learn/experiment in the IC Lab</td>
	<td><textarea name='comment' rows='5' cols='20'>$comment</textarea></td></tr>
	<tr><td>$remoteip</td><td><input type='submit' name='submit' value='SUBMIT'></td></tr>
	</table>";

}
?>