예제 #1
0
 function CallAs($user, $command, $parameters = array())
 {
     if ($user == FALSE) {
         $cmd = array($this->user, $this->pass);
     } else {
         $cmd = array($user, $this->user . ':' . $this->pass);
     }
     array_push($cmd, $command);
     array_push($cmd, $parameters);
     fputs($this->socket, itype_fromphp($cmd) . "\n");
     $line = fgets($this->socket, 128000);
     if ($line === false) {
         //die('Transport layer error occured in the RPC system: fgets() failed.');
         $result = 'Transport layer error occured in the RPC system: fgets() failed.';
     }
     $line = str_replace(array("\r", "\n"), array("", ""), $line);
     $parsedResponse = itype_parse($line);
     if ($parsedResponse[0] == 'empty') {
         //die('IType parsing error occured in RPC system when parsing the string "' . $line . '"');
         $response = $line;
     }
     $response = itype_flat($parsedResponse);
     if (IsError($response)) {
         $code = GetCode($response);
         if ($code != 'RPC_ERROR') {
             //die('Runtime error occured in the RPC system: [' . $code . '] ' . GetResult($response));
             $response = $code;
         }
     }
     return $response;
 }
예제 #2
0
    }
}
$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>

<?php 
if (IsError()) {
    $error = getError();
    echo '<p><b>Compilation Error! Check your source code</b></p>';
    echo '<p>' . $error . '</p>';
}
?>
<form name="compile" method="post">
<input type="hidden" name="docompile" value="1" />
<p><b>Source Code:</b></p>
<textarea name="source" rows="20" cols="80"><?php 
if ($docompile) {
    echo stripslashes($_REQUEST['source']);
} else {
    echo $defaultSource;
}
?>