Your IP : 10.1.73.149


Current Path : /home/bolconlineco/public_html/aaaaaa/demo/tutor/
Upload File :
Current File : /home/bolconlineco/public_html/aaaaaa/demo/tutor/uploadassignment.php

<?php 
  ob_start();
  session_start();
  ?>
<?php include('header.php'); ?>
<?php
if(!isset($_SESSION['tutor']) || $_SESSION['tutorrole'] != 3)
 {
	header("location:../index.php");
	exit(); 
 }

 
?>
          
             <div id="content">
             	<span class="left"> </span><h2> Tutor Site Panel </h2><span class="right"></span>
                <?php
				  if(isset($_GET['id']) && isset($_GET['rollno']))
				   {
					   $id=$_GET['id'];
					   $rollno=$_GET['rollno'];
				   }
				?>
                
                <?php
				  if(isset($_GET['er']))
				   {
					 echo "Select a Valid type of file";  
				   }
				
				?>
	<div id="frm">
  
		<form id="ID"  action="" method="post" enctype="multipart/form-data">
          
           	<ul class="col"	>
							
                            
							
                          
							<li>
								<label for="ph"> Upload:</label>
                                <input class="validate[required]" type="file" name="upload" />
								
								
							</li>
							 
					
					  
							<li>
								<div id="btn">
									<input class="clear" type="reset" value="Clear" />
                                    <input type="hidden" name="courseId" value="" />
									<input type="hidden" name="access" value="<?php echo $_GET['acces'] ?>" />
									<input class="add" type="submit" name="add-upload" value="Add" />
								</div>						
							</li>
						</ul>
        
        </form>
					
</div>
<?php
  if(isset($_POST['add-upload']))
   {
	  
	   
	    
	  $name = $_FILES['upload']['name'];
	  
	  $temp_name = $_FILES['upload']['tmp_name'];
	  
	  $allowed=array('doc','pdf');
	  
	  $type=explode('.',$name);
	  
	  $dir="../studentresult/";
       $rand=mt_rand();
	   $fullname=$rand.$name;

       if(in_array($type[1],$allowed))
	   
	     {
			if(move_uploaded_file($temp_name,$dir.$fullname))
			
			  {
			 
				  if(isset($_POST['access']))
					 {
					  $query="update studentassignment set AssignmentStatus=12 where SAid='$id' and rollno='$rollno'";
					 }
					 else
					 {
					  $query="update studentassignment set AssignmentStatus=3 where SAid='$id' and rollno='$rollno'";
					 } 
					     $result=mysql_query($query) or die(mysql_error());
						
						$query2="SELECT AssignmentName from studentassignment where SAid='$id' and rollno='$rollno'";
						
						$reuslt2=mysql_query($query2) or die(mysql_error());
	   
                        $aN=mysql_fetch_array($reuslt2);
						
						$aname=$aN['AssignmentName'];
						
						
						$query3="insert into studenresult values ('','$aname','$rollno','$fullname')";
						
					    $result=mysql_query($query3) or die(mysql_error());
						
						$sql="update uploadassignment set uploadStatus=0 where assignmentId='$id' and rollno='$rollno'";
	   
	                    $result=mysql_query($sql) or die(mysql_error());
						
						     $maintainLogs = "INSERT INTO `tbl_audit`(  `user_id`, `user_name`, `role`, `action`, `date`) VALUES ( '".$ttid."','".$full."','".$_SESSION['tutorrole']."',' Uploaded the Feedback Form to roll number ".$rollno."','".date('Y-m-d H:i:s')."')";
			  mysql_query($maintainLogs);
	   
						header("location:studentInfo.php?Id=$rollno#ui-tabs-3");
						 
						exit();
 
				
			  }
			
		 }else
		 {
			 header("location:uploadassignment.php?id=$id&rollno=$rollno&er");
						 
			 exit();
		 }
	   
	   
	   
   }
?>
                      
                <div id="data">
																	
				</div><!-- end data -->
                                                   
           </div> <!-- end content  -->
          
        </div><!-- end wrapper -->   


  <?php include('../includes/footer.php');?>