-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_character.php
111 lines (82 loc) · 3.87 KB
/
create_character.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
require_once 'head.php';
require_once 'database.php';
$con=mysqli_connect($db_host, $db_username, $db_password,$db_name);
if (mysqli_connect_errno()){
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
mysqli_query($con, "SET SESSION sql_mode = ''");
$name = $_POST['name'];
$sexe = $_POST['CharacterInfoSex'];
$survivol = $_POST['SurvivalPts'];
$movement = $_POST['movement'];
$accuracy = $_POST['accuracy'];
$strength = $_POST['strength'];
$evasion = $_POST['evasion'];
$luck = $_POST['luck'];
$speed = $_POST['speed'];
$fighting_art_1 = $_POST['fighting_art_1'];
$fighting_art_2 = $_POST['fighting_art_2'];
$fighting_art_3 = $_POST['fighting_art_3'];
$disorder_1 = $_POST['disorder_1'];
$disorder_2 = $_POST['disorder_2'];
$disorder_3 = $_POST['disorder_3'];
$other = $_POST['other'];
$db_name = "INSERT INTO `survivors`(`NAME_SURVIVORS`) VALUES ('".$name."')";
if (!mysqli_query($con, $db_name)) {
echo "Error: " . $db_name . "<br>" . mysqli_error($con);
}
$id_survivor = $con->insert_id;
$db_sexe = "INSERT INTO `sexe`(`ID_SURVIVOR`,`SEXE`) VALUES ('".$id_survivor."', '".$sexe."')";
if (!mysqli_query($con, $db_sexe)) {
echo "Error: " . $db_sexe . "<br>" . mysqli_error($con);
}
$db_survivol = "INSERT INTO `survivol`(`ID_SURVIVOR`,`SURVIVOL`) VALUES ('".$id_survivor."', '".$survivol."')";
if (!mysqli_query($con, $db_survivol)) {
echo "Error: " . $db_survivol . "<br>" . mysqli_error($con);
}
$db_primary = "INSERT INTO `primary_stat`(`ID_SURVIVOR`,`MOVEMENT`,`ACCURACY`,`STRENGTH`,`EVASION`,`LUCK`,`SPEED`) VALUES ('".$id_survivor."', '".$movement."', '".$accuracy."', '".$strength."', '".$evasion."', '".$luck."', '".$speed."')";
if (!mysqli_query($con, $db_primary)) {
echo "Error: " . $db_primary . "<br>" . mysqli_error($con);
}
for ($i = 1; $i <= 3; $i++) {
$db_fight = "INSERT INTO `fighting_disroder`(`ID_SURVIVOR`,`TYPE`,`ID_ACTION`,`POSITION`) VALUES ('".$id_survivor."', 'fighting', '".${'fighting_art_'.$i}."', '".$i."')";
if (!mysqli_query($con, $db_fight)) {
echo "Error: " . $db_fight . "<br>" . mysqli_error($con);
}
}
for ($i = 1; $i <= 3; $i++) {
$db_deso = "INSERT INTO `fighting_disroder`(`ID_SURVIVOR`,`TYPE`,`ID_ACTION`,`POSITION`) VALUES ('".$id_survivor."', 'disorder', '".${'disorder_'.$i}."', '".$i."')";
if (!mysqli_query($con, $db_deso)) {
echo "Error: " . $db_deso . "<br>" . mysqli_error($con);
}
}
$db_other = "INSERT INTO `other`(`ID_SURVIVOR`,`OTHER`) VALUES ('".$id_survivor."', '".$other."')";
if (!mysqli_query($con, $db_other)) {
echo "Error: " . $db_other . "<br>" . mysqli_error($con);
}
$db_armor = "INSERT INTO `armor_stat`(`ID_SURVIVOR`,`HEAD`,`ARMS`,`BODY`,`WAIST`,`LEGS`) VALUES ('".$id_survivor."', '0','0','0','0','0')";
if (!mysqli_query($con, $db_armor)) {
echo "Error: " . $db_armor . "<br>" . mysqli_error($con);
}
$hunt_xp = "INSERT INTO `hunt_xp`(`ID_SURVIVOR`,`XP`) VALUES ('".$id_survivor."','0')";
if (!mysqli_query($con, $hunt_xp)) {
echo "Error: " . $hunt_xp . "<br>" . mysqli_error($con);
}
$w_proficiency = "INSERT INTO `w_proficiency`(`ID_SURVIVOR`,`PROFICIENCY`) VALUES ('".$id_survivor."','0')";
if (!mysqli_query($con, $w_proficiency)) {
echo "Error: " . $w_proficiency . "<br>" . mysqli_error($con);
}
$courage = "INSERT INTO `courage`(`ID_SURVIVOR`,`COURAGE`) VALUES ('".$id_survivor."','0')";
if (!mysqli_query($con, $courage)) {
echo "Error: " . $courage . "<br>" . mysqli_error($con);
}
$understanding = "INSERT INTO `understanding`(`ID_SURVIVOR`,`Understanding`) VALUES ('".$id_survivor."','0')";
if (!mysqli_query($con, $understanding)) {
echo "Error: " . $understanding . "<br>" . mysqli_error($con);
}
$insanity = "INSERT INTO `insanity`(`ID_SURVIVOR`,`INSANITY`) VALUES ('".$id_survivor."','0')";
if (!mysqli_query($con, $insanity)) {
echo "Error: " . $insanity . "<br>" . mysqli_error($con);
}
?>