forked from denilsonbonatti/toshiro-shibakita
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
48 lines (32 loc) · 974 Bytes
/
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
<html>
<head>
<title>Exemplo PHP</title>
</head>
<body>
<?php
ini_set("display_errors", 1);
header('Content-Type: text/html; charset=iso-8859-1');
echo 'Versao Atual do PHP: ' . phpversion() . '<br>';
$servername = "54.234.153.24";
$username = "root";
$password = "Senha123";
$database = "meubanco";
// Criar conexão
$link = new mysqli($servername, $username, $password, $database);
/* check connection */
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$valor_rand1 = rand(1, 999);
$valor_rand2 = strtoupper(substr(bin2hex(random_bytes(4)), 1));
$host_name = gethostname();
$query = "INSERT INTO dados (AlunoID, Nome, Sobrenome, Endereco, Cidade, Host) VALUES ('$valor_rand1' , '$valor_rand2', '$valor_rand2', '$valor_rand2', '$valor_rand2','$host_name')";
if ($link->query($query) === TRUE) {
echo "New record created successfully";
} else {
echo "Error: " . $link->error;
}
?>
</body>
</html>