Initial commit
This commit is contained in:
parent
bdecb95b7d
commit
39ff574037
19 changed files with 851 additions and 0 deletions
5
res/php/ajax_get_arg.php
Normal file
5
res/php/ajax_get_arg.php
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
echo "<b>Some arg:</b>";
|
||||
echo "<br>";
|
||||
echo $_GET['arg'];
|
||||
?>
|
11
res/php/closedb.php
Normal file
11
res/php/closedb.php
Normal file
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
if (isset($conn)) {
|
||||
mysqli_close($conn);
|
||||
}
|
19
res/php/get_course.php
Normal file
19
res/php/get_course.php
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
if (!isset($_GET['id'])) {
|
||||
echo "No id given!";
|
||||
return;
|
||||
}
|
||||
$id = $_GET['id'];
|
||||
include './config.php';
|
||||
$conn = new mysqli($dbhost, $dbuser, $dbpassword, $dbname);
|
||||
if ($conn->error) {
|
||||
die("Failed to connect to the database: " . $conn->error);
|
||||
}
|
||||
$sql = "SELECT * FROM Titama WHERE id=$id";
|
||||
$res = $conn->query($sql);
|
||||
if ($res->num_rows > 0) {
|
||||
$course = $res->fetch_assoc();
|
||||
echo json_encode($course);
|
||||
}
|
||||
include './closedb.php';
|
||||
?>
|
21
res/php/id_exists.php
Normal file
21
res/php/id_exists.php
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
if (!isset($_GET['id'])) {
|
||||
echo "No id given!";
|
||||
return;
|
||||
}
|
||||
$id = $_GET['id'];
|
||||
include './config.php';
|
||||
$conn = new mysqli($dbhost, $dbuser, $dbpassword, $dbname);
|
||||
if ($conn->error) {
|
||||
die("Failed to connect to the database: " . $conn->error);
|
||||
}
|
||||
$sql = "SELECT * FROM Titama WHERE id=$id";
|
||||
$res = $conn->query($sql);
|
||||
$course = $res->fetch_assoc();
|
||||
if(isset($course)){
|
||||
echo json_encode(true);
|
||||
} else {
|
||||
echo json_encode(false);
|
||||
}
|
||||
include './closedb.php';
|
||||
?>
|
Reference in a new issue