Ir para conteúdo
Fórum Script Brasil

RogerGames

Membros
  • Total de itens

    7
  • Registro em

  • Última visita

Sobre RogerGames

RogerGames's Achievements

0

Reputação

  1. Galera é o seguinte, queria saber como faço para recontar os ids cadastrados no bd, isto é, organizar, como postei um problema uma vez se eu posto uma noticia e insiro nela fotos o id das fotos não acompanha o da noticia, isto é, nem todas as noticias tem fotos extras, ai o script não pega o id certo da noticia, isto é, eu posto a noticia e o id é 120, como so tinha postado por exemplo 10 noticias com fotos o id da parte ''outras fotos'' , fica sendo 11 enves de ser o mesmo da noticia, isto é 120 no caso exemplo ... Vou deixar em code o script que puxa essas ''outras fotos'' para analisarem, qualquer ideia é bem vinda ! <font size='6' color='#1E4B7A' face="Trebuchet MS, Verdana">Outras Fotos</font><br /><br /> <? $dados2 = mysql_fetch_array(mysql_query("SELECT * FROM $tabela2 WHERE id='$id'")); if($acao == colunista){ $wh1 = "WHERE id_cat = '$dados2[noticias]'"; } else { $wh1 = "WHERE id = '$id'"; } $busca = "SELECT * FROM $tabela1 $wh1 ORDER BY data desc"; //echo "$busca<br>"; $sql = mysql_query($busca); $total = mysql_num_rows($sql); $dados = mysql_fetch_array($sql); $id3 = substr($id,0, 2); if($acao == colunista){ $dir = "images/colunas/$dados[id]/"; } else { $dir = "images/noticias/$id3/"; } //echo $dir; //$dir = "images/$tabela1/substr($id,0, 2)/"; $dirhandle = opendir($dir); $fotos = array(); while ($file = readdir($dirhandle)) { $files = $file; $arr_basename=explode(".",$files); $file_type=strtolower("$arr_basename[1]"); if ($file_type == "jpg"){ $fotos[] = $files; } } closedir($dirhandle); sort($fotos); for($i=0;$i<count($fotos);$i++){ // para exibir em ordem alfabética //for ($i=count($fotos);$i>0;$i--){ // para exibir em ordem alfabética inversa echo "<a href='/$dir$fotos[$i]' class='mb'>"; echo "<img style='border:1px solid $corcelula1' onmouseover='makevisible(this,0)' onmouseout='makevisible(this,1)' src='/thumbs.php?w=$largura&h=$altura&imagem=$dir$fotos[$i]' border='0' alt='$dados[descricao]' style='FILTER: alpha(opacity=100);'>"; echo "</a> "; } } } // FIM DA ACAO DE FOTOS EXTRAS ?> <? // INICIO DA ACAO DE OUTRAS if($outras == "S"){ ?> <br /> <br /> <img src="/images/layout/img_outras.png"><br /> <? if(!empty($id)){ $wh = "AND id_cat = '$dados[id_cat]' ORDER BY data DESC"; } else { $wh = "ORDER BY data DESC"; } $busca2 = "SELECT * FROM $tabela1 WHERE status='S' AND id_cat='$idcat' $wh"; //echo $busca2; $sql2 = mysql_query($busca2); //echo $sql2; ?> <table width="99%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr><td height="4"></td></tr> <? while($dados2 = mysql_fetch_array($sql2)){?> <tr> <td> <? $dh = explode(" ", $dados2[data]); $data = explode("-", $dh[0]); $data1 = "$data[2]/$data[1]/$data[0]"; $hora = explode(":", $dh[1]); $hora1 = "$hora[0]h$hora[1]"; $data = "$data1"; echo "<a href='?pg=$link_page&id=$dados2[id]'>"; echo "<font class='noticias_outrasdata'>$data</font> - <font class='noticias_outras'><b>$dados2[titulo]</b></font>"; echo "</a>"; ?> </td> </tr> <tr><td height="1" bgcolor="<?=$corcelula2?>"></td></tr> <tr><td height="5"></td></tr> <? }?> </table> <? } // FIM DA ACAO DE OUTRAS
  2. Galera o script não está carregando todas as imagens, isto é, eu carrego o site e o navegador termina de carregar, porem algumas imagens não carregam, só que, quando clico com o botão direito nelas e clico em carregar elas carregam, isto é, não é problema em permissão nem em a imagem não estar onde deveria, o link da imagem é assim " thumbs.php?w=65&h=55&imagem=images/noticias/122/gilbomba.jpg ", acho que poderia ser um problema no arquivo php-cgi.ini ou neste thumbs.php, agradeço qualquer ideia, vou deixar o codigo do THUMBS.php aqui para analisarem ... <? header("Content-type: image/jpeg"); $im = imagecreatefromjpeg($_GET['imagem']); // Cria uma nova imagem a partir de um arquivo ou URL $wid = (int)$_GET["w"]; $hei = (int)$_GET["h"]; $w = imagesx($im); $h = imagesy($im); $w1 = $w / $wid; if ($hei == 0) { $h1 = $w1; $hei = $h / $w1; } else { $h1 = $h / $hei; } // echo "$h1 - $w1"; $min = min($w1,$h1); $xt = $min * $wid; $x1 = ($w - $xt) / 2; $x2 = $w - $x1; $yt = $min * $hei; $y1 = ($h - $yt) / 2; $y2 = $h - $y1; $x1 = (int) $x1; $x2 = (int) $x2; $y1 = (int) $y1; $y2 = (int) $y2; $img = NULL; $img = imagecreatetruecolor($wid, $hei); //$background = imagecolorallocate($img, 50, 50, 50); imagecolorallocate($img,255,255,255); $c = imagecolorallocate($img,255,255,255); $c1 = imagecolorallocate($img,0,0,0); for ($i=0;$i<=$hei;$i++) { imageline($img,0,$i,$wid,$i,$c); } imagecopyresampled($img,$im,0,0,$x1,$y1,$wid,$hei,$x2-$x1,$y2-$y1); imagejpeg($img, '', 95) ?> Segue abaixo uma imagem para entenderem melhor o problema, outra coisa, ele ''não carrega'' aleatoriamente, cada hora e uma miniatura hehe.
  3. arquivo exibe.php ( este e arquivo que puxa as news, nele tem um codigo tambem das fotos extras PS, o script funciona, so não linca pra pasta certa como expliquei, se eu pego e crio a pasta com o id certo manualmente e jogo as fotos la elas carregam, não tem como criar toda hora a pasta manual não é? ... <? $variables=(strtolower($_SERVER['REQUEST_METHOD'])== 'GET') ? $_GET : $_POST; foreach ($variables as $k=> $v) $$k=$v; $tabela1 = "tb_noticias"; $tabela2 = "tb_users"; $file = "$tabela1"; // INICIO DA ACAO DE EXIBIR if($acao == "ver"){ $id = $_GET[id]; if($id=='') $id = $url_parts[1]; $busca = "SELECT * FROM $tabela1 WHERE id='$id'"; //echo $busca; $sql = mysql_query($busca); //echo $sql; $dados = mysql_fetch_array($sql); $dh = explode(" ", $dados[data]); $data = explode("-", $dh[0]); $data1 = "$data[2]/$data[1]/$data[0]"; $hora = explode(":", $dh[1]); $hora1 = "$hora[0]h$hora[1]"; $dh2 = explode(" ", $dados[data2]); $data2 = explode("-", $dh2[0]); $data2 = "$data2[2]/$data2[1]/$data2[0]"; $hora2 = explode(":", $dh2[1]); $hora2 = "$hora2[0]h$hora2[1]"; $data = "Postado em: $data1 à s $hora1"; $sql2 = "SELECT * FROM $tabela2 WHERE id='$dados[id_user]'"; $dados2 = mysql_fetch_array(mysql_query($sql2)); ?> <script>var fontSize = <?=$tfonte?>;</script> <table width='620px' border='0' cellpadding='2' cellspacing="0"> <tr> <td><img src="/images/setona.jpg" width="30" height="30" /> <? $sql5 = mysql_query("SELECT * FROM tb_noticias_cat WHERE id='$dados[id_cat]'"); $dados5=mysql_fetch_array($sql5); ?> <? echo "<div class='exibecategoria'>$dados5[nome]</div>"; ?> </td> </tr> <tr> <td style="border-bottom:1px solid <?=$corcelula2?>;"><font size="2" color="#666666" face="Trebuchet MS, Verdana"><i><?=$data?></i></font></td> </tr> <tr><td style="border-bottom:1px solid <?=$corcelula2?>;"><table width="100%" border="0" cellpadding="0" cellspacing="1"> <tr> <td width="35%" align="right"><table width="219" border="0" cellpadding="0" cellspacing="0"> <tr> <td align="right"><font size="4" color="#000000" face="Trebuchet MS, Verdana">TAMANHO DA FONTE&nbsp; </font></td> <td width="3"></td> <td width="18" height="18" align="center" valign="middle" bgcolor="<?=$corcelula2?>" style="border:1px solid <?=$corcelula1?>;"><A href="java script:diminuir('mudaFonte')"><font size="3" color="#000000" face="Trebuchet MS, Verdana">A-</font></A></td> <td width="3"></td> <td width="18" height="18" align="center" valign="middle" bgcolor="<?=$corcelula2?>" style="border:1px solid <?=$corcelula1?>;"><A href="java script:aumentar('mudaFonte')"><font size="3" color="#000000" face="Trebuchet MS, Verdana">A+</font></A></td> </tr> </table></td> </tr> </table></td> </tr> <tr> <td class="titulos_noticias"><?=nl2br($dados['titulo']);?></td> </tr> <? if($dados[subtitulo] != ""){?> <tr> <td class="subtitulos_noticias"><i><? echo $dados['subtitulo']?></i></td> </tr> <? }?> <tr> <td valign="top"> <br /> <div id="mudaFonte"> <? if(!empty($dados[foto])){ $alinhara = ($dados[alinhamento_foto]=="R")?"right":"left"; $larguraG = ($dados[largura_foto]=="")?"250":"$dados[largura_foto]"; $alturaG = ($dados[altura_foto]=="")?"h=":"h=$dados[altura_foto]"; echo "<a href='/thumbs.php?w=$LarguraFoto&imagem=images/noticias/$dados[id]/$dados[foto]' rel='lightbox' title='$dados[titulo]'>"; echo "<img src='/thumbs.php?w=$larguraG&$alturaG&imagem=images/noticias/$dados[id]/$dados[foto]' align='$alinhara' border='0'>"; echo "</a>"; } $texto1 = "$dados[texto]"; $texto2 = str_replace('<font face="Trebuchet MS" size="2">', "", "$texto1"); $texto3 = str_replace('</font>', "", "$texto2"); echo $texto3; echo "<br><i>$dados[creditos_fotos]</i>"; ?> </div> </td> </tr> </table> <br /> <? // INICIO DOS BOTOES IMPRIMIR, INDICAR if(empty($imprimir)){ include "paginas/imprimir.php"; } // FIM DOS BOTOES IMPRIMIR, INDICAR ?> <? } // FIM DA ACAO DE EXIBIR ?> <? if($acao == "ultimas"){ $wh2 = "AND id_cat = '$id2'"; $busca = "SELECT * FROM tb_noticias WHERE status ='S' $wh2 ORDER by id desc LIMIT 10"; //echo $busca; $sql = mysql_query($busca); //echo $sql; $total = mysql_num_rows($sql); //echo $total; if($total > 0){ ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr><td height="4"></td></tr> <? while($dados = mysql_fetch_array($sql)){?> <tr> <td align="right"> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td align="right"> <? $wh2 = "AND id_cat = '$id2'"; $busca2 = "SELECT * FROM tb_noticias WHERE status ='S' $wh2 ORDER by id desc"; //echo $busca2; $sql2 = mysql_query($busca2); //echo $sql2; $dados2 = mysql_fetch_array($sql2); echo "<a href='?pg=$link_page&id=$dados2[id]'>"; $contatamanho = strlen($dados2[titulo]); if($contatamanho > $qt_letras){ $titulo = substr_replace($dados2[titulo], "...", $qt_letras, $contatamanho - $qt_letras); } else { $titulo = "$dados2[titulo]"; } echo $titulo; echo "</a>"; ?> </td> <td width="55" align="right"></td> </tr> </table> </td> </tr> <tr><td height="5"></td></tr> <? }?> </table> <? } else {?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"><br /> nenhum <b>registro</b> encontrado!<br /> <br /></td> </tr> </table> <? }?> <? }?> <? // INICIO DA ACAO DE FOTOS EXTRAS if($fotos == "S"){ if($dados[fotos_extras] == "S"){ ?> <br /><br /> <br /> <img src="/images/setona.jpg" width="30" height="30" /><font size='6' color='#1E4B7A' face="Trebuchet MS, Verdana">Outras Fotos</font><br /><br /> <? $dados2 = mysql_fetch_array(mysql_query("SELECT * FROM $tabela2 WHERE id='$id'")); if($acao == colunista){ $wh1 = "WHERE id_cat = '$dados2[noticias]'"; } else { $wh1 = "WHERE id = '$id'"; } $busca = "SELECT * FROM $tabela1 $wh1 ORDER BY data desc"; //echo "$busca<br>"; $sql = mysql_query($busca); $total = mysql_num_rows($sql); $dados = mysql_fetch_array($sql); $id3 = substr($id,0, 2); if($acao == colunista){ $dir = "images/colunas/$dados[id]/"; } else { $dir = "images/noticias/$id3/"; } //echo $dir; //$dir = "images/$tabela1/substr($id,0, 2)/"; $dirhandle = opendir($dir); $fotos = array(); while ($file = readdir($dirhandle)) { $files = $file; $arr_basename=explode(".",$files); $file_type=strtolower("$arr_basename[1]"); if ($file_type == "jpg"){ $fotos[] = $files; } } closedir($dirhandle); sort($fotos); for($i=0;$i<count($fotos);$i++){ // para exibir em ordem alfabética //for ($i=count($fotos);$i>0;$i--){ // para exibir em ordem alfabética inversa echo "<a href='/$dir$fotos[$i]' class='mb'>"; echo "<img style='border:1px solid $corcelula1' onmouseover='makevisible(this,0)' onmouseout='makevisible(this,1)' src='/thumbs.php?w=$largura&h=$altura&imagem=$dir$fotos[$i]' border='0' alt='$dados[descricao]' style='FILTER: alpha(opacity=100);'>"; echo "</a> "; } } } // FIM DA ACAO DE FOTOS EXTRAS ?> <? // INICIO DA ACAO DE OUTRAS if($outras == "S"){ ?> <br /> <br /> <img src="/images/layout/img_outras.png"><br /> <? if(!empty($id)){ $wh = "AND id_cat = '$dados[id_cat]' ORDER BY data DESC"; } else { $wh = "ORDER BY data DESC"; } $busca2 = "SELECT * FROM $tabela1 WHERE status='S' AND id_cat='$idcat' $wh"; //echo $busca2; $sql2 = mysql_query($busca2); //echo $sql2; ?> <table width="99%" border="0" align="center" cellpadding="0" cellspacing="0"> <tr><td height="4"></td></tr> <? while($dados2 = mysql_fetch_array($sql2)){?> <tr> <td> <? $dh = explode(" ", $dados2[data]); $data = explode("-", $dh[0]); $data1 = "$data[2]/$data[1]/$data[0]"; $hora = explode(":", $dh[1]); $hora1 = "$hora[0]h$hora[1]"; $data = "$data1"; echo "<a href='?pg=$link_page&id=$dados2[id]'>"; echo "<font class='noticias_outrasdata'>$data</font> - <font class='noticias_outras'><b>$dados2[titulo]</b></font>"; echo "</a>"; ?> </td> </tr> <tr><td height="1" bgcolor="<?=$corcelula2?>"></td></tr> <tr><td height="5"></td></tr> <? }?> </table> <? } // FIM DA ACAO DE OUTRAS // INICIO DA ACAO VER IMOVEIS DA IMOB if($acao == "ultimas_noticia"){ $busca = "SELECT * FROM $tabela1 WHERE status='S' AND prioridade='1' $ordem"; //echo $busca; if($paginacao == "S"){ $total_reg = $qts_ultimos; if(!$page){ $page = "1"; } $inicio = $page-1; $inicio = $inicio*$total_reg; $limite = mysql_query("$busca LIMIT $inicio,$total_reg"); } else { if(!empty($limite2)) $limitede = "LIMIT 2"; $limite = mysql_query("$busca $limitede"); } $todos = mysql_query("$busca"); $tr = mysql_num_rows($todos); $tp = @ceil($tr / $total_reg); if($tr > 0){ ?> <table border="0" cellpadding="1" cellspacing="0"> <? // Agora vamos montar o c&oacute;digo. Pegue o valor total de resultados: $total = mysql_num_rows($limite); // Defina o n&uacute;mero de colunas que voc&ecirc; deseja exibir: //$colunas = "3"; //$colunas = "$qts_colunas"; // Agora vamos ao "truque": if ($total>0) { for ($i = 0; $i < $total; $i++) { if (($i%$colunas)==0) { $colspan = $colunas+$colunas+$colunas; ?> <tr> <? }?> <? $dados = mysql_fetch_array($limite); ?> <td align="center" valign="top"><table width="240px" border="0" align="left" cellpadding="0" cellspacing="0"> <tr> <? if(!empty($dados[foto])){?> <td width="80px" height="<?=$altura+8;?>" align="left" valign="top"><table width="80px" border="0" align="left" cellpadding="1" cellspacing="1"> <tr> <td align="left" valign="top"><table border="0" cellspacing="0" cellpadding="0"> <tr> <td align="left" valign="top" bgcolor="#FFFFFF" width="80px"><a href='<?=$usite?><?="noticia/$dados[id]";?>-<?= str_replace(" ","_",$dados['titulo']); ?>.html' class="img_borda"><img src="<?="/thumbs.php?w=$largura&h=$altura&imagem=images/noticias/$dados[id]/$dados[foto]";?>" width="<?=$largura?>" height="<?=$altura?>" border="0"/></a></td> </tr> </table></td> </tr> </table></td> <? }?> <td width="155" align="left" valign="top"> <table width="90%" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="4px"></td> </tr> <tr> <td><? echo "<a id='links_not' href='/noticia/$dados[id]-".str_replace(" ","_",$dados['titulo']).".html'>"; echo strftime("%d de %B de %Y", strtotime($dados[data]))."<br>"; $contatamanho1 = strlen($dados[titulo]); if($contatamanho1 > $qt_letras1){ $titulo = substr_replace($dados[titulo], "...", $qt_letras1, $contatamanho1 - $qt_letras1); } else { $titulo = $dados[titulo]; } echo "<font id='links_not'>$titulo</font><br>"; echo "</a>"; ?></td> </tr> </table></td> </tr> <tr> <td height="1" colspan="<?=$colspan?>" bgcolor="<?=$corcelula2?>"></td> </tr> <tr> <td height="6"></td> </tr> </table></td> <? }?> </TR> <? }?> </table> <? } else {?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"><br /> nenhum <b>registro</b><b> </b>encontrado!<br /> <br /> </td> </tr> </table> <? } }// FIM DO ELSE ?> <? if($acao == "ultimas_noticia2"){ $busca = "SELECT * FROM $tabela1 WHERE status='S' and prioridade='1' $ordem"; //echo $busca; if($paginacao == "S"){ $total_reg = $qts_ultimos; if(!$page){ $page = "1"; } $inicio = $page-1; $inicio = $inicio*$total_reg; $limite = mysql_query("$busca LIMIT $inicio,$total_reg"); } else { if(!empty($limite2)) $limitede = "LIMIT 2,1"; $limite = mysql_query("$busca $limitede"); } $todos = mysql_query("$busca"); $tr = mysql_num_rows($todos); $tp = @ceil($tr / $total_reg); if($tr > 0){ ?> <table width="241" border="0" cellpadding="1" cellspacing="0"> <? // Agora vamos montar o c&oacute;digo. Pegue o valor total de resultados: $total = mysql_num_rows($limite); // Defina o n&uacute;mero de colunas que voc&ecirc; deseja exibir: //$colunas = "3"; //$colunas = "$qts_colunas"; // Agora vamos ao "truque": if ($total>0) { for ($i = 0; $i < $total; $i++) { if (($i%$colunas)==0) { $colspan = $colunas+$colunas+$colunas; ?> <tr> <? }?> <? $dados = mysql_fetch_array($limite); ?> <td align="center" valign="top" width="239"><table width="240" border="0" cellspacing="1" cellpadding="1"> <tr> <td width="17"><img src="/images/arrowbullet.png" width="12" height="12" /></td> <td width="208"><? echo "<a id='links_not' href='/noticia/$dados[id]-".str_replace(" ","_",$dados['titulo']).".html'>"; $contatamanho1 = strlen($dados[titulo]); if($contatamanho1 > $qt_letras1){ $titulo = substr_replace($dados[titulo], "...", $qt_letras1, $contatamanho1 - $qt_letras1); } else { $titulo = $dados[titulo]; } echo "$titulo<br>"; echo "</a>"; ?></td> </tr> </table></td> <? }?> </TR> <? }?> </table> <? } else {?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"><br /> nenhum <b>registro</b><b> </b>encontrado!<br /> <br /> </td> </tr> </table> <? } }// FIM DO ELSE ?> <? if($acao == "ultimas_noticia3"){ $busca = "SELECT * FROM $tabela1 WHERE status='S' and prioridade='1' $ordem"; //echo $busca; if($paginacao == "S"){ $total_reg = $qts_ultimos; if(!$page){ $page = "1"; } $inicio = $page-1; $inicio = $inicio*$total_reg; $limite = mysql_query("$busca LIMIT $inicio,$total_reg"); } else { if(!empty($limite2)) $limitede = "LIMIT 3,1"; $limite = mysql_query("$busca $limitede"); } $todos = mysql_query("$busca"); $tr = mysql_num_rows($todos); $tp = @ceil($tr / $total_reg); if($tr > 0){ ?> <table border="0" cellpadding="1" cellspacing="0"> <? // Agora vamos montar o c&oacute;digo. Pegue o valor total de resultados: $total = mysql_num_rows($limite); // Defina o n&uacute;mero de colunas que voc&ecirc; deseja exibir: //$colunas = "3"; //$colunas = "$qts_colunas"; // Agora vamos ao "truque": if ($total>0) { for ($i = 0; $i < $total; $i++) { if (($i%$colunas)==0) { $colspan = $colunas+$colunas+$colunas; ?> <tr> <? }?> <? $dados = mysql_fetch_array($limite); ?> <td align="center" valign="top"><table width="240" border="0" cellspacing="1" cellpadding="1"> <tr> <td width="17"><img src="/images/arrowbullet.png" width="12" height="12" /></td> <td width="208"><? echo "<a id='links_not' href='/noticia/$dados[id]-".str_replace(" ","_",$dados['titulo']).".html'>"; $contatamanho1 = strlen($dados[titulo]); if($contatamanho1 > $qt_letras1){ $titulo = substr_replace($dados[titulo], "...", $qt_letras1, $contatamanho1 - $qt_letras1); } else { $titulo = $dados[titulo]; } echo "$titulo<br>"; echo "</a>"; ?></td> </tr> </table></td> <? }?> </TR> <? }?> </table> <? } else {?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"><br /> nenhum <b>registro</b><b> </b>encontrado!<br /> <br /> </td> </tr> </table> <? } }// FIM DO ELSE ?> <? if($acao == "ultimas_noticia4"){ $busca = "SELECT * FROM $tabela1 WHERE status='S' and prioridade='1' $ordem"; //echo $busca; if($paginacao == "S"){ $total_reg = $qts_ultimos; if(!$page){ $page = "1"; } $inicio = $page-1; $inicio = $inicio*$total_reg; $limite = mysql_query("$busca LIMIT $inicio,$total_reg"); } else { if(!empty($limite2)) $limitede = "LIMIT 4,1"; $limite = mysql_query("$busca $limitede"); } $todos = mysql_query("$busca"); $tr = mysql_num_rows($todos); $tp = @ceil($tr / $total_reg); if($tr > 0){ ?> <table border="0" cellpadding="1" cellspacing="0"> <? // Agora vamos montar o c&oacute;digo. Pegue o valor total de resultados: $total = mysql_num_rows($limite); // Defina o n&uacute;mero de colunas que voc&ecirc; deseja exibir: //$colunas = "3"; //$colunas = "$qts_colunas"; // Agora vamos ao "truque": if ($total>0) { for ($i = 0; $i < $total; $i++) { if (($i%$colunas)==0) { $colspan = $colunas+$colunas+$colunas; ?> <tr> <? }?> <? $dados = mysql_fetch_array($limite); ?> <td align="center" valign="top"><table width="240" border="0" cellspacing="1" cellpadding="1"> <tr> <td width="17"><img src="/images/arrowbullet.png" width="12" height="12" /></td> <td width="216"><? echo "<a id='links_not' href='/noticia/$dados[id]-".str_replace(" ","_",$dados['titulo']).".html'>"; $contatamanho1 = strlen($dados[titulo]); if($contatamanho1 > $qt_letras1){ $titulo = substr_replace($dados[titulo], "...", $qt_letras1, $contatamanho1 - $qt_letras1); } else { $titulo = $dados[titulo]; } echo "$titulo<br>"; echo "</a>"; ?></td> </tr> </table></td> <? }?> </TR> <? }?> </table> <? } else {?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"><br /> nenhum <b>registro</b><b> </b>encontrado!<br /> <br /> </td> </tr> </table> <? } }// FIM DO ELSE ?> <? // INICIO DA ACAO VER ULTIMAS 3 if($acao == "ultimas_noticias"){ $dataHoje = date("Y-m-d H:i:s"); $wh1 = "AND data < '$dataHoje'"; // echo $wh1; if(!empty($idcat)){ $wh2 = "AND id_cat = '$idcat'"; } if(!empty($limite2)){ $limite3 = "LIMIT $limite2"; } $busca = "SELECT * FROM $tabela1 WHERE status='S' $wh1 $wh2 $ordem"; //echo $busca; if($paginacao == "S"){ $total_reg = $qts_ultimos; if(!$page){ $page = "1"; } $inicio = $page-1; $inicio = $inicio*$total_reg; $limite = mysql_query("$busca LIMIT $inicio,$total_reg"); } else { $limite = mysql_query("$busca $limite3"); } $todos = mysql_query("$busca"); $tr = mysql_num_rows($todos); $tp = @ceil($tr / $total_reg); if($tr > 0){ ?> <? if($VerRespostaBusca == "S"){?> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="20" style="border-bottom:2px solid <?=$Cor1?>;"><table width="100%" border="0" align="center" cellpadding="2" cellspacing="0"> <tr> <td>Sua pesquisa por: <font color="red" class="titulos"><b><?=$tag?></b></font> <br /> Encontrou <b><?=$tr;?></b> <?=($tr > 1)?"<b>ítens</b> que estão distribuídos":"<b>ítem</b> que está distribuído";?> em <b><?=ceil($tr/$qts_ultimos);?> <?=(ceil($tr/$qts_ultimos) > 1)?"páginas":"página";?></b></font>. </td> <td align="right">&nbsp;</td> </tr> </table></td> </tr> </table> <? }?> <table border="0" cellpadding="1" cellspacing="0"> <? // Agora vamos montar o c&oacute;digo. Pegue o valor total de resultados: $total = mysql_num_rows($limite); // Defina o n&uacute;mero de colunas que voc&ecirc; deseja exibir: //$colunas = "3"; //$colunas = "$qts_colunas"; // Agora vamos ao "truque": if ($total>0) { for ($i = 0; $i < $total; $i++) { if (($i%$colunas)==0) { $colspan = $colunas+$colunas+$colunas; ?> <tr> <? }?> <? $dados = mysql_fetch_array($limite); ?> <td align="center" valign="top"><table border="0" cellpadding="0" cellspacing="0"> <tr> <td width="<?=$largura_coluna?>" align="left" valign="middle" bgcolor="#F7F7F7" onmouseover="this.style.backgroundColor='#E4EAED';" onmouseout="this.style.backgroundColor='#F7F7F7';"> <table width="620" border="0" cellspacing="1" cellpadding="1"> <tr> <td width="90" valign="top"><? echo "<font class='noticias_outrasdata'>"; echo strftime("%d/%m/%Y", strtotime($dados[data]))."<br>"; echo "</font>";?></td> <td width="523"><? echo "<a href='/noticia/$dados[id]-".str_replace(" ","_",$dados['titulo']).".html'>"; $contatamanho1 = strlen($dados[titulo]); if($contatamanho1 > $qt_letras1){ $titulo = substr_replace($dados[titulo], "...", $qt_letras1, $contatamanho1 - $qt_letras1); } else { $titulo = $dados[titulo]; } echo "<font class='noticias_outras'>"; echo "$titulo"; echo "</font>"; echo "</a>"; ?></td> </tr> <tr> <td colspan="2" height="5px"></td> </tr> </table></td> </tr> </table></td> <? }?> </TR> <? }?> </table> <? // INICIO DA PAGINAÇÃO if($paginacao == "S"){ include "estrutura/paginacao.php"; } // FIM DA PAGINAÇÃO ?> <? } else {?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center" height="100">nenhum <b>registro</b><b> </b>encontrado!</td> </tr> </table> <? } }// FIM DO ELSE // INICIO DA ACAO VER IMOVEIS DA IMOB if($acao == "ultimas_esporte"){ $busca = "SELECT * FROM $tabela1 WHERE status='S' AND id_cat='11' $ordem"; //echo $busca; if($paginacao == "S"){ $total_reg = $qts_ultimos; if(!$page){ $page = "1"; } $inicio = $page-1; $inicio = $inicio*$total_reg; $limite = mysql_query("$busca LIMIT $inicio,$total_reg"); } else { if(!empty($limite2)) $limitede = "LIMIT 1"; $limite = mysql_query("$busca $limitede"); } $todos = mysql_query("$busca"); $tr = mysql_num_rows($todos); $tp = @ceil($tr / $total_reg); if($tr > 0){ ?> <table width="280" border="0" cellpadding="1" cellspacing="0"> <? // Agora vamos montar o c&oacute;digo. Pegue o valor total de resultados: $total = mysql_num_rows($limite); // Defina o n&uacute;mero de colunas que voc&ecirc; deseja exibir: //$colunas = "3"; //$colunas = "$qts_colunas"; // Agora vamos ao "truque": if ($total>0) { for ($i = 0; $i < $total; $i++) { if (($i%$colunas)==0) { $colspan = $colunas+$colunas+$colunas; ?> <tr> <? }?> <? $dados = mysql_fetch_array($limite); ?> <td width="278" align="center" valign="top"><table width="100%" border="0" cellspacing="1" cellpadding="1"> <tr> <td align="center"><a href='<?=$usite?><?="noticia/$dados[id]";?>-<?= str_replace(" ","_",$dados['titulo']); ?>.html' class="img_borda2"><img src="<?="/thumbs.php?w=$largura&h=$altura&imagem=images/noticias/$dados[id]/$dados[foto]";?>" width="<?=$largura?>" height="<?=$altura?>" border="0"/></a></td> </tr> <tr> <td height="8"></td> </tr> <tr> <td><? echo "<a id='links_not' href='/noticia/$dados[id]-".str_replace(" ","_",$dados['titulo']).".html'>"; echo strftime("%d de %B de %Y", strtotime($dados[data]))."<br>"; $contatamanho1 = strlen($dados[titulo]); if($contatamanho1 > $qt_letras1){ $titulo = substr_replace($dados[titulo], "...", $qt_letras1, $contatamanho1 - $qt_letras1); } else { $titulo = $dados[titulo]; } echo "<font id='links_not'>$titulo</font><br>"; echo "</a>"; ?></td> </tr> </table></td> <? }?> </TR> <? }?> </table> <? } else {?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"><br /> nenhum <b>registro</b><b> </b>encontrado!<br /> <br /> </td> </tr> </table> <? } }// FIM DO ELSE // INICIO DA ACAO VER IMOVEIS DA IMOB if($acao == "ultimas_2"){ $busca = "SELECT * FROM $tabela1 WHERE prioridade='0' and status='S' $ordem"; //echo $busca; if($paginacao == "S"){ $total_reg = $qts_ultimos; if(!$page){ $page = "1"; } $inicio = $page-1; $inicio = $inicio*$total_reg; $limite = mysql_query("$busca LIMIT $inicio,$total_reg"); } else { if(!empty($limite2)) $limitede = "LIMIT 4"; $limite = mysql_query("$busca $limitede"); } $todos = mysql_query("$busca"); $tr = mysql_num_rows($todos); $tp = @ceil($tr / $total_reg); if($tr > 0){ ?> <table width="321" border="0" cellpadding="1" cellspacing="0"> <? // Agora vamos montar o c&oacute;digo. Pegue o valor total de resultados: $total = mysql_num_rows($limite); // Defina o n&uacute;mero de colunas que voc&ecirc; deseja exibir: //$colunas = "3"; //$colunas = "$qts_colunas"; // Agora vamos ao "truque": if ($total>0) { for ($i = 0; $i < $total; $i++) { if (($i%$colunas)==0) { $colspan = $colunas+$colunas+$colunas; ?> <tr> <? }?> <? $dados = mysql_fetch_array($limite); ?> <td width="319" align="center" valign="top"><table width="320" border="0" align="left" cellpadding="0" cellspacing="0"> <tr> <? if(!empty($dados[foto])){?> <td width="91" height="<?=$altura+8;?>" align="left" valign="top"><table width="90px" border="0" align="left" cellpadding="1" cellspacing="1"> <tr> <td align="left" valign="top"><table border="0" cellspacing="0" cellpadding="0"> <tr> <td align="left" valign="top" bgcolor="#FFFFFF" width="90px"><a href='<?=$usite?><?="noticia/$dados[id]";?>-<?= str_replace(" ","_",$dados['titulo']); ?>.html' class="img_borda2"><img src="<?="/thumbs.php?w=$largura&h=$altura&imagem=images/noticias/$dados[id]/$dados[foto]";?>" width="<?=$largura?>" height="<?=$altura?>" border="0"/></a></td> </tr> </table></td> </tr> </table></td> <? }?> <td width="229" align="left" valign="top"><table width="98%" border="0" cellpadding="0" cellspacing="0"> <tr> <td height="4px"></td> </tr> <tr> <td> <? $dados2 = mysql_fetch_array(mysql_query("SELECT * FROM tb_noticias_cat WHERE id='$dados[id_cat]'")); ?> <? echo "<font size='2' color='#FF9900'><b>$dados2[nome]</b></font>";?> <? echo strftime("<font size='1'>%d de %B de %Y</font>", strtotime($dados[data]))."<br>"; echo "<a id='links_not' href='/noticia/$dados[id]-".str_replace(" ","_",$dados['titulo']).".html'>"; $contatamanho1 = strlen($dados[titulo]); if($contatamanho1 > $qt_letras1){ $titulo = substr_replace($dados[titulo], "...", $qt_letras1, $contatamanho1 - $qt_letras1); } else { $titulo = $dados[titulo]; } echo "<font id='links_not'>$titulo</font><br>"; echo "</a>"; ?></td> </tr> </table></td> </tr> <tr> <td height="1" colspan="<?=$colspan?>" bgcolor="<?=$corcelula2?>"></td> </tr> <tr> <td height="6"></td> </tr> </table></td> <? }?> </TR> <? }?> </table> <? } else {?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center"><br /> nenhum <b>registro</b><b> </b>encontrado!<br /> <br /> </td> </tr> </table> <? } }// FIM DO ELSE ?>
  4. Salve galera, tudo bom com vocês ? Estou com um problema em um script aqui, ao postar uma noticia dele e postar outras noticias ele puxa um id diferente do id atual da noticia, isto é, se o id da noitica e 100 ele envia as imagens certinho, cria a pasta no server certinho, mas na hora de registrar ele registra como outro id, isto é, noticia é id 100 e o id que o script puxa para a galeria de fotos é 12, queria que ele puxasse o mesmo id da noticia para poder funcionar corretamente, estou corrigindo varios bugs neste projeto e este me pegou agora, agradeço a ajuda de voces, deixarei em quote, codebox ta dando 404 os codigos principais ... Pasta do script Noticias/ arquivo ... SCRIPT 01 - noticias_fotos.php <? require "verifica.php";?> <? $variables=(strtolower($_SERVER['REQUEST_METHOD'])== 'GET') ? $_GET : $_POST; foreach ($variables as $k=> $v) $$k=$v; $palavra = "Notícias"; $tabela = "tb_noticias_fotos"; $file = "noticias_fotos"; // iniçio da acao INSERI NO BD if($acao== "send_file"){ $dir = "../images/noticias/$pasta"; //echo "$dir<br>"; $uploaddir = "$dir/"; //echo $uploaddir; // DESCOMPACTA OS ARQUIVOS $arquivo = $_FILES['fotos']['name']; // pega nome do arquivo $arquivotemp = $_FILES['fotos']['tmp_name']; // pega nome temporario do arquivo if(copy($arquivotemp,$uploaddir.$arquivo)){ // faz copia do arquivo zipado require_once('zip.lib.php'); //requer o arquivo, deve estar na mesma pasta $archive = new PclZip($uploaddir.$arquivo); $list = $archive->extract(PCLZIP_OPT_PATH, "$dir",PCLZIP_OPT_REMOVE_ALL_PATH); // extrai todos arquivos unlink($uploaddir.$arquivo); // exclui o arquivo zip mandado //echo "<strong>$arquivo</strong> enviado com sucesso!"; } // FIM DO DESCOMPACTA OS ARQUIVOS $mgs = "<b>$arquivo</b> Enviado com Sucesso!"; echo "<table border='0' align='center' cellpadding='0' cellspacing='0' style='border: 1px solid $corcelula1;'> <tr> <td width='400' bgcolor='$corcelula2' align='center' class='titulos'> $mgs</td> </tr> </table> <br> "; echo "<meta http-equiv='refresh' content='1;URL=?pg=$file&acao=verfotos&caminho=$dir'>"; } // fim da acao ENVIA ARQUIVO // iniçio da acao EXCLUIR SELECIONADOS if($acao == "excluir_selecionados"){ $dir = "../images/noticias"; $listas = implode("|", $listas); // echo "$planos<hr>"; $lista = explode("|", $listas); $total = count($lista); // echo $total; for($i=0; $i<$total; $i++){ $url = "$caminho/$lista[$i]"; unlink("$url"); //echo $url; } $mgs = "<b>Imagens </b>Excluídas com Sucesso!"; echo "<table border='0' align='center' cellpadding='0' cellspacing='0' style='border: 1px solid $corcelula1;'> <tr> <td width='400' bgcolor='$corcelula2' align='center' class='titulos'> $mgs</td> </tr> </table> <br> "; echo "<meta http-equiv='refresh' content='2;URL=?pg=$file&acao=verfotos&caminho=$caminho'>"; } // fim da acao EXCLUIR SELECIONADOS // iniçio da acao FORM DE CADASTRO E ALTERAR if(empty($acao) OR $acao == "FORM"){ $form1 = "FORMULARIO"; ?> &lt;script> function FrmSend(){ <?=$form1?>.btgravar.value='Aguarde...'; <?=$form1?>.submit(); <?=$form1?>.btgravar.disabled=true; return false; } function frmenviar(){ FrmSend(); } setTimeout('<?=$form1?>.fotos.focus();', 300); </script> <form action="?pg=<?=$file?>" method="post" name="<?=$form1?>" enctype="multipart/form-data"> <fieldset style="width:100%;"> <input name="acao" type="hidden" value="send_file"> <table width="99%" align="center" cellpadding="0" cellspacing="0"> <tr><td><font class="titulos">Envio de Fotos para <?="$palavra"; ?></font></td></tr> </table> <table width="99%" border="0" align="center" cellpadding="2" cellspacing="0"> <? if(empty($id)){?> <tr> <td valign="middle"><?=$palavra?>: <br /> <select name="pasta" class="input" onblur="this.className='input';" onfocus="this.className='inputon';"> <option selected>Selecione uma Notícia</option> <option>====================</option> <? $sql= mysql_query("SELECT * FROM noticias where fotos_extras='S' order by data desc"); while ($dados=mysql_fetch_array($sql)){ $dh=explode(" ",$dados[data]); $data=explode("-",$dh[0]); echo "<option value=$dados[id]>$data[2]/$data[1]/$data[0] - $dados[titulo]</option>"; } ?> </select> </td> </tr> <? } else {?> <input type="hidden" name="pasta" value="<?=$id?>"> <? }?> <tr> <td valign="middle">Arquivo ZIP:<br /> <input name='fotos' type='file' size="30" class="input" onblur="this.className='input';" onfocus="this.className='inputon';"> </td> </tr> <tr> <td valign="middle"><input style="width:110px;" type="button" class="input" onblur="this.className='input';" onfocus="this.className='inputon';" name='btgravar' value="Enviar Arquivo" onClick="frmenviar();"></td> </tr> </table> <input type="hidden" name="f[action]" value="gravar"> </fieldset> </form> <? } // INICIO DA ACAO VER FOTOS if($acao == "verfotos"){ $form2 = "FORMLISTA"; ?> <form action="?pg=<?=$file?>" method="POST" name="<?=$form2?>"> <fieldset style="width:100%;"> <input name="acao" type="hidden" value="excluir_selecionados"> <input name="caminho" type="hidden" value="<?=$caminho?>"> <table width="99%" align="center" cellpadding="0" cellspacing="0"> <tr><td><font class="titulos">Lista de Fotos</font></td> <td align="right"><strong><? if($caminho != ""){ $dir="$caminho"; } else { $dir="../images/noticias"; } $dir1=opendir($dir); $cont=0; while ($res=readdir($dir1) ){ $tipo=explode(".",$res); if ($tipo[1]=="jpg" || $tipo[1]=="JPG"){ $cont=$cont+1; } } print ($cont); ?></strong> fotos! </td> </tr> </table> <table width="99%" border=0 align="center" cellpadding=0 cellspacing=0> <tr align="center"> <td width="13%" bgcolor="#C0C0C0"><strong>ID</strong></td> <td width="66%" bgcolor="#C0C0C0"><b>IMAGEM</b></td> <td width="21%" colspan="2" bgcolor="#C0C0C0"><b>TAMANHO</b></td> </tr> <? $rep = opendir($caminho); while ($file = readdir($rep)) { $tipo = filetype("$caminho/$file"); if($file != '..' && $file !='.' && $file !='' && $file != 'Thumbs.db'){ if (!is_dir($file)){ ?> <tr><td height="4" colspan="4"></td></tr> <tr> <td align="center" bgcolor="<? echo $bgcolor; ?>"><table width="90%" border="0" cellspacing="0" cellpadding="2"> <tr> <td width="20"><input id='check_sel' name='listas[]' type='checkbox' value='<?="$file";?>' /></td> <td><b><?=$file;?></b></td> </tr> </table></td> <td valign="middle"><? echo "<a href='$caminho/$file' target='_blank'><img src='thumbs.php?w=100&h=75&imagem=$caminho/$file' border='0'></a> ";?></td> <td align="center" valign="middle"> <? $img = "$caminho/$file"; $im = imagecreatefromjpeg($img); // Cria uma nova imagem a partir de um arquivo ou URL $largura = imagesx($im); $altura = imagesy($im); echo "$largura x $altura"; ?> </td> </tr> <tr><td height="4" colspan="4"></td></tr> <tr><td height="1" colspan="4" bgcolor="e5e5e5"></td></tr> <tr><td height="4" colspan="4"></td></tr> <? } } } closedir($rep); ?> <tr> <td colspan="3"><input style="width:110px;" class="input" onblur="this.className='input';" onfocus="this.className='inputon';" type="button" value="Selecionar Todos" onclick='SelectAll();' id="sel_todos"> <input style="width:110px;" name="Button" type="button" class="input" onblur="this.className='input';" onfocus="this.className='inputon';" value="Excluir Selecionados" onClick="checkdeletetion();"></td> </tr> </table> </fieldset> </form> <? }?> <br> SCRIPT - 02 ( inicial ) - noticias.php <? require "verifica.php";?> <? $variables=(strtolower($_SERVER['REQUEST_METHOD'])== 'GET') ? $_GET : $_POST; foreach ($variables as $k=> $v) $$k=$v; $palavra = "Notícia(s)"; $palavra2 = "Categorias"; $tabela = "tb_noticias"; $tabela2 = $tabela."_cat"; $file = "noticias"; // iniçio da acao INSERI NO BD if($acao== "insertbd"){ $data = "$ano-$mes-$dia $hora"; $sql = "INSERT INTO $tabela VALUES ('','$id_cat', '$prioridade', '$data', '$data2', '$titulo', '$subtitulo', '$texto', '', '$fotos_extras', '$alinhamento_foto', '$largura_foto', '$altura_foto', 'S')"; $sql2 = mysql_query($sql); $id_recuperado = mysql_insert_id(); $dir = "../images/noticias/$id_recuperado"; //echo "$dir"; // inicia criação de pasta $pasta = @mkdir("$dir", 0777); @chmod("$dir", 0777); // fim da criação da pasta $uploaddir = "$dir/"; if(is_dir("$dir")){ if($foto != "none") { if (@copy($_FILES['foto']['tmp_name'], $uploaddir . $_FILES['foto']['name'])) { $foto1 = $_FILES['foto']['name']; //echo "<strong>$foto1</strong> enviada com sucesso!<BR>"; $var1 = mysql_query("update $tabela set foto='$foto1' where id='$id_recuperado'"); } } } else { echo "&lt;script>alert('O Diretório não existe!')</script>"; } $mgs = "<b>$palavra</b> Inserido com Sucesso!"; echo "<table border='0' align='center' cellpadding='0' cellspacing='0' style='border: 1px solid $corcelula1;'> <tr> <td width='400' bgcolor='$corcelula2' align='center' class='titulos'> $mgs</td> </tr> </table> <br> "; //echo "<meta http-equiv='refresh' content='1;URL=?pg=$file'>"; } // fim da acao INSERI NO BD // iniçio da acao UPDATE NO BD if($acao== "updatebd"){ $data = "$ano-$mes-$dia $hora"; if($nova_foto == "S"){ $dir = "../images/noticias/$id"; $uploaddir = "$dir/"; if($foto != "none") { if (@copy($_FILES['foto']['tmp_name'], $uploaddir . $_FILES['foto']['name'])) { $foto1 = $_FILES['foto']['name']; //echo "<strong>$foto1</strong> enviada com sucesso!<BR>"; } } @unlink("$dir/$foto_antiga"); } else { $foto1 = "$foto_antiga"; } $sql = "UPDATE $tabela SET id_cat='$id_cat', prioridade='$prioridade', data='$data', data2='$data2', titulo='$titulo', subtitulo='$subtitulo', texto='$texto', foto='$foto1', fotos_extras='$fotos_extras', alinhamento_foto='$alinhamento_foto', largura_foto='$largura_foto', altura_foto='$altura_foto' WHERE id='$id'"; $sql2 = mysql_query($sql); $mgs = "<b>$palavra</b> Alterada com Sucesso!"; echo "<table border='0' align='center' cellpadding='0' cellspacing='0' style='border: 1px solid $corcelula1;'> <tr> <td width='400' bgcolor='$corcelula2' align='center' class='titulos'> $mgs</td> </tr> </table> <br> "; //echo "<meta http-equiv='refresh' content='1;URL=?pg=$file'>"; } // fim da acao UPDATE NO BD // iniçio da acao STATUS NO BD if($acao == "status"){ $sql = "UPDATE $tabela SET status='$status' WHERE id='$id'"; $sql2 = mysql_query($sql); $mgs = "Status Alterado com Sucesso!"; echo "<table border='0' align='center' cellpadding='0' cellspacing='0' style='border: 1px solid $corcelula1;'> <tr> <td width='400' bgcolor='$corcelula2' align='center' class='titulos'> $mgs</td> </tr> </table> <br> "; //echo "<meta http-equiv='refresh' content='1;URL=?pg=$file'>"; } // fim da acao STATUS NO BD // iniçio da acao EXCLUIR SELECIONADOS if($acao == "excluir_selecionados"){ $listas = implode("|", $listas); // echo "$planos<hr>"; $lista = explode("|", $listas); $total = count($lista); // echo $total; for($i=0; $i<$total; $i++){ $sql = "delete from $tabela WHERE id='$lista[$i]'"; $sql2 = mysql_query($sql); //echo "$sql<br>"; $dir = "../images/noticias/$lista[$i]/"; $dir1 = opendir("$dir"); while ($res =readdir($dir1)){ if ($res!='' && $res!='.' && $res!='..'){ $url = "$dir/$res"; @unlink("$url"); } } @rmdir ("$dir"); } $mgs = "<b>$palavra </b>Excluído com Sucesso!"; echo "<table border='0' align='center' cellpadding='0' cellspacing='0' style='border: 1px solid $corcelula1;'> <tr> <td width='400' bgcolor='$corcelula2' align='center' class='titulos'> $mgs</td> </tr> </table> <br> "; //echo "<meta http-equiv='refresh' content='1;URL=?pg=$file'>"; } // fim da acao EXCLUIR SELECIONADOS // iniçio da acao FORM DE CADASTRO E ALTERAR //if($acao== "FORM"){ $form1 = "FORMULARIO"; $sql=mysql_query("SELECT * FROM $tabela WHERE id='$id'"); $dados=mysql_fetch_array($sql); $dh = explode(" ", $dados[data]); $data = explode("-", $dh[0]); $hora = $dh[1]; ?> &lt;script> function HabilitarFoto() { nForm = document.forms['<?=$form1?>']; if(nForm.elements['nova_foto'].checked = true) { nForm.elements['foto'].disabled = false; nForm.elements['foto'].className= "input"; } } function DesabilitarFoto() { nForm.elements['foto'].disabled = true; nForm.elements['foto'].className = "inputon"; } </script> <form action="?pg=<?=$file?>" method="post" enctype="multipart/form-data" name="<?=$form1?>"> <fieldset style="width:100%;"> <input name="acao" type="hidden" value="<?=(empty($id))?"insertbd":"updatebd";?>"> <input name="id" type="hidden" value="<?=$id?>"> <input name="foto_antiga" type="hidden" value="<?=$dados[foto]?>"> <table width="99%" align="center" cellpadding="0" cellspacing="0"> <tr><td><font class="titulos"><?=(empty($id))?"Cadastrar":"Alterar";?> <?="$palavra"; ?> </font> (<a href="?pg=<?=$file?>">Cadastrar Novo</a>)</td> </tr> </table> <table width="99%" border="0" align="center" cellpadding="2" cellspacing="0"> <tr> <td valign="middle">Categoria: <br /> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td><select name="id_cat" class="input" onblur="this.className='input';" onfocus="this.className='inputon';" > <? $sql5 = mysql_query("SELECT * FROM tb_noticias_cat WHERE status='S' order by nome"); while($dados5=mysql_fetch_array($sql5)){ ?> <option value='<?=$dados5[id]?>' <?=($dados[id_cat]==$dados5[id])?"selected":"";?>> <?=$dados5[nome]?> </option> <? }?> </select></td> <td width="15" align="right"><a href="?pg=noticias_cat"><img src="../images/admin/icone_add.gif" width="11" height="11" border="0" /></a></td> </tr> </table></td> </tr> <tr> <td valign="middle">Prioridade: 0 ou 1<br /> <strong> <input name='prioridade' type='text' value="<? echo $dados[prioridade]?>" size="10" class="input" onblur="this.className='input';" onfocus="this.className='inputon';" /> </strong><i>( Prioridade = 0 *sem destaque) (Prioride = 1 * exibe ao lado do slide no topo)</i><em></em></td> </tr> <tr> <td valign="middle">Título: <br> <textarea name="titulo" style="width:350px; height:40px;" cols=55 rows=3 class="input" onblur="this.className='input';" onfocus="this.className='inputon';"><? echo $dados[titulo]?></textarea> </td> </tr> <tr> <td valign="middle">Subtítulo: <br> <textarea name="subtitulo" style="width:500px; height:55px;" cols="55" rows="3" class="input" onblur="this.className='input';" onfocus="this.className='inputon';"><? echo $dados[subtitulo]?></textarea></td> </tr> <tr valign=middle> <td>Texto:<br /> <? include("../EditorFCK/fckeditor.php"); $oFCKeditor = new FCKeditor('texto'); $oFCKeditor->BasePath = "../EditorFCK/"; $oFCKeditor->Value = "$dados[texto]"; if($usernivel != "1") $oFCKeditor->ToolbarSet = "Default"; $oFCKeditor->Width = "100%"; $oFCKeditor->Height = "500"; $oFCKeditor->Create(); ?></td> </tr> <tr valign=middle> <td colspan="2"> <fieldset><legend>Foto Destaque: </legend> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td width="156"> <? if(empty($id)){ echo "<img width='150' name='foto1' src='../images/layout/sem_foto.jpg' border='0'>"; } else { if(!empty($dados[foto])){ echo "<img width='150' name='foto1' src='thumbs.php?w=150&imagem=../images/noticias/$id/$dados[foto]' border='0'>"; } else { echo "<font color='#FF0000'>Foto não disponível</font>"; } } ?></td> <td valign="middle"><table border="0" cellspacing="0" cellpadding="0"> <tr> <td valign="middle"><? if(empty($id)){?> <input class="inputon" onchange="document.images.foto1.src=this.value" name='foto' type='file' size="16" onclick="java script:alert('Todas as fotos devem ter o formato .jpg');" /> <? } else {?> Trocar Foto?: <input name="nova_foto" type="radio" value="N" checked="checked" onclick="java script:DesabilitarFoto()" /> Não <input name="nova_foto" type="radio" value="S" onclick="java script: HabilitarFoto();" > Sim<br /> <input class="inputon" onchange="document.images.foto1.src=this.value" name='foto' type='file' size="16" disabled="disabled" onclick="java script:alert('Todas as fotos devem ter o formato .jpg');" /> <? }?></td> </tr> </table></td> </tr> </table> </fieldset> </td> </tr> <tr> <td valign="middle"><fieldset><legend>Colocar Fotos Extras: - Para colocar fotos extras, botao enviar na listagem </legend> <input name='fotos_extras' type='radio' value='S' <?=($dados[fotos_extras]=="S")?"checked":"";?>> Sim <input name='fotos_extras' type='radio' value='N' <? if(empty($id)){ echo "checked"; } else { if($dados[fotos_extras]=="N"){ echo "checked"; } } ?>> Não </fieldset> </td> </tr> <tr> <td valign="middle"><fieldset> <legend>Alinhar Foto à: </legend> <input name='alinhamento_foto' type='radio' value='L' <? if(empty($id)){ echo "checked"; } else { if($dados[alinhamento_foto]=="L"){ echo "checked"; } } ?>> Esquerda <input name='alinhamento_foto' type='radio' value='R' <?=($dados[alinhamento_foto]=="R")?"checked":"";?>>Direita </fieldset> </td> </tr> <tr> <td valign="middle">**Largura da Foto:<br /> <strong> <input name='largura_foto' type='text' value="<? echo $dados[largura_foto]?>" size="15" class="input" onblur="this.className='input';" onfocus="this.className='inputon';" /> </strong><i>ex</i><em>: 320</em></td> </tr> <tr> <td valign="middle">**Altura da Foto:<br /> <strong> <input name='altura_foto' type='text' value="<? echo $dados[altura_foto]?>" size="15" class="input" onblur="this.className='input';" onfocus="this.className='inputon';" /> </strong><em>e</em><em>x: 240 </em></td> </tr> <tr> <td>Data: <br /> <input name="dia" type="text" class="input" onblur="this.className='input';" onfocus="this.className='inputon';" value="<?=(!empty($dados[data]))?$data[2]:date("d");?>" size="2" maxlength="2" /> <input name="mes" type="text" class="input" onblur="this.className='input';" onfocus="this.className='inputon';" value="<?=(!empty($dados[data]))?$data[1]:date("m");?>" size="2" maxlength="2" /> <input name="ano" type="text" class="input" onblur="this.className='input';" onfocus="this.className='inputon';" value="<?=(!empty($dados[data]))?$data[0]:date("Y");?>" size="5" maxlength="4" /> <input name='hora' type='hidden' value="<?=(!empty($dados[data]))?$hora:date("H:i:s");?>" /> <input type="hidden" class="input" name='data2' value="<?=date("Y-m-d H:i:s");?>" /></td> </tr> <tr> <td valign="middle"><input style="width:110px;" type="submit" class="input" onblur="this.className='input';" onfocus="this.className='inputon';" name='btgravar' value="<?=(empty($id))?"Cadastrar":"Alterar";?>" /></td> </tr> </table> </fieldset> </form> <? //} // fim da acao FORM DE CADASTRO E ALTERAR ?> <? // inicio da acao LISTAR //if($acao == "listar"){ $form2 = "FORMLISTA"; $busca = "SELECT * FROM $tabela order by data desc"; //echo $busca; $total_reg = "50"; if(!$page){ $page = "1"; } $inicio = $page-1; $inicio = $inicio*$total_reg; $limite = mysql_query("$busca LIMIT $inicio,$total_reg"); $todos = mysql_query("$busca"); $tr = mysql_num_rows($todos); //$tr = count($op); //echo $tr; $tp = ceil($tr / $total_reg); ?> <form action="?pg=<?=$file?>" method="POST" name="<?=$form2?>"> <fieldset style="width:100%;"> <input name="acao" type="hidden" value="excluir_selecionados"> <table width="99%" align="center" cellpadding="0" cellspacing="0"> <tr><td><font class="titulos">Lista de <b><?=$palavra?></b> </font></td> <td align="right"><strong><? echo "<b><font color=$coronmouse>$tr</font></b>";?></strong> registros! </td> </tr> </table> <table width="99%" border="0" align="center" cellpadding="2" cellspacing="1"> <tr bgcolor="#CCCCCC"> <td width="10%" align="center" bgcolor="#C0C0C0"><b>ID</b></td> <td width="37%" align="center"><b>TITULO</b></td> <td width="21%" align="center"><b>CATEGORIA</b></td> <td width="14%" align="center"><b>DATA</b></td> <td align="center" bgcolor="#C0C0C0"><b>AÇÕES</b></td> </tr> <? $i=0; while ($dados=mysql_fetch_array($limite)) { if (($i%2)==0) { $bgcolor="#FFFFFF"; } else { $bgcolor="#e5e5e5"; } ?> <tr> <td align="center" bgcolor="<? echo $bgcolor; ?>"><table width="90%" border="0" cellspacing="0" cellpadding="2"> <tr> <td width="20"><input id='check_sel' name='listas[]' type='checkbox' value='<?="$dados[id]";?>' /></td> <td><b><?=$dados[id];?></b></td> </tr> </table></td> <td bgcolor="<? echo $bgcolor?>"><b><?=$dados[titulo]; ?> </b></td> <td bgcolor="<? echo $bgcolor?>"> <? $sql5 = mysql_query("SELECT * FROM tb_noticias_cat WHERE id='$dados[id_cat]'"); $dados5=mysql_fetch_array($sql5); echo $dados5[nome]; ?></td> <td align="center" bgcolor="<? echo $bgcolor?>"><b><? $dh = explode(" ", $dados[data]); $data = explode("-", $dh[0]); echo "$data[2]/$data[1]/$data[0]";?> </b></td> <td align="center" bgcolor="<? echo $bgcolor; ?>"> <? if($dados[fotos_extras] == "S"){?> <a href="?pg=noticias_fotos&id=<?=$dados[id];?>"><img src="../images/admin/botao_sendfotos.gif" alt="Enviar Fotos" border="0" /></a> <? } else { ?> <img src="../images/admin/botao_sendfotos_off.gif" alt="Enviar Fotos" border="0" /> <? }?> <a href="?pg=noticias_fotos&acao=verfotos&caminho=../images/noticias/<?=$dados[id];?>"><img src="../images/admin/botao_verfotos.gif" alt="Ver Fotos" border="0" /></a><a href="?pg=<?=$file?>&acao=status&id=<?=$dados[id];?>&status=<?=($dados[status]=="S")?"N":"S";?>"> <img src="<?=$usite?>images/admin/status_<?=($dados[status]=="S")?"on":"off";?>.png" alt='Alterar Status para <?=($dados[status]=="S")?"OFF":"ON";?>' border='0' /></a> <a href="?pg=<?=$file?>&acao=FORM&id=<?=$dados[id]?>"><img src="<?=$usite?>images/admin/botao_edit.png" alt="Alterar" border="0" /></a><!--<a href="java script:confirmaExclusao('?pg=<?=$file?>&acao=excluirbd&id=<?=$dados[id];?>')"><img src="<?=$usite?>images/admin/botao_drop.png" alt="Excluir" hspace="3" border="0" /></a>--></td> </tr> <? $i++; }?> <tr> <td colspan="5"><table border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="100" align="right" valign="top"><? if($page > 1){ $anterior = $page -1; $url = "?pg=$pg&acao=$acao&page=$anterior"; echo "<a href='$url'>« Anterior</a> | "; } else { echo "<font color='$corcelula2'>« Anterior</font> | "; } ?> </td> <td align="center"><? for($i=1; $i<$page; $i++) if($i>=$page-5) echo "<a href='?pg=$pg&acao=$acao&page=$i'>$i</a> | "; echo "<font color='$coronmouse'><b>$page</b></font> "; for($i=$page+1; $i<=$tp; $i++) if($i<=$page+5) echo " | <a href='?pg=$pg&acao=$acao&page=$i'>$i</a>"; ?></td> <td width="100" align="left" valign="top"><? if($tp > $page){ $proxima = $page +1; $url = "?pg=$pg&acao=$acao&page=$proxima"; echo " | <a href='$url'>Próxima »</a>"; } else { echo " | <font color='$corcelula2'>Próxima »</font>"; } ?></td> </tr> </table></td> </tr> <tr> <td colspan="5"><input style="width:110px;" class="input" onblur="this.className='input';" onfocus="this.className='inputon';" type="button" value="Selecionar Todos" onclick='SelectAll();' id="sel_todos"> <input style="width:110px;" name="Button" type="button" class="input" onblur="this.className='input';" onfocus="this.className='inputon';" value="Excluir Selecionados" onClick="checkdeletetion();"></td> </tr> </table> </fieldset> </form> <? //} ?> <br /> Testarei qualquer ideia que me passarem, estou aqui trabalhando e estarei olhando o tópico, agradeço desde já !
  5. reeditei e deu certo agora , obg amigo raphael
  6. n deu certo , deu erro inesperado agora "Parse error: syntax error"
  7. :huh: Agora fiquei sem saber galera , já revisei o codigo e n axei nada de errado , meu menu em js pega os dados de um banco de dados em sql . tal menu serve para uma seção de letras de musica , o menu é para escolher os artistas , porem fik em branco :S Arquivo Index.html contendo o codigo: <?php session_start(); include("../conexao.php"); $query = mysql_query("SELECT * FROM `$conf`"); $anu = mysql_fetch_array($query); $backgroud = $anu["bgcolor"]; ?> <script language=JavaScript"> <!-- function MM_jumpMenu(targ,selObj,restore){ //v3.0 eval(targ+".location='"+selObj.options[selObj.selectedIndex].id+"'"); if (restore) selObj.selectedIndex=0; } //--> </script> <body bgcolor="<?=$backgroud?>"> <form name="form"><select name="autor" onChange="MM_jumpMenu('frame',this,0)" > <option id="recentes.php" label="Escolha o Artista" selected>Escolha o Artista</option> <?php $query = sprintf("SELECT * FROM `$autore` ORDER BY autor ASC "); $busca = mysql_query($query); while($anu = mysql_fetch_array($busca)){ $autor = $anu["autor]; ?> <option id="letras.php?id=<?=$autor?>" label="<?=$autor?>"><?=$autor?></option> <?php } ?> </select> </form><br> <iframe frameborder="0" height="100%" width="100%" src="recentes.php" name="frame" scrolling="no"></iframe> </body> Veja online em http://mastersmix.com.br/letras/letras/ Agradeço se alguém tiver uma ideia ... vlw
×
×
  • Criar Novo...