Your IP : 10.1.73.149


Current Path : /home/bolconlineco/public_html/admin/
Upload File :
Current File : /home/bolconlineco/public_html/admin/topicasscode.php

<?php
ob_start();
include('../includes/connection/func.inc.php');  
  
	
	
		
	  $assignname = sql_strip($_POST['assigname']);
	  
	  $catId =  sql_strip($_POST['catId']);
	  $courseId = sql_strip($_POST['courseId']);
	  $topicId = sql_strip($_POST['topicId']);
	  
	  $query="select * from topicassignment where topicId='$topicId' and courseId='$courseId'";
	  
	  $result=mysql_query($query) or die(mysql_error());
	  
	  if(mysql_num_rows($result) >= 1)
	   {
		   $msg="You are not allowed to add more than one assignments";
		  header("location:topicass.php?catId=$catId&courseId=$courseId&topicId=$topicId&msg=$msg");   
	   }
	   else
	   {
	  
	  $name = $_FILES['assigment']['name'];
	  
	  $temp_name = $_FILES['assigment']['tmp_name'];
	  
	  $allowed=array('doc','docx','pdf');
	  
	  $type=explode('.',$name);
	  
	  $dir="../Assignment/";
	  $rand=mt_rand();
	  $fullname=$rand.$name;

       if(in_array($type[1],$allowed))
	   
	     {
			if(move_uploaded_file($temp_name,$dir.$fullname))
			
			  {
				  
				$sql="INSERT INTO topicassignment values('','$topicId','$courseId','$assignname','$fullname')";  
				 $result=mysql_query($sql) or die(mysql_error());
				 $msg="Assignment inserted Successfully";
				 header("location:topicass.php?catId=$catId&courseId=$courseId&topicId=$topicId&msg=$msg");
				 exit();
			  }
			
	
	  
	  
	 	
	     }else
		 {       $msg="Enter Correct pdf file";
			     header("location:topicass.php?catId=$catId&courseId=$courseId&topicId=$topicId&er=$msg");
				 exit();
			 
		 }
	   }
	  
?>