forked from allanlealluz/Shadow_OF_Condor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
create.php
78 lines (76 loc) · 3.13 KB
/
create.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sombra do Condor</title>
<link rel="shortcut icon" href="sombra_condor.png">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
</head>
<body class="bg-dark">
<div class="container">
<h1 style="text-align:center;color:red;padding-bottom:1rem;">Sombra do Condor</h1>
<a href="index.php"><h3 style="text-align:left;color:red;">Home</h3></a>
<a href="indexChat.php"><h3 style="text-align:left;color:red;">Chat</h3></a>
</div>
<div class="container bg-light ">
<form method="post" enctype="multipart/form-data">
<div class="container-fluid">
<label class="form-label">Nome:</label>
<input class="form-control" type="text" name="nome" required>
<label class="form-label">Vitalidade:</label>
<input class="form-control" type="number" name="vitalidade" required>
<label class="form-label">Força:</label>
<input class="form-control"type="number" name="forca" required>
<label class="form-label">Agilidade:</label>
<input class="form-control" type="number" name="agi" required>
<label class="form-label">Inteligência:</label>
<input class="form-control"type="number" name="int" required>
<label class="form-label" >Presença:</label>
<input class="form-control" type="number" name="pre" required>
<label class="form-label">Vigor:</label>
<input class="form-control" type="number" name="vigor" required>
<label class="form-label">Itens:</label>
<input class="form-control"type="text" name="itens" required>
<label class="form-label">Perícia:</label>
<input class="form-control"type="text" name="pericia" required>
<label class="form-label">Defesa:</label>
<input class="form-control" type="number" name="defesa" required>
<label>Imagem:</label>
<input class="form-control form-control-lg" type="file" name="img" id="img">
<input type="submit" name="submit" value="Adicionar">
<div>
</form>
<?php
require_once 'DB/connect.php';
$con = new conect();
if (isset($_POST['nome'])) {
$name = $_POST['nome'];
$health = $_POST['vitalidade'];
$strength = $_POST['forca'];
$dexterity = $_POST['agi'];
$intelligence = $_POST['int'];
$precision = $_POST['pre'];
$vigor = $_POST['vigor'];
$items = $_POST['itens'];
$skills = $_POST['pericia'];
$defense = $_POST['defesa'];
$file = $_FILES["img"];
if(isset($file) && !empty($file)){
$dir = 'images/';
$imagePath = $dir . basename($file['name']);
$ImageName = $file['name'];
if(move_uploaded_file($file['tmp_name'], $imagePath)){
echo 'ok'.$file['name'];
$con->addFicha($name, $health, $strength, $dexterity, $intelligence, $precision, $vigor, $items, $skills, $defense,$ImageName);
}else{
$ImageName = "null.jpeg";
echo 'error';
}
} else {
$ImageName = "null.jpeg";
}
}
?>
</body>
</html>