Commit c032871f authored by Gudipaty Aniket's avatar Gudipaty Aniket

Added comments in php scripts for documentation

parent 08f56200
<?php
/*!
This script compiles a given code file (except python code files) for a user using the compiler correponding to the language
of the code file, using system() function.
*/
header("Access-Control-Allow-Origin: *");
header('Access-Control-Allow-Credentials: true');
header("Access-Control-Allow-Methods: PUT, GET, POST, DELETE");
......
<?php
/*!
This is the default script to connect with the MySQL server in the backend. The login and registration php scripts use this.
*/
header("Access-Control-Allow-Origin: *");
header('Access-Control-Allow-Credentials: true');
header("Access-Control-Allow-Methods: PUT, GET, POST, DELETE, OPTIONS");
......
<?php
/*!
This script returns the directory tree of a user's workspace, given the username. It returns a nested array in JSON form, after
using a recursive function called dirToArray()
*/
header("Access-Control-Allow-Origin: *");
header('Access-Control-Allow-Credentials: true');
......
<?php
/*!
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't been compiled or a runtime error occurs, then
the script raises an exception
*/
header("Access-Control-Allow-Origin: *");
header('Access-Control-Allow-Credentials: true');
header("Access-Control-Allow-Methods: PUT, GET, POST, DELETE");
......
<?php
/*!
This script deletes a given code file, or a directory in the user's workspace, given its path.
*/
include_once("database.php");
$postData = file_get_contents("php://input");
......
<?php
/*!
This script saves a given code file for a user, given it's path.
*/
include_once("database.php");
$postData = file_get_contents("php://input");
......
<?php
/*!
This script uses the username and file path in the user's workspace to return the contents in the requested file (code file).
If the file path is not found on the server, a 404 HTTP error is raised.
*/
header("Access-Control-Allow-Origin: *");
header('Access-Control-Allow-Credentials: true');
header("Access-Control-Allow-Methods: PUT, GET, POST, DELETE");
......
<?php
/*!
This script returns the code files present in a user's workspace, but doesn't account for directories and sub-directories.
This script is obselete because of the script dir_tree.php, which returns the directory tree of the user's workspace.
*/
header("Access-Control-Allow-Origin: *");
header('Access-Control-Allow-Credentials: true');
header("Access-Control-Allow-Methods: PUT, GET, POST, DELETE");
......
<?php
/*!
This script is for user login using username and password. Here, we authenticate user credentials with MySQL server.
*/
include_once("database.php");
$postData = file_get_contents("php://input");
$request = json_decode($postData);
......
<?php
/*!
This script checks the questions present in the MySQL database, and sends the question info (title, problem statement,
start and end time, and the author's username) to the frontend.
*/
header("Access-Control-Allow-Origin: *");
header('Access-Control-Allow-Credentials: true');
header("Access-Control-Allow-Methods: PUT, GET, POST, DELETE, OPTIONS");
......
<?php
/*!
This script saves a question in the MySQL database after a user creates it. It uses parameters like, author's username,
problem statement, testcases, start and end time, etc.
*/
header("Access-Control-Allow-Origin: *");
header('Access-Control-Allow-Credentials: true');
header("Access-Control-Allow-Methods: PUT, GET, POST, DELETE, OPTIONS");
......
<?php
/*!
This script registers a user using a username, password, name, and email. This script communicates with the MySQL server to save
user data.
*/
include_once("database.php");
$postData = file_get_contents("php://input");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment