Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Por favor ajudem, quero saber como faço para exibir as fotos de uma determinada pasta;
ai vai
banco de dados
CREATE TABLE `eventos` (
`id` int(11) NOT NULL auto_increment,
`nome` text NOT NULL,
`local` text NOT NULL,
`data` text NOT NULL,
`foto01` text NOT NULL,
`pasta` text NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=0 ;
conectdb.php
<? $conexao = mysql_connect ("localhost","login","senha") OR die (mysql_error()); // Conectando a
mysql_select_db ("banco") OR die (mysql_error()); // Conectando em uma base de dados
?>
cadastrar.php
<? include("verifica.php")?>
<STYLE type="text/css">
<!--
body, p, td {font-size: 8pt; font-family: Verdana; color: #FFFFFF}
A:link{color:FFFFFF;text-decoration:none}
A:visited{color:FFFFFF;text-decoration:none}
-->
</STYLE>
<style fprolloverstyle>A:hover {color: #FFFFFF; text-decoration: underline}</style>
<body bgcolor="#333333">
<form action="cadastrar_db.php" method="post" enctype="multipart/form-data">
<div align="center" class="style6"></div>
<table width="512" border="0" align="center" cellpadding="5" cellspacing="1">
<tr>
<th width="206" align="right" scope="col"><div align="right">
<font size="1">Nome:</font></div></th>
<th width="392" scope="col"><div align="left">
<input name="nome" type="text" id="nome" />
</div></th>
</tr>
<tr>
<th align="right" scope="col"> <font size="1">Pasta de destino:</font></th>
<th scope="col"><div align="left">
<input name="nomedapasta" type="text" id="nomedapasta" />
</div></th>
</tr>
<tr>
<th align="right" scope="col"><div align="right"><font size="1">Foto Destaque:</font></div></th>
<th scope="col">
<div align="left">
<input name="foto01" type="file" id="foto01" style="style2" />
</div></th></tr>
<tr>
<th align="right" scope="col"><font size="1">Local:</font></th>
<th align="left" scope="col"><input name="local" type="text" id="local" /></th>
</tr>
<tr>
<th align="right" valign="top" scope="col"><div align="right"> <font size="1">Data:</font> </div>
</th>
<th align="left" scope="col"><div align="left">
<input name="data" value="<? echo date("d/m/Y")?>" type="text" id="data" />
</div>
</th>
</tr>
<tr>
<th scope="col"> </th>
<th scope="col"><div align="left">
<input type="submit" name="Submit" value="Cadastrar" />
</div></th>
</tr>
</table>
</form>
cadastrar_db.php
<? include("verifica.php")?>
<? include("conectdb.php")?>
<style type="text/css">
<!--
body {
background-image: url();
}
-->
</style><?
// inicia criação de pasta
if($nomedapasta != ""){
$pasta = @mkdir("eventos/$nomedapasta", 0777);
}
// fim da criação da pasta
// inicia a função para enviar a foto
if($pasta == "$nomedapasta" AND $foto01 != ""){
if (copy($foto01,"eventos/$nomedapasta/".$foto01_name)){}else{
echo ("<BR><div align='center'><font face='$fonte' size='$tamanhofonte'><b>Erro no enviar a foto!</b></font></div><BR>");
}
}
// termina a função para enviar a foto
//conecta no banco
$pasta = $_POST['pasta'];
$id = $_POST['id'];
$nome = $_POST['nome'];
$local = $_POST['local'];
$data = $_POST['data'];
$foto01 = $_POST['foto01'];
$query = "INSERT INTO eventos (nome, local, data, pasta, foto01) VALUES ('$nome','$local','$data','$nomedapasta','$foto01_name')";
mysql_query($query) or die (mysql_error());?>
<? echo "<center><font size='3'>Cadastrado com sucesso";
?>
ver.php
<? include("verifica.php")?>
<style type="text/css">
<!--
.style1 {font-family: Verdana, Arial, Helvetica, sans-serif}
a {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
font-weight: bold;
}
a:link {
color: #FFFFFF;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #FFFFFF;
}
a:hover {
text-decoration: underline;
color: #FFFF00;
}
a:active {
text-decoration: none;
}
body,td,th {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
color: #000000;
}
.style3 {color: #000000}
-->
</style>
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td bgcolor="#CCCCCC"><div align="center" class="style1"></div></td>
</tr>
</table>
<?
require ("conectdb.php");
$sql = "SELECT * FROM eventos ORDER BY id DESC";
$limite = mysql_query("$sql");
while ($sql = mysql_fetch_array ($limite) ) {
$pasta = $sql['pasta'];
$id = $sql['id'];
$nome = $sql['nome'];
$local = $sql['local'];
$data = $sql['data'];
$foto01 = $sql['foto01'];
?>
<style type="text/css">
<!--
.style1 {
font-size: 18px;
font-weight: bold;
}
body,td,th {
font-family: Arial, Helvetica, sans-serif;
}
-->
</style>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<th scope="col"><table width="100%" border="0" align="center" cellpadding="5" cellspacing="0">
<tr>
<th width="74" scope="col"><img src="eventos/<? echo"$pasta";?>/<? echo"$foto01";?>" width='120' height="90" border="2" bordercolor='#FF6600'/></th>
<th width="1026" align="left" valign="top" scope="col"><table width="100%" border="0" cellpadding="0" cellspacing="5">
<tr>
<th scope="col"><div align="left">Nome: <?php echo $sql['nome'] ?></span></div></th>
</tr>
<tr>
<th scope="col"><div align="left">Local: <?php echo $sql['local'] ?></div></th>
</tr>
<tr>
<th scope="col"><div align="left">Data: <span class="style3"><?php echo $sql['data'] ?></a></span></div></th>
</tr>
</table> </th>
<th width="101" align="left" valign="top" scope="col"> </th>
</tr>
<tr>
<th height="24" scope="col"> </th>
<th align="left" valign="top" scope="col"> </th>
<th align="center" valign="top" bgcolor="#333333" scope="col"><a href="album.php?<? echo"id=$id";?>">Ver fotos</a></th>
</tr>
</table>
</th>
</tr>
</table>
<hr width="95%" color="#CCCCCC" />
<? } ?>
no caso agora faltaria criar a página album.php, e o script que faça exibir as fotos, eu queria que as fotos exibissem tipo esse album http://www.baladasdailha.com.br/eventos_popup.php?id_evento=1315.
Abraço.
Carregando comentários...