\hypertarget{execute_8php}{}\doxysection{/opt/lampp/htdocs/sfcode/backend/execute.php File Reference}
\label{execute_8php}\index{/opt/lampp/htdocs/sfcode/backend/execute.php@{/opt/lampp/htdocs/sfcode/backend/execute.php}}
\doxysubsection*{Variables}
\begin{DoxyCompactItemize}
\item 
\mbox{\Hypertarget{execute_8php_ab1d99e9211e0764ab2dcf25497fa40e4}\label{execute_8php_ab1d99e9211e0764ab2dcf25497fa40e4}} 
{\bfseries \$post\+Data} = file\+\_\+get\+\_\+contents(\char`\"{}php\+://input\char`\"{})
\item 
\mbox{\Hypertarget{execute_8php_a227a9443cabbe5e23cfc10c4371e09d1}\label{execute_8php_a227a9443cabbe5e23cfc10c4371e09d1}} 
{\bfseries \$uname} = \$post\+Data\mbox{[}\textquotesingle{}file\textquotesingle{}\mbox{]}\mbox{[}\textquotesingle{}username\textquotesingle{}\mbox{]}
\item 
\mbox{\Hypertarget{execute_8php_a0722441477f957078ee2437054556cbc}\label{execute_8php_a0722441477f957078ee2437054556cbc}} 
{\bfseries \$filename} = \$post\+Data\mbox{[}\textquotesingle{}file\textquotesingle{}\mbox{]}\mbox{[}\textquotesingle{}filename\textquotesingle{}\mbox{]}
\item 
\mbox{\Hypertarget{execute_8php_a3f910b7833f09507df883bf8b04d3bdb}\label{execute_8php_a3f910b7833f09507df883bf8b04d3bdb}} 
{\bfseries \$f\+\_\+path} = \$post\+Data\mbox{[}\textquotesingle{}file\textquotesingle{}\mbox{]}\mbox{[}\textquotesingle{}path\textquotesingle{}\mbox{]}
\item 
\mbox{\Hypertarget{execute_8php_a83170d318260a5a2e2a79dccdd371b10}\label{execute_8php_a83170d318260a5a2e2a79dccdd371b10}} 
{\bfseries \$language} = \$post\+Data\mbox{[}\textquotesingle{}file\textquotesingle{}\mbox{]}\mbox{[}\textquotesingle{}language\textquotesingle{}\mbox{]}
\item 
\mbox{\Hypertarget{execute_8php_a6533a3606e58291459e9dfec2ad7da21}\label{execute_8php_a6533a3606e58291459e9dfec2ad7da21}} 
{\bfseries \$input\+\_\+data} = \$post\+Data\mbox{[}\textquotesingle{}input\+\_\+data\textquotesingle{}\mbox{]}
\item 
\mbox{\Hypertarget{execute_8php_a8a081d1b9ae6e0379850a3996564bb3f}\label{execute_8php_a8a081d1b9ae6e0379850a3996564bb3f}} 
{\bfseries \$ret\+\_\+stat} = 0
\item 
\mbox{\Hypertarget{execute_8php_aa3e9534005fd516d941f6a5569896e01}\label{execute_8php_aa3e9534005fd516d941f6a5569896e01}} 
{\bfseries \$template} = strval(rand(1, 1000000))
\item 
\mbox{\Hypertarget{execute_8php_a8b91f75933847c37e369bf9ffb5d4959}\label{execute_8php_a8b91f75933847c37e369bf9ffb5d4959}} 
{\bfseries \$in\+\_\+fname} = \char`\"{}../user\+\_\+execs/\char`\"{} . \$uname . \char`\"{}//temp\+\_\+sfcode\+\_\+139213617964/temp\+\_\+in\char`\"{} . \$template
\item 
\mbox{\Hypertarget{execute_8php_aa1bfbd27060176201b271918dff57e8f}\label{execute_8php_aa1bfbd27060176201b271918dff57e8f}} 
{\bfseries \$file} = fopen(\$in\+\_\+fname, \textquotesingle{}w\textquotesingle{})
\item 
\mbox{\Hypertarget{execute_8php_a4605dfe484d22f02e4ed7c9ad88262de}\label{execute_8php_a4605dfe484d22f02e4ed7c9ad88262de}} 
{\bfseries \$out\+\_\+fname} = \char`\"{}../user\+\_\+execs/\char`\"{} . \$uname . \char`\"{}//temp\+\_\+sfcode\+\_\+139213617964/temp\+\_\+out\char`\"{} . \$template
\item 
if(strcmp(\$language, \char`\"{}.cpp\char`\"{})==0) else if(strcmp(\$language, \char`\"{}.java\char`\"{})==0) else if(strcmp(\$language, \char`\"{}.py\char`\"{})==0) if(\$ret\+\_\+stat !=0) {\bfseries else}
\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
This script uses the username, name of the code file, language of the code file and the input data (test case) and executes the code, (given that it has already been compiled) using system() function, and returns the output. If the file hasn\textquotesingle{}t been compiled or a runtime error occurs, then the script raises an exception. 

\doxysubsection{Variable Documentation}
\mbox{\Hypertarget{execute_8php_a215383748692ec568ed9ac6a2155f079}\label{execute_8php_a215383748692ec568ed9ac6a2155f079}} 
\index{execute.php@{execute.php}!else@{else}}
\index{else@{else}!execute.php@{execute.php}}
\doxysubsubsection{\texorpdfstring{else}{else}}
{\footnotesize\ttfamily if (filesize( \$out\+\_\+fname)==0) else}

{\bfseries Initial value\+:}
\begin{DoxyCode}{0}
\DoxyCodeLine{\{}
\DoxyCodeLine{  \$file = fopen(\$out\_fname, \textcolor{charliteral}{'r'})}

\end{DoxyCode}
