Mudanças entre as edições de "Projeto Integrador - 2010.1 - Equipe Café On-Line"
Ir para navegação
Ir para pesquisar
Linha 105: | Linha 105: | ||
(colocar comandos usados na criação das tabelas) | (colocar comandos usados na criação das tabelas) | ||
− | === | + | ===Cadastro dos anúncios=== |
− | + | *Segue abaixo o código da página (cadastro.html) onde o admin digitará os dados do anúncio: | |
<syntaxhighlight lang=lang="html4strict"> | <syntaxhighlight lang=lang="html4strict"> | ||
Linha 144: | Linha 144: | ||
− | * | + | *Depois de informados os dados do anúncio o admin é redirecionado para outra pagina onde será feita a conexão com o banco de dados mysql para inserir os dados nas tabelas. |
Segue o código (add.php): | Segue o código (add.php): | ||
Linha 151: | Linha 151: | ||
<html> | <html> | ||
<head> | <head> | ||
− | <meta http-equiv=" | + | <meta http-equiv="content-Type" content="text/html; charset=iso-8859-1" /> |
</head> | </head> | ||
<body bgcolor="000000" text="FFFFFF"> | <body bgcolor="000000" text="FFFFFF"> | ||
Linha 170: | Linha 170: | ||
mysql_close($conexao) or die("Erro fechar conexao"); | mysql_close($conexao) or die("Erro fechar conexao"); | ||
if($cadastrar==true) | if($cadastrar==true) | ||
+ | { | ||
+ | echo "<h2>Anúncio cadastrado com sucesso <br></h2>"; | ||
+ | echo "<a href='http://www.cafeonline.sj.ifsc.edu.br/listar>Ir para lista de anúncios</a>"; | ||
+ | }else{ | ||
+ | echo "Erro ao cadastrar anúncio"; | ||
+ | echo "<a href='http://www.cafeonline.sj.ifsc.edu.br/listar>Ir para lista de anúncios</a>"; | ||
+ | } | ||
+ | }else{ | ||
+ | echo "<h2>Erro, campos vazios<br></h2>"; | ||
+ | echo "<a href='http://www.cafeonline.sj.ifsc.edu.br/cadastro'>Voltar para cadastro</a>"; | ||
+ | } | ||
+ | header("Content-Type: text/html; charset=ISO-8859-1", true); | ||
+ | ?> | ||
+ | </body> | ||
+ | </html> | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | |||
+ | ===Listagem de anúncios=== | ||
+ | *Na página listar.php é feita a conexão com o banco de dados e também a consulta nas tabelas, para fazer a listagem dos anúncios ja cadastrados, e através dessa página pode-se selecionar um anúncio o qual deseja editar ou excluir. | ||
+ | |||
+ | <syntaxhighlight lang=lang="php"> | ||
+ | |||
+ | <html> | ||
+ | <head> | ||
+ | <meta http-equiv="content-Type" content="text/html; charset=iso-8859-1" /> | ||
+ | <title> Café online </title> | ||
+ | </head> | ||
+ | <body bgcolor="000000" text="FFFFFF"> | ||
+ | <h1>Listagem de anúncios</h1> | ||
+ | <table><tr><td> | ||
+ | <? | ||
+ | $conexao = mysql_connect("localhost","root","cafeonline") or die ("ERRO"); | ||
+ | if($conexao) // se $conexao é true, ou seja, conectou ao banco de dados, seleciona com qual banco deseja trabalhar. | ||
+ | { | ||
+ | mysql_select_db("cafeonline") or die ("erro 1"); //seleciona qual o banco | ||
+ | $query = "SELECT * FROM anuncio" or die ("erro 2"); //seleciona tudo (*), de uma tabela chamada anuncio | ||
+ | $dados = mysql_query($query,$conexao) or die ("erro 3"); | ||
+ | |||
+ | echo "<table border=1>"; | ||
+ | echo "<tr><td>Nome do cliente</td>"; | ||
+ | echo "<td>Título do anúncio</td>"; | ||
+ | echo "<td>Validade</td>"; | ||
+ | echo "<td>Ações</td></tr>"; | ||
+ | |||
+ | while($linha=mysql_fetch_array($dados,MYSQL_ASSOC)) | ||
+ | { | ||
+ | $id = $linha["IDANUNCIO"]; | ||
+ | echo "<tr><td>" . $linha["NOMECLIENTE"] . "</td>" ; | ||
+ | echo "<td>" . $linha["NOMEANUNCIO"] . "</td>" ; | ||
+ | echo "<td>" . $linha["VALIDADE"] . "</td>" ; | ||
+ | echo "<td><a href='excluir.php?id=$id' style='text-decoration:none'>Excluir </a>"; | ||
+ | echo "<a href='editar.php?id=$id' style='text-decoration:none'>Editar</a></td></tr>"; | ||
+ | } | ||
+ | echo "</table>"; | ||
+ | echo "<center><a href='http://www.cafeonline.sj.ifsc.edu.br/cadastro'>Incluir novo anúncio</a></center>"; | ||
+ | mysql_close($conexao) or die ("erro 5"); | ||
+ | } | ||
+ | header("Content-Type: text/html; charset=ISO-8859-1", true); | ||
+ | ?> | ||
+ | </td><td> | ||
+ | <img src="800x600.gif" border="0" width="600" height="400" align="right"></td></tr></table> | ||
+ | </body> | ||
+ | </html> | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | |||
+ | ===Editando e atualizando os anúncios=== | ||
+ | *Depois de selecionado um anúncio na página de listagem o admin é direcionado para a página de edição de anúncios. E então são mostrados os dados que já estão cadastrados do anúncio selecionado, podendo alterar o que desejar e depois apertando no botão gravar que é direcionado para a página onde será feita a atualização do banco de dados. | ||
+ | |||
+ | Segue o código da página de edição de anúncios (editar.php): | ||
+ | <syntaxhighlight lang=lang="php"> | ||
+ | |||
+ | <html> | ||
+ | <head> | ||
+ | <meta http-equiv="content-Type" content="text/html; charset=iso-8859-1" /> | ||
+ | <title> Caf&eacte; online </title> | ||
+ | </head> | ||
+ | <body bgcolor="000000" text="FFFFFF"> | ||
+ | <h1>Editar anúncio </h1> | ||
+ | |||
+ | <? | ||
+ | $id = $_GET['id']; | ||
+ | $conexao = mysql_connect("localhost","root","cafeonline") ; | ||
+ | mysql_select_db("cafeonline") or die ("erro 1"); | ||
+ | $query = ("select * from anuncio where IDANUNCIO=$id"); | ||
+ | $dados = mysql_query($query,$conexao); | ||
+ | $linha=mysql_fetch_array($dados,MYSQL_ASSOC); | ||
+ | mysql_query($linha); | ||
+ | header("Content-Type: text/html; charset=ISO-8859-1", true); | ||
+ | ?> | ||
+ | <form name="formTeste" action="add2.php?id=<? echo $id ?>" method="post"> | ||
+ | <table> | ||
+ | <tr> | ||
+ | <td> | ||
+ | <p> Título: <br> | ||
+ | <input type:"text" name="titulo" value="<? echo $linha['NOMEANUNCIO'] ?>"> | ||
+ | <p> Nome do cliente: <br> | ||
+ | <input type:"text" name="nome" value="<? echo $linha['NOMECLIENTE'] ?>"> | ||
+ | <p> Anúncio: <br> | ||
+ | <textarea rows="2" cols="20" name="texto"><? echo $linha['TEXTO'] ?></textarea> | ||
+ | <p> Link: <br> | ||
+ | <input type:"text" name="link" value="<? echo $linha['LINK'] ?>"> | ||
+ | <p> Expira em: <br> | ||
+ | <input type:"text"name="validade" value="<? echo $linha['VALIDADE'] ?>"> | ||
+ | <p> Expirado: | ||
+ | <input type=checkbox> | ||
+ | <input type="submit" name="b_enviar" value="Gravar"><BR> | ||
+ | </td> | ||
+ | <td> | ||
+ | <img src="800x600.gif" border="0" width="600" height="400"> | ||
+ | </td> | ||
+ | </tr> | ||
+ | </body> | ||
+ | </html> | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | |||
+ | *Código onde é feita a atualização do banco de dados (add2.php): | ||
+ | |||
+ | <syntaxhighlight lang=lang="php"> | ||
+ | |||
+ | <html> | ||
+ | <head> | ||
+ | <meta http-equiv="content-Type" content="text/html; charset=iso-8859-1" /> | ||
+ | </head> | ||
+ | <body bgcolor="000000" text="FFFFFF"> | ||
+ | <? | ||
+ | $conexao = mysql_connect("localhost","root","cafeonline") ; | ||
+ | $base_ok = mysql_select_db("cafeonline",$conexao); | ||
+ | $id = $_GET['id']; | ||
+ | $titulo=$_POST['titulo'] ; | ||
+ | $nome=$_POST['nome'] ; | ||
+ | $texto=$_POST['texto'] ; | ||
+ | $link=$_POST['link'] ; | ||
+ | $validade=$_POST['validade'] ; | ||
+ | |||
+ | if (!empty ($titulo) && !empty ($nome) && !empty ($texto) && !empty ($link) && !empty ($validade)) | ||
+ | { | ||
+ | $update=mysql_query("UPDATE anuncio SET NOMECLIENTE='$nome', NOMEANUNCIO='$titulo', TEXTO='$texto', LINK='$link', VALIDADE='$validade' WHERE IDANUNCIO='$id'"); | ||
+ | if($update==true) | ||
{ | { | ||
− | + | echo "<h2>Dados atualizados com sucesso <br></h2>"; | |
− | + | echo "<a href='http://www.cafeonline.sj.ifsc.edu.br/listar>Ir para lista de anúncios</a>"; | |
}else{ | }else{ | ||
− | echo "Erro ao | + | echo "Erro ao Atualizar"; |
− | "<a href='http://www.cafeonline.sj.ifsc.edu.br/listar>Ir para lista de | + | "<a href='http://www.cafeonline.sj.ifsc.edu.br/listar>Ir para lista de anúncios</a>"; |
} | } | ||
− | + | }else{ | |
− | + | echo "<h2>Erro, campos vazios<br></h2>"; | |
− | + | echo "<a href='http://www.cafeonline.sj.ifsc.edu.br/listar'>Voltar para lista de anúncios</a>"; | |
− | + | } | |
+ | header("Content-Type: text/html; charset=ISO-8859-1", true); | ||
+ | ?> | ||
+ | </body> | ||
+ | </html> | ||
+ | |||
+ | </syntaxhighlight> | ||
+ | |||
+ | |||
+ | ===Excluindo anúncios=== | ||
+ | Segue o código da página para exclusão de anúncios (excluir.php): | ||
+ | |||
+ | <syntaxhighlight lang=lang="php"> | ||
+ | |||
+ | <html> | ||
+ | <head><meta http-equiv="content-Type" content="text/html; charset=iso-8859-1" /></head> | ||
+ | <body bgcolor="000000" text="FFFFFF"> | ||
+ | <? | ||
+ | |||
+ | $conexao = mysql_connect("localhost","root","cafeonline") ; | ||
+ | $base_ok = mysql_select_db("cafeonline",$conexao) or die ("erro 1"); | ||
+ | $id=$_GET["id"]; | ||
+ | $query = mysql_query("delete from anuncio where IDANUNCIO='$id'"); | ||
+ | mysql_query($query); | ||
+ | |||
+ | if ($query==true) | ||
+ | { | ||
+ | echo "<h2>Anúncio exlcluido<br></h2>"; | ||
+ | echo "<a href='http://www.cafeonline.sj.ifsc.edu.br/listar>Voltar para lista de anúncios</a>"; | ||
+ | }else{ | ||
+ | echo "Erro ao excluir anúncio"; | ||
+ | echo "<a href='http://www.cafeonline.sj.ifsc.edu.br/listar>Voltar para lista de anúncios</a>"; | ||
+ | } | ||
+ | header("Content-Type: text/html; charset=ISO-8859-1", true); | ||
?> | ?> | ||
</body> | </body> | ||
</html> | </html> | ||
+ | |||
</syntaxhighlight> | </syntaxhighlight> |
Edição das 15h51min de 4 de julho de 2010
Descrição das atividades por datas - Projeto Integrador 2010-1
Dia: 08/6/2010
Criação do nome da equipe: Café On-line.
Cabeamento
- Foi passado os cabos do Patch Panel do Armário Principal para o Armário Café On-line.
- Feitos os pontos de acesso (Tomadas).
- Padrão 568A.
Gerência de Rede
- Instalação do Sistema Operacional, definido pelo Eris.
Fotos do Primeiro Dia
Dia: 09/6/2010
Cabeamento
- Verificamos se a parte de cabeamento ta ok.
- Foi visto que os Patch Panel do Lab. de Transmissão não funcionam muito bem.
Gerência de Rede
- Término da instalação do Sistema Operacional.
Dia: 10/6/2010
Cabeamento
- Verificamos a parte dos Patch Panel, apenas uma porta não funciona.
Gerência de Rede
- Instalação dos produtos de Gerência.
Dia: 11/6/2010
Gerência de Rede
- Configurado para acesso remoto.
Dia 14/6/2010
Aula após o Intervalo, pois tivemos que apresentar um trabalho.
Instalação de Equipamento
- Implantação dos Modems, como o cabo que interliga os laboratórios chega no RACK da direita, acabamos instalando todos os modems no mesmo lugar onde o fio chegava.
- Rede interna: 192.168.100.0/24.
Cabeamento
- Foi feito os Patch Cord.
Fotos certificação do Link físico
Dia 15/6/2010
Instalação de Equipamento
- Inicio das configurações dos modems.
Programação
- Iniciamos a página de autenticação.
Cabeamento
- Realizamos testes do link.
- Apenas uma porta não funciona.
Dia 16/6/2010
Gerência de Rede
- Instalação do Squid e Dansguardian.
- Alteramos as regras de roteamento, afim de configurar um proxy transparente.
--Rubia Andrade 21:09, 16 Junho 2010 (BRT)
Aplicação
- Primeiramente foram criadas as tabelas no mysql:
(colocar comandos usados na criação das tabelas)
Cadastro dos anúncios
- Segue abaixo o código da página (cadastro.html) onde o admin digitará os dados do anúncio:
<html>
<head>
<title> CaféOnline </title>
</head>
<body bgcolor="000000" text="FFFFFF">
<table align=center>
<tr>
<h1>Cadastro de anúncios</h1>
<form name="formTeste" action="add.php" method="post">
<table>
<tr><td>
<p> Título: <br>
<input type:"text" name="titulo">
<p> Nome do cliente: <br>
<input type:"text" name="nome">
<p> Anúncio: <br>
<textarea rows="2" cols="20" name="texto"></textarea>
<p> Link: <br>
<input type:"text" name="link">
<p> Expira em: <br>
<input type:"text"name="validade">
<p> Expirado:
<input type=checkbox>
<input type="submit" name="b_enviar" value="Gravar"><BR>
</td>
<td>
<img src="800x600.gif" border="0" width="600" height="400">
</td>
</tr>
</body>
</html>
- Depois de informados os dados do anúncio o admin é redirecionado para outra pagina onde será feita a conexão com o banco de dados mysql para inserir os dados nas tabelas.
Segue o código (add.php):
<html>
<head>
<meta http-equiv="content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body bgcolor="000000" text="FFFFFF">
<?
$titulo=$_POST['titulo'] ;
$nome=$_POST['nome'] ;
$texto=$_POST['texto'] ;
$link=$_POST['link'] ;
$validade=$_POST['validade'] ;
if (!empty ($titulo) && !empty ($nome) && !empty ($texto) && !empty ($link) && !empty ($validade))
{
$conexao = mysql_connect("localhost","root","cafeonline") ;
$base_ok = mysql_select_db("cafeonline",$conexao) or die ("erro 1");
$inserir = "INSERT INTO anuncio (NOMECLIENTE, NOMEANUNCIO, TEXTO, LINK, VALIDADE) VALUES ('$nome', '$titulo', '$texto', '$link', '$validade')";
$cadastrar = mysql_query($inserir,$conexao) or die("erro 2");
mysql_close($conexao) or die("Erro fechar conexao");
if($cadastrar==true)
{
echo "<h2>Anúncio cadastrado com sucesso <br></h2>";
echo "<a href='http://www.cafeonline.sj.ifsc.edu.br/listar>Ir para lista de anúncios</a>";
}else{
echo "Erro ao cadastrar anúncio";
echo "<a href='http://www.cafeonline.sj.ifsc.edu.br/listar>Ir para lista de anúncios</a>";
}
}else{
echo "<h2>Erro, campos vazios<br></h2>";
echo "<a href='http://www.cafeonline.sj.ifsc.edu.br/cadastro'>Voltar para cadastro</a>";
}
header("Content-Type: text/html; charset=ISO-8859-1", true);
?>
</body>
</html>
Listagem de anúncios
- Na página listar.php é feita a conexão com o banco de dados e também a consulta nas tabelas, para fazer a listagem dos anúncios ja cadastrados, e através dessa página pode-se selecionar um anúncio o qual deseja editar ou excluir.
<html>
<head>
<meta http-equiv="content-Type" content="text/html; charset=iso-8859-1" />
<title> Café online </title>
</head>
<body bgcolor="000000" text="FFFFFF">
<h1>Listagem de anúncios</h1>
<table><tr><td>
<?
$conexao = mysql_connect("localhost","root","cafeonline") or die ("ERRO");
if($conexao) // se $conexao é true, ou seja, conectou ao banco de dados, seleciona com qual banco deseja trabalhar.
{
mysql_select_db("cafeonline") or die ("erro 1"); //seleciona qual o banco
$query = "SELECT * FROM anuncio" or die ("erro 2"); //seleciona tudo (*), de uma tabela chamada anuncio
$dados = mysql_query($query,$conexao) or die ("erro 3");
echo "<table border=1>";
echo "<tr><td>Nome do cliente</td>";
echo "<td>Título do anúncio</td>";
echo "<td>Validade</td>";
echo "<td>Ações</td></tr>";
while($linha=mysql_fetch_array($dados,MYSQL_ASSOC))
{
$id = $linha["IDANUNCIO"];
echo "<tr><td>" . $linha["NOMECLIENTE"] . "</td>" ;
echo "<td>" . $linha["NOMEANUNCIO"] . "</td>" ;
echo "<td>" . $linha["VALIDADE"] . "</td>" ;
echo "<td><a href='excluir.php?id=$id' style='text-decoration:none'>Excluir </a>";
echo "<a href='editar.php?id=$id' style='text-decoration:none'>Editar</a></td></tr>";
}
echo "</table>";
echo "<center><a href='http://www.cafeonline.sj.ifsc.edu.br/cadastro'>Incluir novo anúncio</a></center>";
mysql_close($conexao) or die ("erro 5");
}
header("Content-Type: text/html; charset=ISO-8859-1", true);
?>
</td><td>
<img src="800x600.gif" border="0" width="600" height="400" align="right"></td></tr></table>
</body>
</html>
Editando e atualizando os anúncios
- Depois de selecionado um anúncio na página de listagem o admin é direcionado para a página de edição de anúncios. E então são mostrados os dados que já estão cadastrados do anúncio selecionado, podendo alterar o que desejar e depois apertando no botão gravar que é direcionado para a página onde será feita a atualização do banco de dados.
Segue o código da página de edição de anúncios (editar.php):
<html>
<head>
<meta http-equiv="content-Type" content="text/html; charset=iso-8859-1" />
<title> Caf&eacte; online </title>
</head>
<body bgcolor="000000" text="FFFFFF">
<h1>Editar anúncio </h1>
<?
$id = $_GET['id'];
$conexao = mysql_connect("localhost","root","cafeonline") ;
mysql_select_db("cafeonline") or die ("erro 1");
$query = ("select * from anuncio where IDANUNCIO=$id");
$dados = mysql_query($query,$conexao);
$linha=mysql_fetch_array($dados,MYSQL_ASSOC);
mysql_query($linha);
header("Content-Type: text/html; charset=ISO-8859-1", true);
?>
<form name="formTeste" action="add2.php?id=<? echo $id ?>" method="post">
<table>
<tr>
<td>
<p> Título: <br>
<input type:"text" name="titulo" value="<? echo $linha['NOMEANUNCIO'] ?>">
<p> Nome do cliente: <br>
<input type:"text" name="nome" value="<? echo $linha['NOMECLIENTE'] ?>">
<p> Anúncio: <br>
<textarea rows="2" cols="20" name="texto"><? echo $linha['TEXTO'] ?></textarea>
<p> Link: <br>
<input type:"text" name="link" value="<? echo $linha['LINK'] ?>">
<p> Expira em: <br>
<input type:"text"name="validade" value="<? echo $linha['VALIDADE'] ?>">
<p> Expirado:
<input type=checkbox>
<input type="submit" name="b_enviar" value="Gravar"><BR>
</td>
<td>
<img src="800x600.gif" border="0" width="600" height="400">
</td>
</tr>
</body>
</html>
- Código onde é feita a atualização do banco de dados (add2.php):
<html>
<head>
<meta http-equiv="content-Type" content="text/html; charset=iso-8859-1" />
</head>
<body bgcolor="000000" text="FFFFFF">
<?
$conexao = mysql_connect("localhost","root","cafeonline") ;
$base_ok = mysql_select_db("cafeonline",$conexao);
$id = $_GET['id'];
$titulo=$_POST['titulo'] ;
$nome=$_POST['nome'] ;
$texto=$_POST['texto'] ;
$link=$_POST['link'] ;
$validade=$_POST['validade'] ;
if (!empty ($titulo) && !empty ($nome) && !empty ($texto) && !empty ($link) && !empty ($validade))
{
$update=mysql_query("UPDATE anuncio SET NOMECLIENTE='$nome', NOMEANUNCIO='$titulo', TEXTO='$texto', LINK='$link', VALIDADE='$validade' WHERE IDANUNCIO='$id'");
if($update==true)
{
echo "<h2>Dados atualizados com sucesso <br></h2>";
echo "<a href='http://www.cafeonline.sj.ifsc.edu.br/listar>Ir para lista de anúncios</a>";
}else{
echo "Erro ao Atualizar";
"<a href='http://www.cafeonline.sj.ifsc.edu.br/listar>Ir para lista de anúncios</a>";
}
}else{
echo "<h2>Erro, campos vazios<br></h2>";
echo "<a href='http://www.cafeonline.sj.ifsc.edu.br/listar'>Voltar para lista de anúncios</a>";
}
header("Content-Type: text/html; charset=ISO-8859-1", true);
?>
</body>
</html>
Excluindo anúncios
Segue o código da página para exclusão de anúncios (excluir.php):
<html>
<head><meta http-equiv="content-Type" content="text/html; charset=iso-8859-1" /></head>
<body bgcolor="000000" text="FFFFFF">
<?
$conexao = mysql_connect("localhost","root","cafeonline") ;
$base_ok = mysql_select_db("cafeonline",$conexao) or die ("erro 1");
$id=$_GET["id"];
$query = mysql_query("delete from anuncio where IDANUNCIO='$id'");
mysql_query($query);
if ($query==true)
{
echo "<h2>Anúncio exlcluido<br></h2>";
echo "<a href='http://www.cafeonline.sj.ifsc.edu.br/listar>Voltar para lista de anúncios</a>";
}else{
echo "Erro ao excluir anúncio";
echo "<a href='http://www.cafeonline.sj.ifsc.edu.br/listar>Voltar para lista de anúncios</a>";
}
header("Content-Type: text/html; charset=ISO-8859-1", true);
?>
</body>
</html>