Escolar Documentos
Profissional Documentos
Cultura Documentos
1 INTRODUO.......................................................................................................4
2 OBJETIVO.............................................................................................................4
3 ESCOPO DO PROJETO.......................................................................................5
4 SEGURANA NO DESENVOLVIMENTO DE APLICAES WEB....................5
5 DIAGRAMA DE ATIVIDADE (UML)......................................................................6
5.1 CONCEITOS USADOS NOS DIAGRAMAS DE ATIVIDADES......................................7
5.2 NORMALIZAO DO DIAGRAMA ENTIDADE RELACIONAMENTO (MRN)............7
5.3 DIAGRAMA ENTIDADE-RELACIONAMENTO (DER)....................................................8
6 NORMALIZAO..................................................................................................9
7 CONCLUSO......................................................................................................11
8 REFERNCIA......................................................................................................11
1 INTRODUO
2 OBJETIVO
6 NORMALIZAO
8 REFERNCIA
ANEXO:
--------------------------------------------------------------------------------------------------------
2. Pagina principal
<HTML>
<HEAD>
<TITLE>Locadora</TITLE>
<link rel="stylesheet" type="text/css" href="style.css">
</HEAD>
<BODY>
<table width = 100% height = 20% border = "1" bgcolor = "#006600" bordercolor = white>
<td>
<div align="center"><font size="10" color = white ><b>NetMovies Locadora
</b></font></div>
</td>
<table width =100% height =80% border = "4" bordercolor = white bgcolor = "#00FFCC">
<td>
<div align="center"><font color=black size="7" ><b>Seja bem vindo!!! </b></p></font>
<BR>
<ul id="botao">
<li>
<a href="MenuAdmin.php" title="meu link"><p align="center"><font size="3" color = white
>Administracao</a></p></font>
</li>
</ul>
<BR><BR><BR>
<ul id="botao">
<li>
<a href="MenuUsuario.php" title="meu link"><font size="3" color = white
>Usuario</a></p></font></div>
</li>
</ul>
</td>
</BODY>
</HTML>
3. Alterao Cliente
<HTML>
<HEAD>
<link rel="stylesheet" type="text/css" href="style.css">
</HEAD>
<BODY>
<?php
include "connect_Mysql.php";
$cod_cliente = $_POST["cod_cliente"];
$consulta = mysql_query ("SELECT * FROM cliente WHERE cod_cliente =
$cod_cliente;");
if($consulta == false) {
echo "Cliente no existe!";
include "AlteraCli.php";
} else {
while($camp =@mysql_fetch_array($consulta)){
$cod_cliente = $camp["cod_cliente"];
$nome_cliente = $camp["nome_cliente"];
$telefone = $camp["telefone"];
$endereco = $camp["endereco"];
}
}
print(mysql_error()); //mysql_error -> Retorna o texto da mensagem de erro da operao
anterior do MySQL
// Resultados na tela
echo "<br /><br /><b>Cdigo do Cliente:</b> $cod_cliente <br />";
echo "<b>Nome:</b> $nome_cliente<br />";
echo "<b>Telefone:</b> $telefone<br />";
echo "<b>Endereco:</b> $endereco";
?>
</BODY>
<table align = "center" border="1" width= 60% bordercolor= white >
<td>
<table align="center">
<tr>
<input type="hidden" value="atual" name="atualizarCli.php">
<td align="right">
Cdigo do Cliente:
</td>
<td>
<input type="text" name="cod_cliente" maxlength="80" size="20" value="<?php echo
$cod_cliente;?>"><br>
</td>
</tr>
<tr>
<td align="right">
Nome:
</td>
<td>
<input type="text" name="nome_cliente" maxlength="80" size="20" value="<?php echo
$nome_cliente;?>"><br>
</td>
</tr>
<tr>
<td align="right">
Telefone:
</td>
<td>
<input type="text" name="telefone" maxlength="80" size="20" value="<?php echo
$telefone;?>"><br>
</td>
</tr>
<tr>
<td align="right">
Endereco:
</td>
<td>
<input type="text" name="endereco" maxlength="80" size="20" value="<?php echo
$endereco; ?>"><br>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="reset" name="reset" value="Limpar" />
<input type="submit" name="submit" value="salvar alteraes"/>
</td>
</tr>
</td>
</table>
</form>
</table>
</HTML>
1. Alterao filme
<HTML>
<HEAD>
<link rel="stylesheet" type="text/css" href="style.css">
</HEAD>
<BODY>
<?php
include "connect_Mysql.php";
$cod_filme = $_POST["cod_filme"];
$consulta = mysql_query ("SELECT * FROM filmes WHERE cod_filme =
$cod_filme;");
if($consulta == false) {
echo "Filme no existe!";
include "AlteraFil.php";
} else {
while($camp =@mysql_fetch_array($consulta)){
$cod_filme= $camp["cod_filme"];
$titulo = $camp["titulo"];
$nome_categoria = $camp["nome_categoria"];
}
}
print(mysql_error()); //mysql_error -> Retorna o texto da mensagem de erro da operao
anterior do MySQL
// Resultados na tela
echo "<b>Cdigo do filme:</b> $cod_filme<br />";
echo "<b>Titulo:</b> $titulo<br />";
echo "<b>Categoria:</b> $nome_categoria";
?>
</BODY>
<table align = "center" border="1" width= 60% bordercolor= white >
<td>
<table align="center">
<tr>
<input type="hidden" value="atual" name="atualizarFil.php">
<td align="right">
Cdigo do Filme:
</td>
<td>
<input type="text" name="cod_filme" maxlength="80" size="20" value="<?php echo
$cod_filme;?>"><br>
</td>
</tr>
<tr>
<td align="right">
Ttulo:
</td>
<td>
<input type="text" name="titulo" maxlength="80" size="20" value="<?php echo $titulo;?
>"><br>
</td>
</tr>
<tr>
<td align="right">
Categoria:
</td>
<td>
<input type="text" name="nome_categoria" maxlength="80" size="20" value="<?php echo
$nome_categoria;?>"><br>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="reset" name="reset" value="Limpar" />
<input type="submit" name="submit" value="salvar alteraes"/>
</td>
</tr>
</td>
</table>
</form>
</table>
</HTML>
2. Altera cliente
<HTML>
<HEAD>
<link rel="stylesheet" type="text/css" href="style.css">
</HEAD>
<BODY>
<table align = "center" border="1" width= 60% bordercolor= white >
<td>
<?
include "connect_Mysql.php";
?>
<form method="POST" action="alteracaoCliente.php">
<center><p>Digite o Cdigo do Cliente que deseja alterar:</p>
<input type="text" size="25" maxlength="100" name="cod_cliente"><br><br>
<input type="reset" name="voltar" value="Voltar">
<input type="submit" name="enviar" value="Avanar">
</td>
</table>
</BODY>
</HTML>
3. Altera filmes
<HTML>
<HEAD>
<link rel="stylesheet" type="text/css" href="style.css">
</HEAD>
<BODY>
<table align = "center" border="1" width= 60% bordercolor= white >
<td>
<?
include "connect_Mysql.php";
?>
<form method="POST" action="alteracaoFilme.php">
<center><p>Digite o Cdigo do Filme que deseja alterar:</p>
<input type="text" size="25" maxlength="100" name="cod_filme"><br><br>
<input type="reset" name="voltar" value="Voltar">
<input type="submit" name="enviar" value="Avanar">
</td>
</table>
</BODY>
</HTML>
4. Atualizar cliente
<HTML>
<HEAD>
<link rel="stylesheet" type="text/css" href="style.css">
</HEAD>
<BODY>
<table align = "center" border="1" width= 60% bordercolor= white >
<td>
<?php
include "connect_Mysql.php";
$cod_cliente = $_POST["cod_cliente"];
$nome_cliente = $_POST["nome_cliente"];
$telefone = $_POST["telefone"];
$endereco = $_POST["endereco"];
?>
</td>
</table>
</BODY>
</HTML>
5. Atualizar filmes
<HTML>
<HEAD>
<link rel="stylesheet" type="text/css" href="style.css">
</HEAD>
<BODY>
<table align = "center" border="1" width= 60% bordercolor= white >
<td>
<?php
include "connect_Mysql.php";
$cod_filme = $_POST["cod_filme"];
$titulo = $_POST["titulo"];
$nome_categoria= $_POST["nome_categoria"];
?>
</td>
</table>
</BODY>
</HTML>
6. Classe comedia
<HTML>
<HEAD>
<TITLE>Lista</TITLE>
<link rel="stylesheet" type="text/css" href="style.css">
</HEAD>
<BODY>
<table align= "center" width = 60% border = "1" bordercolor = white>
<td>
<!-- exibimos, aqui, todos os dados inseridos at ento no banco
("Filmes" o nome da tabela) -->
<?php
include "connect_Mysql.php";
while($mostra_dados = mysql_fetch_array($pega_dados)){
$titulo = $mostra_dados['titulo'];
$nome_categoria= $mostra_dados['nome_categoria'];
// Resultados na tela
echo "<b>Ttulo:</b> $titulo<br />";
echo "<b>Categoria:</b> $nome_categoria<br /><br />";
}
?>
</td>
</table>
</BODY>
</HTML>
7. Classe drama
<HTML>
<HEAD>
<TITLE>Lista</TITLE>
<link rel="stylesheet" type="text/css" href="style.css">
</HEAD>
<BODY>
<table align= "center" width = 60% border = "1" bordercolor = white>
<td>
<!-- exibimos, aqui, todos os dados inseridos at ento no banco
("Filmes" o nome da tabela) -->
<?php
include "connect_Mysql.php";
while($mostra_dados = mysql_fetch_array($pega_dados)){
$titulo = $mostra_dados['titulo'];
$nome_categoria= $mostra_dados['nome_categoria'];
// Resultados na tela
echo "<b>Ttulo:</b> $titulo<br />";
echo "<b>Categoria:</b> $nome_categoria<br /><br />";
}
?>
</td>
</table>
</BODY>
</HTML>
8. Connect mysql
<?php
$servidor = "localhost";
$usuario = "root";
$senha = "";
$banco = "locadora";
$conmy = @mysql_connect($servidor,$usuario,$senha);
if($conmy == FALSE) {
echo "Erro ao estabelecer conexo com o mysql...";
} else {
echo "Conectado ao mysql...";
}
$conbd = @mysql_select_db($banco,$conmy);
if($conbd == FALSE) {
echo "<p><font color='red'>Erro ao tentar conectar ao BD...</font>";
} else {
echo "<p>Conexo com o BD estabelecida!";
}
?>
9. Inserir categoria
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<table align = center bordercolor = white border = "1" width = 60%>
<td>
<?php
include "connect_Mysql.php";
$nome_categoria = $_POST["nome_categoria"];
if($_POST["nome_categoria"] == "") {
echo "<p><font color='red'>Campo gnero no inserido!</font>";
$rsp= FALSE;
}
if($consulta == TRUE) {
echo "<p>Operao realizada com sucesso!";
echo "<br /><br /><a href=\"MenuAdmin.php\">Voltar</a>";
} else {
echo "<p><font color='red'>Erro ao incluir os dados no BD!</font>";
}
?>
</td>
</table>
</BODY>
</HTML>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<table align = center bordercolor = white border = "1" width = 60%>
<td>
<?php
include "connect_Mysql.php";
$cod_cliente = $_POST["cod_cliente"];
$nome_cliente = $_POST["nome_cliente"];
$telefone = $_POST["telefone"];
$endereco = $_POST["endereco"];
if($_POST["cod_cliente"] == "") {
echo "<p><font color='red'>Campo cdigo no inserido!</font>";
$rsp == FALSE;
}else if($_POST["nome_cliente"] == "") {
echo "<p><font color='red'>Campo ttulo no inserido!</font>";
$rsp == FALSE;
} else if($_POST["endereco"] == "") {
echo "<p><font color='red'>Campo gnero no inserido!</font>";
$rsp == FALSE;
}
if($query == TRUE) {
echo "<p>Operao realizada com sucesso!<br /><br />";
echo "<font color=red><b>
INSERT INTO cliente (cod_cliente, nome_cliente, telefone,endereco)
VALUES($cod_cliente, '$nome_cliente', $telefone,'$endereco')</b></font>";
echo "<br /><br /><a href=\"MenuAdmin.php\">Voltar</a>";
} else {
echo "<p><font color='red'>Erro ao incluir os dados no BD!</font>";
}
?>
</td>
</table>
</BODY>
</HTML>
if($_POST["cod_filme"] == "") {
echo "<p><font color='red'>Campo cdigo no inserido!</font>";
$rsp == FALSE;
}else if($_POST["titulo"] == "") {
echo "<p><font color='red'>Campo ttulo no inserido!</font>";
$rsp == FALSE;
} else if($_POST["nome_categoria"] == "") {
echo "<p><font color='red'>Campo gnero no inserido!</font>";
$rsp == FALSE;
}
if($query == TRUE) {
echo "<p>Operao realizada com sucesso!<br /><br />";
echo "<font color=red><b>
INSERT INTO filmes (cod_filme, titulo, nome_categoria)
VALUES($cod_filme, '$titulo','$nome_categoria')</b></font>";
echo "<br /><br /><a href=\"MenuAdmin.php\">Voltar</a>";
} else {
echo "<p><font color='red'>Erro ao incluir os dados no BD!</font>";
}
?>
</td>
</table>
</BODY>
</HTML>
<HTML>
<html>
<HEAD>
<TITLE>MenuAdmin</TITLE>
<link rel="stylesheet" type="text/css" href="style.css">
</HEAD>
<BODY>
<table border=4% width= 100% bordercolor= white background= black>
<td>
<ul id="menu">
<li>
<div align="center"><font><b>CLIENTES</b></font>
<a href="CadCliente.php" title="meu link">Inserir</a>
<a href="MostrarCli.php" title="meu link">Listar</a>
<a href="AlteraCli.php" title="meu link">Alterar</a>
<a href="RemoveCli.php" title="meu link">Remover</a>
</li>
<li>
<div align="center"><font><b>FILMES </b></font>
<a href="CadFilme.php" title="meu link">Inserir</a>
<a href="MostrarFilm.php" title="meu link">Listar</a>
<a href="AlteraFil.php" title="meu link">Alterar</a>
<a href="removeFil.php" title="meu link">Remover</a>
</li>
<li>
<li>
<div align="center"><font><b>CONTAGEM</b></font>
<a href="QtidadClientes.php" title="meu link">Clientes</a>
<a href="QtidadFilmes.php" title="meu link">Filmes</a>
</li>
</ul>
<?php
echo "<br /><a href=\"index.php\">Voltar</a>";
?>
</td>
</table>
</body>
</html>
<li>
<div align="center"><font><b>FILMES </b></font>
<a href="MostrarListFilme.php" title="meu link">Mostrar lista</a>
<a href="MostrarCatFilme.php" title="meu link">Mostrar Filme e Categoria</a>
</li>
<li>
</li>
<li>
<div align="center"><font><b>CLASSIFICAO</b></font>
<a href="ClassComedia.php" title="meu link">Comdia</a>
<a href="ClassDrama.php" title="meu link">Drama</a>
</li>
</ul>
</td>
</tr>
</table>
</body>
</html>
while($mostra_dados = mysql_fetch_array($pega_dados)){
$cod_cliente = $mostra_dados['cod_cliente'];
$nome_cliente = $mostra_dados['nome_cliente'];
$telefone = $mostra_dados['telefone'];
$endereco = $mostra_dados['endereco'];
// Resultados na tela
echo "<br /><br /><b>Cdigo do Cliente:</b> $cod_cliente <br />";
echo "<b>Nome:</b> $nome_cliente<br />";
echo "<b>Telefone:</b> $telefone<br />";
echo "<b>Endereco:</b> $endereco";
}
?>
</td>
</table>
</BODY>
</HTML>
16. Mostrar filmes resevados
<HTML>
<HEAD>
<TITLE>Lista</TITLE>
<link rel="stylesheet" type="text/css" href="style.css">
</HEAD>
<BODY>
<table align= "center" width = 60% border = "1" bordercolor = white>
<td>
<!-- exibimos, aqui, todos os dados inseridos at ento no banco
("Filmes" o nome da tabela) -->
<?php
include "connect_Mysql.php";
$pega_dados = mysql_query("SELECT * FROM filmes");
echo "<font color=red><b>
SELECT * FROM filmes<b></font><br /><br />";
while($mostra_dados = mysql_fetch_array($pega_dados)){
$cod_filme = $mostra_dados['cod_filme'];
$titulo = $mostra_dados['titulo'];
$nome_categoria= $mostra_dados['nome_categoria'];
// Resultados na tela
echo "<br /><br /><b>Cdigo do Filme:</b> $cod_filme<br />";
echo "<b>Ttulo:</b> $titulo<br />";
echo "<b>Categoria:</b> $nome_categoria";
}
?>
</td>
</table>
</BODY>
</HTML>
// Resultados na tela
echo "<br /><b>Ttulo:</b> $titulo<br />";
}
?>
</td>
</table>
</BODY>
</HTML>
18. Cadastro de cliente
<html><!-- Desenha o cadastro do cliente na tela -->
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<body>
<table align = center bordercolor = white border = "1" width = 60%>
<td>
<h1 align="center">.: Cadastro do cliente :.</h1>
<h3 align="center">Campos com asterisco so obrigatrios</h3>
<form action="InserirCli.php" method="post" enctype="multipart/form-data">
<table align="center">
<tr>
<td align="right">
Codigo do Cliente:
</td>
<td>
<input type="text" name="cod_cliente" maxlength="80" size="20">*<br>
</td>
</tr>
<tr>
<td align="right">
Nome:
</td>
<td>
<input type="text" name="nome_cliente" maxlength="80" size="20">*<br>
</td>
</tr>
<tr>
<td align="right">
Telefone:
</td>
<td>
<input type="text" name="telefone" maxlength="80" size="20">*<br>
</td>
</tr>
<tr>
<td align="right">
Endereco:
</td>
<td>
<input type="text" name="endereco" maxlength="80" size="20">*<br>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="reset" name="reset" value="Limpar" />
<input type="submit" name="submit" value="Enviar" />
</td>
</tr>
</table>
</form>
</td>
</table>
</body>
</html>
<!-- Method = "post" -> este mtodo transmite toda a informao via formulrio,
utilizando post,ele sabe que necessita continuar "ouvindo" para obter a informao-->
<!-- Enctype -> do form serve pra ti dizer qual o tipo de contedo do form,
enviar fotos ou arquivos em geral atravs de um formulrio.
Sem isso s d pra enviar texto, sem nada anexado. -->
<!-- Value -> Opcional,especifica que texto aparecer no campo
quando o formulrio for exibido.-->
19. Cadastro de filmes
html><!-- Desenha o cadastro do filmes na tela -->
<head>
<link rel="stylesheet" type="text/css" href="style.css">
<body>
<table align = center bordercolor = white border = "1" width = 60%>
<td>
<h1 align="center">.: Cadastro de Filmes :.</h1>
<h3 align="center">Campos com asterisco so obrigatrios</h3>
<form action="InserirFil.php" method="post" enctype="multipart/form-data">
<table align="center">
<tr>
<td align="right">
Codigo do Filme:
</td>
<td>
<input type="text" name="cod_filme" maxlength="80" size="20">*<br>
</td>
</tr>
<tr>
<td align="right">
Ttulo:
</td>
<td>
<input type="text" name="titulo" maxlength="80" size="20">*<br>
</td>
</tr>
<tr>
<td align="right">
Categoria:
</td>
<td>
<input type="text" name="nome_categoria" maxlength="80" size="20">*<br>
</td>
</tr>
<tr>
<td align="center" colspan="2">
<input type="reset" name="reset" value="Limpar" />
<input type="submit" name="submit" value="Enviar" />
</td>
</tr>
</table>
</form>
</td>
</table>
</body>
</html>
} else {
echo "Arquivo deletado com sucesso!<br /><br />";
echo "<font color=red><b>
DELETE FROM cliente WHERE cod_cliente = $cod_cliente </b></font> ";
echo "<br /><br /><a href=\"MenuAdmin.php\">Voltar</a>";
}
?>
</td>
</table>
</BODY>
</HTML>
21. Remoo filme
<HTML>
<HEAD>
<TITLE>Documento PHP</TITLE>
<link rel="stylesheet" type="text/css" href="style.css">
</HEAD>
<BODY>
<table border="1" width= 60% bordercolor= white >
<td>
<?php
include "connect_Mysql.php";
$cod_filme = $_POST["cod_filme"];
$consulta =mysql_query("SELECT cod_filme FROM filmes WHERE codigo =
$cod_filme");
if($consulta == TRUE) {
foreach($_POST as $valor) {
echo $valor;
}
}
$sql = "DELETE FROM filmes WHERE cod_filme = $cod_filme";
$resultado = mysql_query($sql);
if($resultado == FALSE) {
echo "Nenhum registro foi deletado...";
} else {
echo "Arquivo deletado com sucesso!<br /><br />";
echo "<font color=red><b>
DELETE FROM filmes WHERE cod_filme = $cod_filme</b></font> ";
echo "<br /><br /><a href=\"MenuAdmin.php\">Voltar</a>";
}
?>
</td>
</table>
</BODY>
</HTML>
22. Remove clientes
<HTML>
<HEAD>
<link rel="stylesheet" type="text/css" href="style.css">
</HEAD>
<BODY>
<table align= "center" border="1" width= 60% bordercolor= white >
<td>
<?php
include "connect_Mysql.php";
?>
</BODY>
<form method="POST" action="remocaoCliente.php">
<center><p>Digite o cdigo do cliente que deseja excluir:</p>
<input type="text" size="10" maxlength="30" name="cod_cliente"><BR><BR>
<input type="reset" name="voltar" value="Voltar"/>
<input type="submit" name="enviar" value="Avanar"/>
</BODY>
</HTML>
23. Remove filmes
<HTML>
<HEAD>
<link rel="stylesheet" type="text/css" href="style.css">
</HEAD>
<BODY>
<table align= "center" border="1" width= 60% bordercolor= white >
<td>
<?php
include "connect_Mysql.php";
?>
</BODY>
<form method="POST" action="remocaoFilme.php">
<center><p>Digite o cdigo que deseja excluir:</p>
<input type="text" size="10" maxlength="20" name="cod_filme"><BR><BR>
<input type="reset" name="voltar" value="Voltar"/>
<input type="submit" name="enviar" value="Avanar"/>
</td>
</table>
</HTML>
24. Estiloda da pgina ( Style )
body{
margin-right: 100px;
margin-bottom: 10px;
margin-left: 100px;
background-color:CCFFCC;
text-decoration: none;
#menu {
width: 12em;
padding: 0;
margin: 0;
font: 14px Verdana, sans-serif;
}
#menu ul {
list-style: none;
margin: 0;
padding: 0;
}
#menu li {
border-bottom: 1px solid #000000;
margin: 0;
}
#menu li a {
display: block;
padding: 5px 5px 5px 0.5em;
font-weight:bold;
border-left: 10px solid #008000;
border-right: 10px solid #99FF99;
background-color: #FFFFFF;
color: #808000;
text-decoration: none;
}
#menu li a:hover {
border-left: 10px solid #99FF99;
border-right: 10px solid #008000;
background-color: #FFFFCC;
color: #000000;
}
#botao{
padding: 0;
margin: 0;
list-style: none;
display: block;
font-family:Verdana,Helvetica;
font-weight:bold;
color:white;
background:#006600;
border:5px;
width:150px;
height:25px;
text-decoration: none;
}