Your IP : 216.73.216.40


Current Path : /var/www/html/venkat/project0416/
Upload File :
Current File : /var/www/html/venkat/project0416/projectstore.php

<?php

include("phome.php");

?>

<?php

$coguide = addslashes($_POST['coguide']);
$faculty = addslashes($_POST['faculty']);
if ($coguide == "#") {
	header("location:pchoose.php");
}
if ($faculty == "#") {
	header("location:pchoose.php");
}	
//echo $faculty.$coguide;
$size = addslashes($_POST['size']);
$title = htmlspecialchars(addslashes($_POST['title']));
//$coguide ="NA";
//if($depta == "ec") {

//}
$hash = $faculty.$size.$title;
for ($i = 1; $i <= $size-1; $i++) 
{

	$c[$i]='number'.$i;
	if (empty($_POST[$c[$i]])) {
		echo("<script> alert('fill all the details');window.location.href='create.php';</script>");
	}
	else {
		$c[$i] = htmlspecialchars(addslashes($_POST[$c[$i]]));
		$hash = $hash.$c[$i];
		if ($c[$i] == $r) {
			header("location:pchoose.php"); exit();
		}


	}
}
$hash = md5($hash);
$hash1 = $_SESSION['hash'];
if($hash == $hash1) {
	echo ("<center> <b> It is a refresh </b> </center>");
}
else {
	$_SESSION['hash'] = $hash;
	for ($i = 1; $i <= $size-1; $i++) 
	{
	
		$quer1=mysql_query("select degree, semester, dept, summer from projectstudent where rollno='$c[$i]'") or die("Invalid Access3 !!!");
		if($row=mysql_fetch_array( $quer1 )) {
			$s2[$i] = $row['semester'];
			$c2[$i] = $row['dept'];
			$summer = $row['summer'];
			$degree = $row['degree'];
		}



		$quer1=mysql_query("select * from projectsubmit where rollno='$c[$i]'") or die("Invalid Access1 !!!");
		if(mysql_fetch_array( $quer1 )) {
			echo " <br> <br><center> Your partner ".$c[$i]." is already registered - Please check and submit <br> </center>";
			//echo "<a href='create.php'> Go Back </a> </center>";
			exit();
		}
	
		$quer1=mysql_query("select * from projectstudent where rollno='$c[$i]'") or die("Invalid Access22 !!!");
		if(!($row = mysql_fetch_array( $quer1 ))) {
			echo " <br><center> Your partner ".$c[$i]." is not in the account - Please check and submit <br> </center>";
			//echo "<a href='create.php'>Go Back </a> </center>";
			exit();
		}
		else {
			$c1[$i]=$row['name'];
		}
	}

	$c[0]= $r;
	$c2[0]= $dept;
	$s2[0]= $sem;
	
	$quer1=mysql_query("select * from projectstudent where rollno='$c[0]'") or die("Invalid Access2 !!!");
	if($row = mysql_fetch_array( $quer1 )) {
		$c1[0]=$row['name'];
	}


	$ip=$_SERVER['REMOTE_ADDR'];
	
	$eguide = "No";
	$email = "No";
	$ptype = "No";
	
	
	if($sem == 8) {
		$eguide = htmlspecialchars(addslashes($_POST['eguide']));
		$email = htmlspecialchars(addslashes($_POST['eguide']));
		if(isset($_POST['ptype'])) {
			$ptype = addslashes($_POST['ptype']);
		}
		else {
			header("location:pchoose.php");
		}
	}	




	date_default_timezone_set('Asia/Calcutta');
	$dated = date('h:i:s', time());
	$dated1 = date('a', time());
	$dated2='06:30:00';
	$dated3='pm';
	$s = date("N");
	
	$my_t=date("Y-m-d");
	
	$pv1=rand();
	$rest = substr($faculty,3,3);
	$kk = substr($c[0],0,2);
	$id=$rest.$pv1;
	$question="yes";
	
	
	if (strlen($avail) == 6){
		$avai1 = substr($avail,4,2);
	}
	else {
		$avai1 = substr($avail,2,2);
	}	
	$quer2=mysql_query("select name,$avai1 ,id from faculty where name='$faculty'") or die("Invalid Access !!!");
	
	if($row = mysql_fetch_array($quer2)){
		$f1=$row['name'];
		$f1=$row[$avai1];
		$f2=$row['id'];
	}
	if($f1 < 1) {
		echo("<script> alert('Faculty slot over'); window.location.href='create.php';</script>");
	}
	else {
		for ($i = 0; $i <= $size-1; $i++) {
			$query ="insert into projectsubmit(rollno,degree, discipline,semester,name,projectid,guide,coguide,verified,date,time,zone,ip,facultyid,accepted,title,eguide,email,ptype,register,summer) VALUES ('$c[$i]', '$degree', '$c2[$i]', '$s2[$i]', '$c1[$i]', '$id','$faculty','$coguide', '$question','$my_t','$dated','$dated1','$ip','$f2','n','$title','$eguide','$email','$ptype','$r', '$summer')";
			mysql_query($query) or die(mysql_error());
			mysql_insert_id();
			$question="no";
		}


		$quer1=mysql_query("select * from faculty where name='$faculty'") or die("Invalid Access2 !!!");
		if($row = mysql_fetch_array( $quer1 )) {
			if($s2[1] == "5" && $kk == "ri") {
				$ri1 = $row['ri1'];
			}	
			$avail1=$row[$avai1];
		}

		if($s2[1] == "5" && $kk == "ri") {
			$ri1=$ri1 + 1;
			$query ="update faculty set ri1= '$ri1' WHERE name = '$faculty'";
			mysql_query($query) or die(mysql_error());
			mysql_insert_id();
		}	
		$avail1=$avail1 - 1;
		$query ="update faculty set $avai1= '$avail1' WHERE name = '$faculty'";
		mysql_query($query) or die(mysql_error());
		mysql_insert_id();
	}
?>



	<center>
	<br> <font color="red"> Successfully Uploaded. Please check the below and ask your partners (if any) to verify the project by logging in to the portal.</font>
	 </center>
	<br>
	
	
	<table width="800" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
	<tr>
	<form name="form1" enctype="multipart/form-data" method="post" action="pchoose.php">
	<td>
	<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
	<tr>
	<td colspan="6"><strong>Project Details</strong></td>
	</tr>

	<tr>
	<td><b>Project Id</font></td>
	<td><b>Roll No.</font></td>
	<td><b>Name</font></td>
	<td><b><center>Title </center></font></td>
	<td><b>Guide</font></td>
	<td><b>Co-Guide</font></td>
	<td><b>Date of Cre./Veri.</font></td>
	<td><b>Verified</font></td>
	</tr>
<?php

	$quer1=mysql_query("select projectid from projectsubmit where rollno='$c[0]'") or die("Invalid Access2 !!!");
	if($row = mysql_fetch_array( $quer1 )) {
		$id=$row['projectid'];
	}

	$quer1=mysql_query("select * from projectsubmit where projectid='$id'") or die("Invalid Access3 !!!");
	while($row = mysql_fetch_array( $quer1 )) {
		$id=$row['projectid'];
		$rollno=$row['rollno'];
		$name=$row['name'];
		$title=$row['title'];
		$faculty=$row['guide'];
		$coguide=$row['coguide'];
		$date=$row['date'];
		$verified=$row['verified'];
		$register=$row['register'];
	
?>
		<tr>
		<td><?php echo($id); ?></font></td>
		<td><?php if ($rollno == $register) { echo "<b>";  } echo($rollno); ?></font></td>
		<td><?php echo($name); ?></font></td>
		<td><?php echo($title); ?></font></td>
		<td><?php echo($faculty); ?></font></td>
		<td><?php echo($coguide); ?></font></td>
		<td><?php echo($date); ?></font></td>
		<td><?php echo($verified); ?></font></td>


		</tr>
<?php
	}


}
?>

	</table>
	</table>