include "../includes/compiler-gcc-mingw.php"; $docompile = intval($_REQUEST['docompile']); if ($docompile) { //compile setUpDirectory(); compile(); if (IsError()) { // cleanUp(); } else { $output = showOutput(); getExecutable(); cleanUp(); $out = downloadExecutable(); outputfile("output.exe", $out); exit; } } $defaultSource = "\r\n#include<stdio.h>\r\nint main()\r\n{\r\n\tprintf(\"Hello world!!!\");\r\n\treturn 0;\r\n}"; ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Online C++ Compiler v1.0</title> <link href="stylesheet/design.css" rel="stylesheet" type="text/css" /> </head> <body> <h1>Online Compiler</h1> <p>Online compiler using Mingw compiler Designed BY, HABIB RAHMAN</p>
} else { return $id == $_SESSION['id']; } } } function outputfile($content, $filename) { header("Content-Type: application/force-download"); header("Content-Type: text/plain"); header("Content-Type: application/download"); header("Content-Disposition: attachment; filename=" . $filename . ";"); echo $content; } $fileid = $_GET['id']; $pid = $_GET['pid']; $num = $_GET['num']; checkauthen(); connect_db(); if (checkpermission($fileid)) { $res = mysql_query("SELECT * FROM submission WHERE user_id=\"{$fileid}\" " . "AND prob_id=\"{$pid}\" AND sub_num={$num}"); if (mysql_num_rows($res) != 1) { echo "No such file"; } else { outputfile(mysql_result($res, 0, 'code'), $fileid . "-" . $pid . ".cpp"); } } else { echo "No permission!<br>"; echo "This event has been logged:<br>"; echo "<dd><tt> user " . $_SESSION['id'] . " is trying to access " . $fileid . "-" . $pid . "</tt>"; } close_db();