-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAddDB.php
More file actions
82 lines (65 loc) · 2.46 KB
/
Copy pathAddDB.php
File metadata and controls
82 lines (65 loc) · 2.46 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
<?php
require 'maindb.php';
function addplayer($conn) {
$name = mysqli_escape_string($conn, $_POST['name']);
$link = mysqli_escape_string($conn, $_POST['link']);
$candidature = mysqli_escape_string($conn, $_POST['candidature']);
$entretien = mysqli_escape_string($conn, $_POST['entretien']);
$sql = "INSERT INTO rh.player (nameplayer, linkplayer, entretienplayer, candidatureplayer)
VALUES ('" . $name ."', '" . $link . "', '" . $entretien ."', '" . $candidature . "')";
if ($conn->query($sql) != TRUE) {
echo "Error: " . $sql . "<br>" . $conn->error;
} else { echo 'Success'; };
};
function addalliance($conn) {
$name = mysqli_escape_string($conn, $_POST['name']);
$link = mysqli_escape_string($conn, $_POST['link']);
$corporation = mysqli_escape_string($conn, $_POST['corporation']);
//$pdg = mysqli_escape_string($conn, $_POST['pdg']); -> add $sql pdg data
$sql = "INSERT INTO rh.alliance (namealliance, linkalliance, corpoalliance)
VALUES ('" . $name ."', '" . $link . "', '" . $corporation ."')";
if ($conn->query($sql) != TRUE) {
echo "Error: " . $sql . "<br>" . $conn->error;
} else { echo 'Success'; };
};
function addtoptab($conn) {
$where = mysqli_escape_string($conn, $_POST['where']);
$data = mysqli_escape_string($conn, $_POST['data']);
$id = mysqli_escape_string($conn, $_POST['id']);
$sql = "INSERT INTO rh.view (whereview, idelementview, dataview) VALUES ('" . $where ."', '" . $id ."', '" . $data ."')";
if ($conn->query($sql) != TRUE) {
echo "Error: " . $sql . "<br>" . $conn->error;
} else { echo 'Success'; };
};
function addtab($conn) {
$where = mysqli_escape_string($conn, $_POST['where']);
$data = mysqli_escape_string($conn, $_POST['data']);
$id = mysqli_escape_string($conn, $_POST['id']);
$toggle = 'a' . $data;
$sql = "INSERT INTO rh.view (whereview, idelementview, dataview, toggledataview) VALUES ('" . $where ."', '" . $id ."', '" . $data ."', '" . $toggle ."')";
if ($conn->query($sql) != TRUE) {
echo "Error: " . $sql . "<br>" . $conn->error;
} else { echo 'Success'; };
};
/*
function addtable($conn) {
};
*/
if ($_POST['type'] === "joueur") {
addplayer($conn);
};
if ($_POST['type'] === "alliance") {
addalliance($conn);
};
if ($_POST['type'] === "TopTab") {
addtoptab($conn);
};
if ($_POST['type'] === "Tab") {
addtab($conn);
};
/*
if ($_POST['type'] === "table") {
addtable($conn);
};
*/
?>