Your IP : 216.73.216.40


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

<?php
$section1 = $_GET["section"];

ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(-1);

$section = strstr($section1, ':', true);
$type1 = substr($section1, strrpos($section1, '.')+1);
$file1 = substr($section1, strrpos($section1, ':')+1);
$no = substr($section1, strrpos($section1, '_')+1);
$no = strstr($no,'.', true);
$uploaddir = "file/".$section."/";
$uploadfile2 = $uploaddir.$file1;
$upload= strstr($uploadfile2, '.', true);
$section12=$section.$no;
if ($type1 == "cpp") {
	$w = shell_exec("g++ $uploadfile2 -o $upload.out");
}
if ($type1 == "c") {
	$w = shell_exec("gcc $uploadfile2 -o $upload.out");
}
if ($type1 == "py") {
	$w = shell_exec("timeout 0.1s python $uploadfile2 <file/$section12.txt");
}
if ($type1 == "plx") {
	$w = shell_exec("timeout 0.1s perl $uploadfile2");
}
if ($type1!= "py" && $type1!= "plx") {
	$v = shell_exec("timeout 0.1s ./$upload.out < file/$section12.txt");
}
else if ($type1 == "py" || $type1 == "plx"){
	$v = $w;
}
//$handle = fopen($uploadfile2,"rb");
//$contents = fread($handle, filesize($uploadfile2));
//fclose($handle);
//echo $contents;
//echo "<br><pre>".htmlspecialchars(shell_exec("cat $uploadfile2"))."<pre>";
$sectionout = $section."out".$no;
$machineoutput = shell_exec("cat file/$sectionout.txt");
?>
<body bgcolor="#F0F8FF"> <center>
<h2> <font color="blue"> Program Check Window</font> </h2>
<br> <center>
<table width="100%" border="1" cellpadding="0">
	<tr>
		<td colspan="2"> <center> <h3> <?php echo("Program Name :  ".$file1); ?> </h3> </center> </td> 
	</tr>
	<tr>
		<td colspan="2"> <?php echo ("<pre>".htmlspecialchars(shell_exec("cat $uploadfile2"))."</pre>"); ?> </td> 
	</tr>
	<tr> 
		<td width = "50%">  <?php echo("<b> <center> <u> User O/P  </u> </center> </b> <br> <pre>".$v."</pre>"); ?> </td>
		<td width = "50%">  <?php echo("<b> <center> <u> Pre-Defined O/P </u> </center> </b> <br> <pre>".$machineoutput."</pre>"); ?> </td>
		</tr> 			
</table> </center>
<?php	
shell_exec("rm $upload.out");
?>