Anunciantes |
Visualizando códigoPostado por LUIZ CREMEPE em 10/03/2010 20:18:08.
http://paste.lymas.com.br/1116
<?php require_once('../Connections/connBaseAntiga.php'); ?>
<?php session_start(); require("sessao.php"); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { if (PHP_VERSION < 6) { $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); switch ($theType) { case "text": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "long": case "int": $theValue = ($theValue != "") ? intval($theValue) : "NULL"; break; case "double": $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; break; case "date": $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; break; case "defined": $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue; } } // ** Logout the current user. ** $logoutAction = $_SERVER['PHP_SELF']."?doLogout=true"; if ((isset($_SERVER['QUERY_STRING'])) && ($_SERVER['QUERY_STRING'] != "")){ $logoutAction .="&". htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_GET['doLogout'])) &&($_GET['doLogout']=="true")){ //to fully log out a visitor we need to clear the session varialbles $_SESSION['MM_Username'] = NULL; $_SESSION['MM_UserGroup'] = NULL; $_SESSION['PrevUrl'] = NULL; unset($_SESSION['MM_Username']); unset($_SESSION['MM_UserGroup']); unset($_SESSION['PrevUrl']); $logoutGoTo = "index.php"; if ($logoutGoTo) { header("Location: $logoutGoTo"); exit; } } ?> <?php $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } ?> <?php if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "frm_not")) { if(is_uploaded_file($_FILES['not_imagem']['tmp_name'])){ // variáveis criadas para o funcionamento do upload // $arquivo = $_FILES['not_imagem']; $imagem_type = $_FILES['type']; //gera nome da foto da noticia atraves do titulo da noticia $arquivo_nome = 'not'.'_'.date('d_m_Y').'_'.md5(rand(1,9182930495).date('ymdhsi')); //diretorio aonde salvara as imagens $caminho_imagem = "imgs_not/".$arquivo_nome; if( $imagem_type <> 'image/gif' AND $imagem_type <> 'image/pjpeg' AND $imagem_type <> 'image/jpeg' AND $imagem_type <> 'image/png') { /*verifica o tipo da imagem*/ $erros=1; $Mensagem = "Tipo de arquivo inválido"; } } // variáveis upLoad // $insertSQL = sprintf("INSERT INTO tb_noticia (sinopse_noticia, titulo_noticia, texto_noticia, imagem_not, login_usuario, dt_cadastro, id_destaque, id_status, cd_secao) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['not_sinopse'], "text"), GetSQLValueString($_POST['not_titulo'], "text"), GetSQLValueString($_POST['not_texto'], "text"), GetSQLValueString($arquivo_nome, "text"), GetSQLValueString($_POST['usuario'], "text"), GetSQLValueString(date('Y-m-d'), "text"), GetSQLValueString($_POST['not_destaque'], "text"), GetSQLValueString($_POST['not_status'], "text"), GetSQLValueString('1', "text")); //código Upload // set_time_limit(0); $diretorio = "imgs_not"; $id_arquivo = "not_imagem"; $nome_arquivo = $_FILES[$id_arquivo]['name']; $arquivo_temporario = $_FILES[$id_arquivo]["tmp_name"]; move_uploaded_file($arquivo_temporario, "$diretorio/$nome_arquivo"); //fim código Upload // /* $insertSQL = sprintf("INSERT INTO tb_noticia (titulo_noticia, sinopse_noticia, texto_noticia, imagem_not, login_usuario, dt_cadastro, id_destaque, id_status, cd_secao) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s)", GetSQLValueString($_POST['not_titulo'], "text"), GetSQLValueString($_POST['not_sinopse'], "text"), GetSQLValueString($_POST['not_texto'], "text"), GetSQLValueString($_POST['not_imagem'], "text"), GetSQLValueString($_POST['not_login_usuario'], "text"), GetSQLValueString($_POST['not_destaque'], "date"), GetSQLValueString($_POST['not_destaque'], "text"), GetSQLValueString($_POST['not_status'], "text"), GetSQLValueString($_POST['not_status'], "int"));*/ mysql_select_db($database_connBaseAntiga, $connBaseAntiga); $Result1 = mysql_query($insertSQL, $connBaseAntiga) or die(mysql_error()); } ?> <!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=iso-8859-1" /> <title>Projeto: Portal de Notícias [ Área Administrativa ]</title> <script type="text/javascript" src="../jscripts/tiny_mce/tiny_mce.js"></script> <script type="text/javascript"> tinyMCE.init({ // General options mode : "textareas", theme : "advanced", plugins : "safari,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template", // Theme options theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,styleselect,formatselect,fontselect,fontsizeselect", theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor", theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen", theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,pagebreak", theme_advanced_toolbar_location : "top", theme_advanced_toolbar_align : "left", theme_advanced_statusbar_location : "bottom", theme_advanced_resizing : false, // Example content CSS (should be your site CSS) content_css : "css/content.css", // Drop lists for link/image/media/template dialogs template_external_list_url : "lists/template_list.js", external_link_list_url : "lists/link_list.js", external_image_list_url : "lists/image_list.js", media_external_list_url : "lists/media_list.js", // Replace values for the template plugin template_replace_values : { username : "Some User", staffid : "991234" } }); </script> <link href="css/style_portal_admin.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="global"> <div id="topo"> <h1>G.NEWS</h1> </div> <!-- / Head --> <div id="menu"> <ul> <li><a href="indexNews.php" class="bts_Menu_Horiz">Listar Notícias</a></li> <li><a href="noticia_inserir.php" class="bts_Menu_Horiz">Cadastrar Notícia</a></li> <li><a href="indexClipping.php" class="bts_Menu_Horiz">Listar Clipping</a></li> <li><a href="clipping_inserir.php" class="bts_Menu_Horiz">Cadastrar Clipping</a></li> <li id="bemvindo">Bem vindo(a),<strong><?php echo $_SESSION['usuario']; ?></strong>.</li> <li><a href="<?php echo $logoutAction ?>" class="bts_Menu_Horiz">Sair</a></li> </ul> </div> <!-- / Menu --> <div id="conteudo_admin"> <div id="box_Titulos2"> <h1>Cadastrar Notícia</h1></div> <div id="box_centraliza_forms"> <form action="<?php echo $editFormAction; ?>" method="POST" enctype="multipart/form-data" name="frm_not" id="frm_not" onsubmit="return submitForm();"> <table align="center" width="695px"> <tr valign="baseline"> <td colspan="2" nowrap><strong>Chapeú:</strong></td> </tr> <tr valign="baseline"> <td colspan="2" nowrap><input name="not_sinopse" type="text" id="not_sinopse" value="" size="60%" /></td> </tr> <tr valign="baseline"> <td colspan="2" nowrap> </td> </tr> <tr valign="baseline"> <td colspan="2" nowrap><strong>Título:</strong></td> </tr> <tr valign="baseline"> <td colspan="2" nowrap><input type="text" name="not_titulo" value="" size="60%"></td> </tr> <tr valign="baseline"> <td colspan="2" valign="top" nowrap> </td> </tr> <tr valign="baseline"> <td colspan="2" valign="top" nowrap><strong>Matéria:</strong></td> </tr> <tr valign="baseline"> <td colspan="2" valign="top" nowrap><textarea name="not_texto" rows="25" id="not_texto"></textarea></td> </tr> <tr valign="baseline"> <td colspan="2" nowrap> </td> </tr> <tr valign="baseline"> <td width="63" nowrap><strong>Imagem:</strong></td> <td width="556" nowrap><input type="file" name="not_imagem" id="not_imagem" /></td> </tr> <tr valign="baseline"> <td colspan="2" nowrap> </td> </tr> <tr valign="baseline"> <td nowrap><strong>Destaque:</strong></td> <td nowrap><select name="not_destaque"> <option value="M">Ativo</option> <option value="D" selected="selected">Inativo</option> </select></td> </tr> <tr valign="baseline"> <td colspan="2" nowrap> </td> </tr> <tr valign="baseline"> <td nowrap><strong>Status:</strong></td> <td nowrap><select name="not_status"> <option value="A">Ativo</option> <option value="I" selected="selected">Inativo</option> </select></td> </tr> <tr valign="baseline"> <td colspan="2" nowrap> </td> </tr> <tr valign="baseline"> <td colspan="2" align="center" nowrap><div id="box"><input type="submit" class="bts" value="Cadastrar Notícia" /></div></td> </tr> </table> <input type="hidden" name="not_usuario_id" /> <input type="hidden" name="MM_insert" value="frm_not" /> <input name="usuario" type="hidden" value="<?php echo $_SESSION['login']; ?>" /> </form></div> </div> <!-- / Conteudo Admin --> <div id="rodape"> <h4>Rodapé</h4> </div> <!-- / Rodapé --> </div> <!-- / Global --> </body> </html> Colando um novo código |
MenuNovo Código SobreRecentesphpricardo30/08/2010 17:52:43 amaro 30/08/2010 17:30:41 tiago_a 30/08/2010 16:19:32 tiago_a 30/08/2010 16:04:34 Anônimo 28/08/2010 07:10:52 TDOS 26/08/2010 21:18:16 Anônimo 26/08/2010 12:23:00 Anônimo 26/08/2010 12:18:44 GoldMen 25/08/2010 14:47:38 Anônimo 25/08/2010 14:47:37 |