-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathget.php
40 lines (27 loc) · 856 Bytes
/
get.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
/**
* Quzzy Online Interactive Quiz Application
* JSON Data Provider
* @package: Quizzy
* @version: 0.1
*/
//Load base configuration file
require_once ( realpath(dirname(__FILE__)) . "/resources/config.php" );
//Load functions and definations
require_once ( INCLUDES_PATH . "/functions.php");
if( isset($_REQUEST['type']) ){
$quizzy = new Quizzy();
//Handle Topic data requests
if( $_REQUEST['type'] == 'topics' and isset( $_REQUEST['cid'] ) ){
//validate category id
if( preg_match( "/^\d+$/", $_REQUEST['cid'] ) ){
if( $topic_details = $quizzy->get_topics( $_REQUEST['cid'] ) ){
$output = json_encode( $topic_details );
die($output);
}
}
}
//TODO: Handle Category data requests
if( $_REQUEST['type'] == 'categories' ){
}
}