Autor Tópico: Estou com 1 erro  (Lida 490 vezes)

celsinhoms

  • Novato
  • *
  • Mensagens: 1
Estou com 1 erro
« Online: Abril 13, 2016, 03:46:20 am »
Pessoal me ajuda, estou com esse seguinte erro:

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'Segoe UI', Frutiger, 'Frutiger Linotype', 'Dejavu Sans', 'Helvetica Neue', Arial' at line 1

Código: [Selecionar]
<script>

function muda_ordem(direcao, ordem, controle)

{

this.location = '?pg=<?=$cp?>&p=<?=$c?>&action=muda_ordem&direcao='+direcao+'&ordem='+ordem+'&controle='+controle;

}

function troca_flag(flag, id_reg, campo_flag)

{

this.location = '?pg=<?=$cp?>&p=<?=$c?>&action=muda_status&flag='+flag+'&id_reg='+id_reg+'&campo='+campo_flag;

}

function troca_todos(tf)

{

if(tf.checked)

ToggleAll(lista, true);

else

ToggleAll(lista, false);

}

function ToggleAll(formname, checked_flag)

{

len = formname.elements.length;

    var i = 0;

    for(i = 0; i < len; i++)

{

        formname.elements[i].checked = checked_flag;

    }

}

function confirma_delete()

{

if(confirm('Tem certeza que você deseja apagar este(s) registro(s)?'))

return true;

else

return false;

}

</script>
<script language="JavaScript">
function abrir(URL) {

  var width = 500;
  var height = 500;

  var left = 99;
  var top = 99;

  window.open(URL,'janela', 'width='+width+', height='+height+', top='+top+', left='+left+', scrollbars=yes, status=no, toolbar=no, location=no, directories=no, menubar=no, resizable=no, fullscreen=no');

}
</script>
<script type="text/javascript" src="ckeditor/ckeditor.js"></script>
<script src="ckeditor/samples/sample.js" type="text/javascript"></script>

<?

$action=$_GET["action"];

if($action == ""){

$action=$_POST["action"];

}

?><a href="?pg=<?=$cp?>&p=<?=$c?>">
<input type="button" id="chart_line" name="chart_line" class="right_switch" value="Listar Registros"/></a><BR><BR>

<?

if($action=="muda_status"){

$flag=$_GET["flag"];

$id_reg = $_GET["id_reg"];

$campo = $_GET["campo"];

$sql = "UPDATE 10cms_noticias SET $campo='".$flag."' WHERE id='".$id_reg."'";

$res = mysql_query($sql) or die(mysql_error());

$action = "";

}elseif($action == 'deleta')

