<?php
include('/home/worksmidiacom/cvprov/config/cvprov.config.php');

switch($_GET['step']){
case 0:
if($_GET['password1'] == $_GET['password2']){
$sql1 = $conecta->query("UPDATE usuarios SET senha = '".md5($_GET['password1'])."', alterar = '".$_GET['alterar']."' WHERE id = '".$_GET['id']."'");
?>
<meta http-equiv="refresh" content="0; URL='<?php echo URL_BASE; ?>controle/config/1'"/>
<?php
}
if($_GET['password1'] != $_GET['password2']){
?>
<meta http-equiv="refresh" content="0; URL='<?php echo URL_BASE; ?>controle/config/2'"/>
<?php
}
break;
case 1:
$sql1 = $conecta->query("DELETE FROM usuarios WHERE id = '".$_GET['id']."'");
$sql2 = $conecta->query("DELETE FROM mapa_grupo WHERE usuario = '".$_GET['id']."'");
?>
<meta http-equiv="refresh" content="0; URL='<?php echo URL_BASE; ?>controle/config/3'"/>
<?php
break;
case 2:
if($_GET['password1'] == $_GET['password2']){
$sql1 = $conecta->query("INSERT INTO usuarios(nome, email, senha, alterar) VALUES ('".$_GET['nome']."','".$_GET['email']."','".md5($_GET['password1'])."','".$_GET['alterar']."')");}
$sql2 = $conecta->query("SELECT id FROM usuarios ORDER BY id DESC LIMIT 1");
while ($consulta2 = $sql2->fetch_assoc()){
$sql1 = $conecta->query("INSERT INTO mapa_grupo(usuario, grupo) VALUES ('".$consulta2['id']."','".$_GET['grupo']."')");}
?>
<meta http-equiv="refresh" content="0; URL='<?php echo URL_BASE; ?>controle/config/4'"/>
<?php
if($_GET['password1'] != $_GET['password2']){
?>
<meta http-equiv="refresh" content="0; URL='<?php echo URL_BASE; ?>controle/+
config/2'"/>
<?php
}
break;}
?>