-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
66 lines (54 loc) · 1.93 KB
/
index.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
<?php
require_once 'Libraries/Movies.php';
require_once 'Libraries/PublishMovie.php';
require_once 'Libraries/MovieList.php';
require_once 'Libraries/Comments.php';
require_once 'Libraries/Users.php';
header('Content-Type: application/json');
date_default_timezone_set('Europe/Istanbul');
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Headers: *");
if(isset($_GET["t"]))
{
$movie = new Movies();
$search = array('Ç','ç','Ğ','ğ','ı','İ','Ö','ö','Ş','ş','Ü','ü',' ');
$replace = array('c','c','g','g','i','i','o','o','s','s','u','u','%20');
$new_text = str_replace($search,$replace,$_GET["t"]);
echo $movie->getMovie($new_text);
}
if(isset($_GET["userId"]) && isset($_GET["publishMovie"])){
$userId = $_GET["userId"];
$imdbId = $_GET["publishMovie"];
$publish = new PublishMovie();
echo $publish->Publish($userId,$imdbId);
}
if(isset($_GET["home"])){
$movieList = new MovieList();
echo $movieList->MovieList();
}
if(isset($_GET["comments"])){
$commentList = new Comments();
echo $commentList->getComments($_GET["comments"]);
}
if(isset($_GET["getUsername"])){
$user = new Users();
echo $user->getUsername($_GET["getUsername"]);
}
if(isset($_POST["movieID"]) && isset($_POST["userId"]) && isset($_POST["comment"])){
$createComment = new Comments();
echo $createComment->setComments($_POST["movieID"],$_POST["userId"],$_POST["comment"]);
}
if (isset($_POST["username"]) && isset($_POST["password"]) && isset($_POST["login"])) {
$user = new Users();
echo $user->getUserCount($_POST["username"], $_POST["password"]);
}
if (isset($_POST["username"]) && isset($_POST["password"]) && isset($_POST["register"])) {
$user = new Users();
echo $user->SetUser($_POST["username"], $_POST["password"]);
}
if (isset($_POST["userId"]) && isset($_POST["password"]) && isset($_POST["edit"])) {
$user = new Users();
echo $user->EditUser($_POST["userId"], $_POST["password"]);
}
//var_dump($_POST);
?>