{



// ------->> loop nos registros selecionados na lista <<-------|

$del_item = $_POST["del_item"];

$i=0;

while($cada_um = each($del_item))

{

$sql = "DELETE FROM 10cms_noticias WHERE id = '".$cada_um[1]."'";

$res = mysql_query($sql) or die(mysql_error());

if($res){

$i++;

}

}

if($i>0){

echo "<script>alert('Registro(s) excluido(s) com sucesso!')</script>";

}else{

echo "<script>alert('Um ou mais registros não puderam ser excluidos!')</script>";

}

$action = "";

}elseif($action == "editar" || $action == "inserir"){

$id = $_GET["id"];

if($id){

$sql_f = "SELECT * FROM 10cms_noticias  WHERE id='".$id."' LIMIT 1";

$res_f = mysql_query($sql_f) or die(mysql_error());

$ver = mysql_fetch_array($res_f);

$action = "F_editar";

}else{

$action = "F_inserir";

}

?>
<form method="post" action="?pg=<?=$cp?>&p=<?=$c?>">
<input type="hidden" name="action" value="<?=$action?>" />
<input type="hidden" name="id" value="<?=$id?>" />
<? $row_f[usr_habbo] = ($row_f[usr_habbo])?$row_f[usr_habbo]:$_SESSION["admin_nome"];?>
<div id="cont">
<div id="titulo_cont">Autor</div>
<div id="texto_cont">
<input value="<?=$ver[autor]?>" disabled="disabled" style="width:99%;" />
</div></div>
<div id="cont">
<div id="titulo_cont">Revisor</div>
<div id="texto_cont">
<input type="text" style="width:99%;" name="revisor" value="<? echo $_SESSION['admin_nome'];?>" class="form2" onFocus="this.className='form';" onBlur="this.className='form2'"/>
</div></div>
<div id="cont">
<div id="titulo_cont">Data</div>
<div id="texto_cont">
<input disabled="disabled" value="
<? $ver[data] = ($row_f[data])?$ver[data]:time();?>
<?=date("d/m/Y - H:i:s",$ver[data])?>" style="width:99%;" />
</div></div>
<div id="cont">
<div id="titulo_cont">Titulo</div>
<div id="texto_cont">
<input type="text" style="width:99%;" name="titulo" value="<?=$ver[titulo]?>" class="form2" onFocus="this.className='form';" onBlur="this.className='form2'"/>
</div></div>
<div id="cont">
<div id="titulo_cont">Imagem da notícia</div>
<div id="texto_cont">
<input style="width:99%;" type="text" name="img" value="<?=$ver[img]?>" class="form2" onFocus="this.className='form';" onBlur="this.className='form2'"/>
</div></div>
<div id="cont">
<div id="titulo_cont">Status</div>
<div id="texto_cont">
<select name="status" style="background:<? if($ver[status]=='Ativo')echo '#C0FBBD';?><? if($ver[status]=='Inativo')echo '#FFD5D6';?>; width:99%; padding:5px; border-radius:5px; border:1px solid #CCC;">
<option value="Ativo" <? if($ver[status]=='Ativo')echo 'selected="selected"';?> style="background:#E6E6E6;">Ativo</option>
<option value="Inativo" <? if($ver[status]=='Inativo')echo 'selected="selected"';?> style="background:#E6E6E6;" >Inativo</option>
</select>
</div></div>
<div id="cont">
<div id="titulo_cont">Categoria</div>
<div id="texto_cont">
<select name="categoria" style="background:<? if($ver[status]=='Ativo')echo '#C0FBBD';?><? if($ver[status]=='Inativo')echo '#FFD5D6';?>; width:250px; padding:5px; border-radius:5px; border:1px solid #CCC;">
     <option value="5" <? if($ver[categoria]=='5')echo 'selected="selected"';?> style="background:#E6E6E6;">Habbo Brasil/Portugal</option>
     <option value="6" <? if($ver[categoria]=='6')echo 'selected="selected"';?> style="background:#E6E6E6;" >Habbo Internacional</option>
     <option value="7" <? if($ver[categoria]=='7')echo 'selected="selected"';?> style="background:#E6E6E6;" >Habbo Inglês</option>
     <option value="8" <? if($ver[categoria]=='8')echo 'selected="selected"';?> style="background:#E6E6E6;" >Habbo Espanha</option>
     <option value="10" <? if($ver[categoria]=='10')echo 'selected="selected"';?> style="background:#E6E6E6;" >Habbo Finlândia</option>
     <option value="22" <? if($ver[categoria]=='22')echo 'selected="selected"';?> style="background:#E6E6E6;" >Habbo Noruega</option>
     <option value="13" <? if($ver[categoria]=='13')echo 'selected="selected"';?> style="background:#E6E6E6;" >Habbo França</option>
     <option value="14" <? if($ver[categoria]=='14')echo 'selected="selected"';?> style="background:#E6E6E6;" >Habbo Holanda</option>
     <option value="15" <? if($ver[categoria]=='15')echo 'selected="selected"';?> style="background:#E6E6E6;" >Habbo Itália</option>
     <option value="16" <? if($ver[categoria]=='16')echo 'selected="selected"';?> style="background:#E6E6E6;" >Habbo Dinamarca</option>
     <option value="17" <? if($ver[categoria]=='17')echo 'selected="selected"';?> style="background:#E6E6E6;" >Habbo Alemanha</option>
     <option value="18" <? if($ver[categoria]=='18')echo 'selected="selected"';?> style="background:#E6E6E6;" >Habbo Reino Unido</option>
     <option value="19" <? if($ver[categoria]=='19')echo 'selected="selected"';?> style="background:#E6E6E6;" >Habbo Canadá</option>
     <option value="20" <? if($ver[categoria]=='20')echo 'selected="selected"';?> style="background:#E6E6E6;" >Habbo Suécia</option>
     <option value="23" <? if($ver[categoria]=='23')echo 'selected="selected"';?> style="background:#E6E6E6;" >Sulake</option>
     <option value="12" <? if($ver[categoria]=='12')echo 'selected="selected"';?> style="background:#E6E6E6;" >Eventos</option>
     <option value="29" <? if($ver[categoria]=='29')echo 'selected="selected"';?> style="background:#E6E6E6;" >Colunas</option>
     <option value="26" <? if($ver[categoria]=='26')echo 'selected="selected"';?> style="background:#E6E6E6;" >Kihabbo</option>
     <option value="27" <? if($ver[categoria]=='27')echo 'selected="selected"';?> style="background:#E6E6E6;" >Rádio</option>
     <option value="30" <? if($ver[categoria]=='30')echo 'selected="selected"';?> style="background:#E6E6E6;" >Externas</option>
   </select>
</div></div>
<div id="cont">
<div id="titulo_cont">Resumo</div>
<div id="texto_cont">
<input name="resumo" style="width:250px; padding:5px; border-radius:4px; border:1px solid #CCC;" value="<?=$ver[resumo]?>" />
</div></div>
<div id="cont">
<div id="titulo_cont">Texto</div>
<div id="texto_cont">
           <textarea name="texto" id="texto" class="ckeditor" style="float:left; width:100%;"><?=$ver[texto]?></textarea>
</div></div>
           <input style="width:100%;" type="submit" name="btn_form" value="Editar" class="form2" />

</form>
<script type="text/javascript">
function alert_lido(){
$("#fechar").load("kh_pag/ler-alerta.php?lido=sim");
$("#back_a").fadeOut(500);
}
</script>
<?

}elseif($action == "F_editar"){

$id = $_POST["id"];

if($id){
$titulo = $_POST["titulo"];
$img = $_POST["img"];
$status = "Ativo";
$revisor = $_POST["revisor"];
$resumo = $_POST["resumo"];
$texto = $_POST["texto"];
$categoria = $_POST["categoria"];
date_default_timezone_set('Brazil/East');
$data_sistema = date('d/m/Y H:i');
$automatico = "Automatico";
// NOTIFICAÇÃO NOTICIA/EVENTO //
$dados = mysql_fetch_array(mysql_query("SELECT * FROM 10cms_noticias WHERE id='".$id."'"));
$anti_flood = mysql_num_rows(mysql_query("SELECT * FROM 10cms_notifica WHERE link='/versao/artigo/".$id."'"));
date_default_timezone_set('Brazil/East');
$hora_data = date('d/m/Y H:i');
$texto_notifica = "Uma nova notícia foi postada no site.";
$link = "/versao/artigo/".$id."";
$noticia = "sim";
$users = mysql_query("SELECT * FROM 10cms_navegando WHERE user!='' AND data='$hora_data'");
while ($on = mysql_fetch_array ($users)){
if ($anti_flood == "0"){
$notifica = mysql_query("INSERT INTO 10cms_notifica (recebe, categoria, img, data, link, noticia) VALUES ('$on[user]', '$texto_notifica', '$dados[img]', '$hora_data', '$link', '$noticia')");
}
}
// FIM NOTICIA/EVENTO //
$sql = "UPDATE 10cms_noticias SET img='$img', revisor='$revisor', titulo='$titulo', status='Ativo', resumo='$resumo', texto='$texto', categoria='$categoria' WHERE id=$id";
$res = mysql_query($sql) or die(mysql_error());

if($res){

echo "<script>alert('Registro Editado com sucesso')</script>";

}else{

echo "<script>alert('Um erro inesperado aconteceu')</script>";

}

}

$action = "";

}elseif($action == "F_inserir"){

$titulo = $_POST["titulo"];

$status = "Ativo";

$tags = $_POST["tags"];

$revisado = $_POST["revisado"];

$img = $_POST["img"];

$revisor = $_POST["revisor"];

$comentarios = $_POST["comentarios"];

$resumo = $_POST["resumo"];

$texto = $_POST["texto"];

    $nick = $_POST["nick"];



$sql = "INSERT INTO 10cms_noticias (img, revisado, autor, titulo, status, data,  resumo, texto, revisor)

VALUES('$img', '".$_SESSION["admin_id"]."', '$titulo', '' '$revisor', '$status', '".time()."', '$resumo', '$texto')";

$res = mysql_query($sql) or die(mysql_error());

if($res){

echo "<script>alert('Registro Inserido com sucesso')</script>";

}else{

echo "<script>alert('Um erro inesperado aconteceu')</script>";

}

$action = "";

}

