<!--
Author: W3layouts
Author URL: http://w3layouts.com
License: Creative Commons Attribution 3.0 Unported
License URL: http://creativecommons.org/licenses/by/3.0/
-->
<?php 
session_start();
include 'php/funcoes.php';
if (!empty($_POST["login"]) && !empty($_POST["senha"])) {
    $login = $_POST["login"];
    $senha = $_POST["senha"];
    logar($login, $senha);
}
if (isset($_GET['logout'])) {
    logout();
}
if (isset($_GET['acao']) && $_GET['acao'] == 'excluir') {
    $identifica = $_GET['id_produto'];
    conectar();
    $deleta = mysql_query("DELETE FROM produto WHERE id_produto = '{$identifica}'");
    if ($deleta) {
        echo "<script>alert('Produto: {$identifica}, Excluído com Sucesso!');</script>";
    } else {
        echo "<script>alert('Falha ao Excluir Produto: {$identifica}');</script>";
    }
    mysql_close();
}
if (isset($_POST['alt_prod'])) {
    $acao = 1;
    cadastrarEAlterarProduto($acao);
Beispiel #2
0
<?php

session_start();
require_once 'conexao/functionsLogin.php';
if (isset($_POST['logar'])) {
    if (logar($_POST['email'], sha1($_POST['senha']))) {
        logAcesso($_SERVER['REMOTE_ADDR'], date("d/m/Y H:i:s"), $_SESSION['nomeUsuario']);
        header("Location:dashboard.php");
    } else {
        alert();
    }
}
?>

<!DOCTYPE html>
<html lang="pt-br">
    
    <head>
        <title>Nível Construções</title>
        <link rel="shortcut icon" href="assets/img/icone.ico" >
        <meta charset="UTF-8" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <link rel="stylesheet" href="assets/css/bootstrap.min.css" />
        <link rel="stylesheet" href="assets/css/bootstrap-responsive.min.css" />
        <link rel="stylesheet" href="assets/css/matrix-login.css" />
        <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700,800' rel='stylesheet' type='text/css'>
        <script src="assets/js/jquery-1.10.2.min.js"></script>
        <script type="text/javascript">
            // FUNÇÃO QUE APAGA A MENSAGEM DE ALERTA QUANDO UMA AÇÃO É REALIZADA
            jQuery(function($){
              $("#alert-message").delay(2000).fadeOut("slow", function () { $(this).remove(); })
Beispiel #3
0
function cadastrarUsuario()
{
    $verifica = 0;
    conectar();
    $nome = $_POST['nome'];
    $cpf = $_POST['cpf'];
    $cpf = str_replace(".", "", $cpf);
    $cpf = str_replace("-", "", $cpf);
    if (strlen($cpf) == 11) {
        $verifica += 1;
    }
    $email = $_POST['email'];
    $tel = $_POST['tel'];
    $tel = str_replace("-", "", $tel);
    $tel = str_replace(" ", "", $tel);
    $tel = str_replace("(", "", $tel);
    $tel = str_replace(")", "", $tel);
    if (strlen($tel) == 10 || strlen($tel) == 11) {
        $verifica += 1;
    }
    $senha1 = $_POST['senha1'];
    $senha2 = $_POST['senha2'];
    if ($senha1 == $senha2) {
        $verifica += 1;
        $senha1 = md5($senha1);
    }
    $tipo_usuario = $_POST['tipo_usuario'];
    $is_funcionario = 0;
    $is_cliente = 0;
    $is_administrador = 0;
    if ($tipo_usuario == "cliente") {
        $is_cliente = 1;
    } else {
        if ($tipo_usuario == "funcionario") {
            $is_funcionario = 1;
        } else {
            if ($tipo_usuario == "administrador") {
                $is_administrador = 1;
            }
        }
    }
    if ($verifica == 3) {
        $sql = "INSERT INTO usuario VALUES (null,'" . $nome . "','" . $cpf . "','" . $tel . "','" . $email . "','" . $senha1 . "','" . $is_funcionario . "','" . $is_cliente . "','" . $is_administrador . "')";
        $insert = mysql_query($sql);
    } else {
        session_destroy();
        echo "<script>alert('Cadastro não Realizado!');location.href='cadastro.php';</script>";
        break;
    }
    if ($insert) {
        echo '<script> alert("Cadastro Realizado com Sucesso!");</script>';
    }
    mysql_close();
    if ($_SESSION['logado'] != 1) {
        logar($cpf, $senha1);
        echo "<script>\n\t\t\t  location.href='index.php';\n\t\t\t  </script>";
    }
}
Beispiel #4
0
<?php

session_start();
include_once 'functions/config/config.php';
try {
    carregaIncludes(array("conexao", "login"), "login");
} catch (Exception $e) {
    echo $e->getMessage();
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    if (isset($_POST['logar'])) {
        $login = addslashes($_POST['login']);
        $password = addslashes(md5($_POST['password']));
        if (logar($login, $password)) {
            $_SESSION['logado_admin'] = true;
            header("Location: inc/painel.php");
        } else {
            $erro = "Usuário ou senha inválidos!";
        }
    }
}
?>

<html>
<head>
	<meta charset=utf-8>
	<title>Painel do Administrador</title>
	<link rel="stylesheet" type="text/css" href="css/style_login.css">
</head>
<body>
<?php

require "cliente_dao.class.php";
if (array_key_exists("op", $_GET)) {
    switch ($_GET['op']) {
        case "salvar_cliente":
            salvar_cliente();
            break;
        case "salvar_foto":
            salvar_foto();
            break;
        case 'logar_cliente':
            logar();
            break;
        case 'salvar_respostas':
            salvar_respostas();
            break;
        case 'salvar_msg':
            salvarMsg();
            break;
    }
}
function salvar_respostas()
{
    $f = array();
    if ($_POST['quant'] > 1) {
        for ($i = 1; $i < $_POST['quant']; $i++) {
            echo $_POST[$i] . '<br>';
            list($cod, $resp) = split('[-]', $_POST[$i]);
            $var['cod'] = $cod;
            $var['resp'] = $resp;