Your IP : 216.73.216.40


Current Path : /var/www/html/venkat/check/old/
Upload File :
Current File : /var/www/html/venkat/check/old/similar.php

<?php
?>
<html>
	<body bgcolor="#F0F8FF"> <center>
	<h2> <font color="blue"> Program Similarity check Portal</font> </h2>
	<form enctype="multipart/form-data" name="r" action="similar.php" method="post">
	<table width="35%" height="15%" cellspacing="1" cellpadding="1" border="1">
	<tr>
		<td>
		Choose the section You belongs to
		</td>
		<td>&nbsp; &nbsp; &nbsp;
			<select name="section">
  				<option value="sec_a">Section: A</option>
  				<option value="sec_b">Section: B</option>
  				<option value="sec_c">Section: C</option>
  				<option value="rgiit">Section: RGIIT</option>
			</select>
		</td>
	</tr>
	</tr>
	<tr>
		<td> 
			<input type="submit" value="Submit">
		</td>
		<td>
			&nbsp;
		</td>
	</tr>
	</table>
	</center> </body>
</html>
<?php
if ($_POST["section"])
{
	$section = $_POST["section"];
	$section1 = $section."dec.txt"; 
	$result = shell_exec("sort -f $section1");
	$result = explode("\n", $result);
	$comp = shell_exec("sort -f $section1");
	$comp = explode("\n", $comp);
	$sectionU = strtoupper($section);
	$i = 0;
	$uploaddir = "file/".$section."/";
	while($result[$i])
	{
		$result1 =explode('|', $result[$i]);
		$k=0;
		$uploadfile2 = $uploaddir.$result1[0];
		$cc =  htmlspecialchars(shell_exec("cat $uploadfile2"));
		$cc = trim(preg_replace('/\s+/','', $cc));
		$percent = round($percent);
		$myFile=$section."copy.txt";
		$fh = fopen($myFile, 'a');
		$percent1 = 0;
		//$stringData = $result1[0] ;//new line
		while ($comp[$k])
		{
			$comp1 =explode('|', $comp[$k]);
			$uploadfile12 = $uploaddir.$comp1[0];
			$cc1= htmlspecialchars(shell_exec("cat $uploadfile12"));
			$cc1 = trim(preg_replace('/\s+/','', $cc1));
			similar_text($cc, $cc1, $percent);
			$percent = round($percent);
			if($percent >= 95 && $percent > $percent1 && $comp1[0] != $result1[0])
			{
				$percent1 = $percent;
				$stringData = $result1[0]. " | ".$comp1[0]. " |  " . $percent."\n" ;
			}
			$k++;
		}
		if ($percent1 >= 95)
		{

		//	$stringData = $stringData."\n" ;
		//	fwrite($fh, $stringData);
			fwrite($fh, $stringData);
		}

		}
		$i++;
	}	
}

?>