if($action == ""){

$num_por_pagina = 30;



$pagina = $_GET["pagina"];

if (!$pagina) {

   $pagina = 1;

}
$primeiro_registro = ($pagina*$num_por_pagina) - $num_por_pagina;

?>

    <form name="lista" method="post" action="?pg=<?=$cp?>&p=<?=$c?>" onSubmit="return confirma_delete()">

    <input type="Hidden" value="deleta" name="action">

    <input type="hidden" value="<?=$c?>" name="c" />
    <input type="hidden" value="<?=$cp?>" name="cp" />

   
<table class="data" cellpadding="0" cellspacing="0" width="100%">
        <tr>

            <th width="2%" class="first"><center><input type="Checkbox" onClick="troca_todos(this);"  alt="Marca ou desmarca todos da lista"></center></th>

            <th width="2%" align="center"><input type="Image" src="media/img/icon_delete.png" alt="delete" class="help" title="Apagar Registros Selecionados"/></th>

            <th width="28%" align="center"><b>Jornalista</b></th>

                        <th width="14%" align="center"><b>Revisor:</b></th>

            <th width="10%"><b>T&iacute;tulo</b></th>

            <th width="14%" align="center"><b>Revisor:</b></th>

            <th width="24%" align="center"><b>Data</b></th>

            <th width="6%" align="center" class="last"><b>Status</b></th>
        </tr>

    <?php
$sql " SELECT * FROM 10cms_noticias WHERE evento='nao' ORDER BY id DESC ";
$query mysql_query ($sql) or die (mysql_error());
while ($row mysql_fetch_array ($query)){
$cor = (($i+1)%2==0)?"#EAEAEA":"#FFF";
?>


        <tr style="background:<?=$cor;?>">

            <td><input type="Checkbox" name="del_item[]" value="<?=$row[id]?>"></td>

            <td align="center"><a href="?pg=<?=$cp?>&p=<?=$c?>&action=editar&id=<?=$row[id]?>"><img src="media/img/icon_edit.png" alt="edit" class="help" title="Editar este Registro"/></a></td>

            <td align="center"><?=$row[autor]?></td>
           
                        <td align="center"><?=$row[revisor]?></td>

            <?

$row[titulo] = ($row[status]=='Inativo')?"<b>".$row[titulo]."</b>":$row[titulo];

?>

            <td><?=$row[titulo]?></td>

            <td align="center">
           
            <?php
$revisor 
$row['revisor'];
if($revisor == ""){
echo "<span style='color:red'><div align='center'>Notícia Não Revisada</div></span>";
} else {
echo "<span style='color:green'><div align='center'>Noticia Revisada</div></span>";
}
?>
            </td>

            <td align="center"><?=date("d/m/Y",$row['data']);?></td>

            <td align="center"><select name="status2" class="botoes3" onchange="troca_flag(this.value, '<?=$row[id]?>', 'status')" style="background:<? if($row[status]=='Ativo')echo '#C0FBBD';?><? if($row[status]=='Inativo')echo '#FFD5D6';?>; width:auto;">
              <option value="Ativo" <? if($row['status']=='Ativo')echo 'selected="selected"';?> style="background:#E6E6E6;">Ativo</option>
              <option value="Inativo" <? if($row['status']=='Inativo')echo 'selected="selected"';?> style="background:#E6E6E6;" >Inativo</option>
            </select></td>
    </tr>

    <? $i++; } ?>
    </table>
    </form>
<? } ?>