Ajuda neste codigo

RatoGR

Power Member
Bom dia a todos, estou com 1 problema, sei que este codigo de certeza que tem algum erro, pois a pagina aparece em grande quando faço upload, alguem me pode ajudar?

CODE:
PHP:
<?php virtual('/Connections/Noticias.php'); ?>
<?php
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
if (!(is_uploaded_file($_FILES['imagem']['tmp_name']))) {
    $erro="Tem de fornecer uma imagem para a notícia.";
    }else{
    $extensao=strrchr($_FILES['imagem']['name'],".";
    $nome_ficheiro=$_POST['titulo'] . $extensao;
    move_uploaded_file($_FILES['imagem']['tmp_name'],"./fotos/" . $nome_ficheiro);
  $insertSQL = sprintf("INSERT INTO noticias (titulo, categoria, preview, noticia, imagem) VALUES (%s, %s, %s, %s, %s)",
                       GetSQLValueString($_POST['titulo'], "text"),
                       GetSQLValueString($_POST['categoria'], "text"),
                       GetSQLValueString($_POST['Preview'], "text"),
                       GetSQLValueString($_POST['noticia'], "text"));
                       GetSQLValueString($nome_ficheiro, "text"));

  mysql_select_db($database_Noticias, $Noticias);
  $Result1 = mysql_query($insertSQL, $Noticias) or die(mysql_error());

  $insertGoTo = "news.php?sucesso=sim";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
  }
}
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
.style1 {
    font-size: 24px;
    font-weight: bold;
}
.style2 {
    font-size: 18px;
    font-weight: bold;
}
-->
</style>
</head>

<body>
<p class="style1">Inserir Noticias</p>
<?php
if ((isset($_GET['sucesso'])) && ($_GET['sucesso']=="sim")){
?>
<p align="left" class="style2"> Notícia inserida com sucesso</p>
<?php
}
if ((isset($erro)) {
?>
<p align="left" class="style2"><?php echo $erro; ?></p>
<?php
}
?>
<form action="<?php echo $editFormAction; ?>" method="POST" enctype="multipart/form-data" name="form1" id="form1">
  <table width="725" border="0">
    <tr>
      <td width="90"><span class="style2">Titulo:</span></td>
      <td width="319"><label>
        <input name="titulo" type="text" id="titulo" size="50" maxlength="50" />
      </label></td>
      <td width="123">&nbsp;</td>
      <td width="191">&nbsp;</td>
    </tr>
    <tr>
      <td><span class="style2">Categoria</span><strong>:</strong></td>
      <td><label>
        <input name="categoria" type="text" id="categoria" size="40" maxlength="40" />
      </label></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td class="style2">Preview:</td>
      <td><label>
        <textarea name="Preview" id="Preview" cols="50" rows="5"></textarea>
      </label></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td class="style2">Notícia:</td>
      <td><label>
        <textarea name="noticia" id="noticia" cols="50" rows="5"></textarea>
      </label></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td class="style2">Imagem:</td>
      <td><label><input name="imagem" type="file" id="imagem" size="40" maxlength="45">
      </label></td>
      <td>&nbsp;</td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td class="style2">&nbsp;</td>
      <td><label></label></td>
      <td><label>
        <input type="submit" name="button" id="button" value="Enviar" />
      </label></td>
      <td>&nbsp;</td>
    </tr>
  </table>
  <p>&nbsp;</p>
    <input type="hidden" name="MM_insert" value="form1" />
</form>
<p>&nbsp;</p>
<p>&nbsp; </p>
</body>
</html>
Aguardo ajudas, Obrigado
 
Última edição:
Back
Topo