Alguem pode dar uma moral ??
Flw!
[codebox]<?
require("../include/pre.php");
//require("localSettings.php");
require("../include/connect.php");
function delete_file($name)
{
if (file_exists($name))
unlink($name);
}
$imagem= $_GET['img'];
if ($_GET['op'] == '3') { delete_file($imagem); header('Location:album.php?id='. $_GET['id'] .'&refresh='. uniqid("")); $del = mysql_query("DELETE FROM `fotos` WHERE `Id`=" . $_GET['idf'] . "");}
if ($_GET['send']=='1')
{
//session_start();
$filename = "../upload2/" . uniqid("").".jpg";
$var .= rand(2000, 7355);
$var .= date("m");
$var .= rand(10, 275);
$ext = strrchr($HTTP_POST_FILES["file"]["name"], '.');
move_uploaded_file($HTTP_POST_FILES["file"]["tmp_name"], $filename);
$rs= mysql_query("INSERT INTO fotos(`id`, `user`, `imagem`, `comentario`) values('$var', '" . $_GET['id'] ."','$filename','" . htmlentities($_POST['comentario']) . "')",$db);
header('Location:album.php?id='. $_GET['id'] .'&refresh='. uniqid(""));
die();
}
draw_top($topic_message); //starts drawing the page
?>
<table width=100% cellpadding="0" cellspacing="0">
<tr>
<td align="center" valign="top" width="100%">
<?
draw_frame_top("Album de Foto");
?>
<link rel="stylesheet" href="css/lightbox.css" type="text/css" media="screen" />
<script src="js/prototype.js" type="text/javascript"></script>
<script src="js/scriptaculous.js?load=effects" type="text/javascript"></script>
<script src="js/lightbox.js" type="text/javascript"></script>
<table width="100%">
<form method="post" action="album.php?send=1<? if (strlen($_GET['id'])>0) echo ('&id='. $_GET['id']) ?>" enctype="multipart/form-data">
<tr>
<td width="15%" valign="top">
<table width=100% cellspacing=0 cellpadding=0>
<tr>
<td align="center"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="27"><img src="../img/Untitled-7_r1_c1.jpg" width="27" height="21" /></td>
<td width="355" align="center" background="../img/Untitled-1_r1_c2.jpg"> </td>
<td width="27"><img src="../img/Untitled-1_r1_c3.jpg" width="27" height="21" /></td>
</tr>
</table></td>
</tr>
<tr>
<td align="center"><table width="100%" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<td align="center" bgcolor="#F6F6F6"><?
draw_user_sidebar();
?></td>
</tr>
</table></td>
</tr>
<tr>
<td align="center"><table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="27"><img src="../img/Untitled-2_r1_c1.jpg" width="27" height="21" /></td>
<td width="355" align="center" background="../img/Untitled-2_r1_c2.jpg"> </td>
<td width="27"><img src="../img/Untitled-2_r1_c3.jpg" width="27" height="21" /></td>
</tr>
</table></td>
</tr>
</table>
</td>
<td width="85%" valign="top">
<table width="75%" border="0">
<tr>
<? $quant =0; $rsfoto = mysql_query("SELECT * FROM fotos WHERE user=" . $_GET['id'] . " order by id");
$cont = 0;
while($row = mysql_fetch_array($rsfoto)) {
$quant=$quant+1;
if ($cont == 3) { echo "<tr>";} echo "<td>"; echo "<center>"; echo "<a href='" . $row['imagem'] . "' rel=lightbox' class'menu_link'><img src='" . $row['imagem'] ."' width='120' height='100'border= 0 ></a>"; echo "<br>"; echo $row['comentario']; echo "<br>";
if($_GET['id']==$_SESSION['id']) { echo "<a href='album.php?op=3&img=" . $row['imagem'] ."&id=" . $_GET['id'] ."&idf=" . $row['Id'] ."'>Excluir Imagem</a>"; }
echo"</center>";echo "</td>"; $cont=$cont+1; if ($cont==3) { echo "</tr>"; $cont==0; }
} ?>
</tr>
</table>
<p>
<? if ($quant < 6) {
draw_small_frame_top((strlen($_GET['cm'])>0 ? "Album de Foto" :"Foto do Usuário"), "mini_smile");
echo "<p>";echo"</p>";
if($_GET['id']==$_SESSION['id']) {
echo "<table width='100%'>"
."<tr>"
."<td width='10%' valign='top' align='right'> <b>Arquivo:</b><br>"
."</td>"
."<td width='90%'> <input type='file' name='file' size=30> </td>"
."</tr>"
."<tr>"
."<td valign='top'><strong>Comentário:</strong></td>"
."<td align='left'><input name='comentario' type='text' id='comentario' size='25' maxlength='25'></td>"
."</tr>"
."<tr>"
."<td></td>"
."<td align='left'> <input type='submit' value='Enviar Figura'>"
."</td>"
."</tr>"
."</table>"
."<br>"
."<table width='80%' align='center' bgcolor='#FFFFCC' style='border: 1px solid #bbbbbb'>"
."<tr>"
."<td align='center'><strong>Importante</strong>: Somente arquivos menores que 300kb serão permitidos. Caso apresente
erro no upload tente usar <strong>CTRL + F5</strong> </td>"
."</tr>"
."</table>";
}
else { echo"Você não pode enviar fotos para o álbum deste usuário!"; }
} ?> </p>
<p>
<?
draw_small_frame_bottom();
?>
</p>
<p> </p></td>
</tr>
</form>
</table>
<?
draw_frame_bottom();
?>
</td>
</tr>
</table>
<?
draw_bottom();
?>[/codebox]
Edição feita por: savior, 07/10/2007, 01:47.
Utilize tags [codebox] para trechos longos de código!