-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontinua.php
44 lines (36 loc) · 1.08 KB
/
continua.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
<?php
$c = $_GET['c'];
//criando a sessão
if(!isset($_SESSION)) session_start();
$id = $c;
$_SESSION['id'] = $id;
$_SESSION['nivel'] = 1;
error_reporting (E_ALL & ~ E_NOTICE & ~ E_DEPRECATED);
$mysqli = new mysqli("localhost", "root", "", "test");
$sql = "SELECT tabela FROM rep";
$res = $mysqli->query($sql);
while ($row = $res->fetch_assoc()){
if($row['tabela'] == $c){
//Cria a tabela do usuario!
$sql = "CREATE TABLE IF NOT EXISTS contas".$c." (
id INT(16) AUTO_INCREMENT PRIMARY KEY,
descricao VARCHAR(20) COLLATE utf8_general_ci,
vencimento DATE,
valor FLOAT(32)
)";
$mysqli->query($sql);
$sql = "CREATE TABLE IF NOT EXISTS ".$c." (
id INT(16) AUTO_INCREMENT PRIMARY KEY,
nome VARCHAR(20) COLLATE utf8_general_ci,
sobrenome VARCHAR(30) COLLATE utf8_general_ci,
email VARCHAR(30) COLLATE utf8_general_ci
)";
$mysqli->query($sql);
mysqli_close($mysqli);
//redireiciona para terminar o cadastro
header("location: painel.php");
break;
}
}
mysqli_close($mysqli);
?>