forked from JaiTrieTree/AWS-Project
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.php
More file actions
25 lines (23 loc) · 955 Bytes
/
action.php
File metadata and controls
25 lines (23 loc) · 955 Bytes
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
<?php
include('./db.php');
if($_POST && $_POST['action']=='contest'){
/* Ensure that the EMPLOYEES table exists. */
verifyContestTable();
/* If input fields are populated, add a row to the EMPLOYEES table. */
$data = array();
$data['name'] = htmlentities($_POST['name']);
$data['email'] = htmlentities($_POST['email']);
$data['recipe_name'] = htmlentities($_POST['recipe_name']);
$data['ingredients'] = htmlentities($_POST['ingredients']);
$data['method'] = htmlentities($_POST['method']);
$data['region'] = htmlentities($_POST['region']);
if($data['name']===''||$data['email']===''||$data['recipe_name']===''||$data['ingredients']===''||$data['method']===''||$data['region']==='' ){
echo json_encode(array('message'=>'Please fill all fields','status'=>'error'));
die();
}
addContest($data);
}
if($_GET['action']=='contest'){
$contest = getContest();
echo json_encode($contest);
}