Jump to content

cdmafra

Members
  • Posts

    61
  • Joined

  • Last visited

Everything posted by cdmafra

  1. Thanks. I'm trying to apply get_magic_quotes with my code, but with no result.
  2. I believe I can't change anything in my server. How should I apply stripslashes() in this code?
  3. Hello. I have a problem when I send an article to DB from the server (in localhost everything is working fine). So, the news_post (textarea) is sending backslashes before single and double quotes, broking embed elements (images, videos, etc.). The articles are sent to DB throught this coide:
  4. No, no. I need the ?guid=### . When I open an article, the link is as follow : mysite.net/news.php?guid=### Once inside an article, all links are "mysite.net/news.php?", being an article or not. In "main" pages, all is working normally until open an article.
  5. I don't find the problem... I tried different things and nothing works the way I want...
  6. I have solved part of my problem, creating a page to generate the news (now, the link works properly: "http://www.mysite.net/NEWS.PHP?guid=VALUE"). However, I have another problem now: I can't take apart the "news.php" from the URL when I open an article, I mean: the pages are shown correctly, but with URL "http://www.mysite.net/NEWS.PHP?p=7". Code that generates the menu: <?php $query = "select * from menu order by ordem"; $result = mysql_query($query); echo "<ul>"; while ($row = mysql_fetch_array($result)) { if ($p==$row["id"]) { echo "<li class='menu'>".$row["element"]."</li>"; } else { echo "<li><a href=?'p=".$row["id"]."' class='menu'>".$row["element"]."</a></li>"; } } echo "</ul>"; ?>
  7. So, what must I change but keeping a website that not needs to create a page per each new article?
  8. I have a problem when I share a link of my website, that remains "static". I mean: when I share an article (link www.mysite.net/?guid=VALUE) in social networks, the post text is normal, but when I click in the article picture or title, the link that opens is the "normal" of my website (www.mysite.net). The title and description not change too. Code: <META ITEMPROP="name" CONTENT="text/html; charset=utf-8"> <?php include("login/db_connect_open.php") ; ?> <?php if (isset($_REQUEST["guid"])) { $guid = mysql_real_escape_string($_REQUEST["guid"]); // sanitize the guid $query = "SELECT * FROM news WHERE news_guid='".$guid."'"; $result = mysql_query($query); $row = mysql_fetch_array($result); ?> <div class="twelve columns"> <div class="row"><h3 class="n3"><?php echo $row["news_title"]; ?></h3> </div> </div> <div class="row"><!-- Row interior--> <div class="twelve columns"> <div class="panel"> <p id="data"><?php echo $row["news_date"]; ?>, <?php echo $row["hour"];?> GMT</p> <p><?php echo $row["news_post"]; ?></p> </div></div></div> <?php } else ?> <div class="twelve columns"> <div class="row"><h3 class="n3">Destaques</h3> </div> <div class="row"> <?php { $query = "SELECT * FROM news WHERE destaque='Sim' and publicado='sim' ORDER BY news_id DESC LIMIT 4"; $result = mysql_query($query); while ($row = mysql_fetch_array($result)) { echo "<div class='three columns'>"; echo "<a href='?guid=".$row["news_guid"]."' class='div-link'>"; echo "<div class='desc-new'>"; //imagem echo "<div class='img-block'><img src='".$row['news_image']."' title='".$row["news_title"]."' alt='".$row["news_title"]."'/></div>"; //texto echo "<h4 class='new-title' onmouseover='none'>".$row["news_title"]."</h4>"; echo "<h4 class='new-subtitle' onmouseover='none'>".$row["news_subtitle"]."</h4>"; echo "<aside><p>".$row["news_desc"]."</p><p class='datapeq'>".$row["news_date"].", ".$row["hour"]."</p></aside>"; echo "</div>"; echo "</a>"; echo "</div>"; } } ?> </div></div> <!-- Fim de row interior --> <?php include("login/db_connect_close.php") ; ?>
  9. Yes, I reuploaded all files twice to ensure that are correctly inserted.
  10. Hello. I have TinyMCE installed in my website. Locally, it is working perfectly. However, when I upload to the server, it returns a normal textarea, without TinyMCE. Above the code. <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta lang="en_US" /> <meta name="viewport" content="width=device-width" /><!-- Set the viewport width to device width for mobile --> <title>Publicar notícia MRN</title> <link href="../stylesheets/foundation.min.css" rel="stylesheet" type="text/css" /> <link href="../stylesheets/app.css" rel="stylesheet" type="text/css" /> <link href="../stylesheets/admin.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> <link rel="shortcut icon" href="../images/logobar.ico" type="image/x-icon"> <!--SCRITPS --> <script type="text/javascript" src="../javascripts/jquery-1.10.2.min.js"></script> <script type="text/javascript" src="tinymce/tinymce.min.js"></script> <script type="text/javascript"> tinymce.init({ selector: "textarea", theme: "modern", plugins: [ "advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker", "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking", "save table contextmenu directionality emoticons template textcolor colorpicker paste", ], image_advtab: true, font_size_style_values: "9px,10px,11px,12px,13px,14px,16px,18px,20px", toolbar1: "sizeselect | bold italic | insertfile undo redo | styleselect | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | print preview media",//used font size for showing font size toolbar toolbar2: "fontselect | fontsizeselect | colorpicker",//used font size for showing font size toolbar style_formats: [ {title: 'Bold text', inline: 'b'}, {title: 'Red text', inline: 'span', styles: {color: '#ff0000'}}, {title: 'Red header', block: 'h1', styles: {color: '#ff0000'}}, {title: 'Example 1', inline: 'span', classes: 'example1'}, {title: 'Example 2', inline: 'span', classes: 'example2'}, {title: 'Table styles'}, {title: 'Table row 1', selector: 'tr', classes: 'tablerow1'} ], resize: false, inline_styles : true, }); </script> <?php if (get_magic_quotes_gpc()) { function stripslashes_gpc(&$value) { $value = stripslashes($value); } array_walk_recursive($_GET, 'stripslashes_gpc'); array_walk_recursive($_POST, 'stripslashes_gpc'); array_walk_recursive($_COOKIE, 'stripslashes_gpc'); array_walk_recursive($_REQUEST, 'stripslashes_gpc'); } ?> <?php if (isset($_POST["publish-p"])) { $categoria= mysql_real_escape_string($_POST['categoria']); $categoria2= mysql_real_escape_string($_POST['categoria2']); $destaque= mysql_real_escape_string($_POST['destaque']); $publicado= mysql_real_escape_string($_POST['publicado']); $news_title= mysql_real_escape_string($_POST['news_title']); $news_subtitle= mysql_real_escape_string($_POST['news_subtitle']); $news_desc= mysql_real_escape_string($_POST['news_desc']); $news_post= mysql_real_escape_string($_POST['news_post']); $news_date= mysql_real_escape_string($_POST['news_date']); $hour= mysql_real_escape_string($_POST['hour']); $news_image= mysql_real_escape_string($_POST['news_image']); $copyright= mysql_real_escape_string($_POST['copyright']); $publish="INSERT INTO news(news_guid,categoria,categoria2,destaque,publicado,news_title,news_subtitle,news_desc,news_post,news_date,hour,news_image,copyright) VALUES(uuid(),'$categoria','$categoria2','$destaque','$publicado','$news_title','$news_subtitle','$news_desc','$news_post','$news_date','$hour','$news_image','$copyright')"; mysql_query($publish) OR DIE(mysql_error()); //mensagem após submeter dados echo "<script>alert('Notícia publicada!');</script>"; } ?> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <script> $(function() { $( "#datepicker" ).datepicker({ changeYear: true, dateFormat: "dd'-'mm'-'yy", showButtonPanel: true, }); }); </script> <!-- script para Toogle Menu --> <script src="../js/toogle-menu.js"></script> /**FIM DE SCRIPTS **/ </head> <body > <div class="bo-header"><div class="row"><div class="twelve columns"> <p>Olá <?php echo "<strong>".$_SESSION["name"]."</strong>."; ?><br/><strong><a href="?logout">Logout</a></strong></p> </div></div></div> <!--MENU--> <!-- Navigation --> <nav class="top-bar fixed"> <div class="twelve columns" ><div style="background:url(../images/carbonback.png); margin-top:2px;"><img src="../images/cabecresize.png" alt="Cabeçalho"></div></div> <ul> <li class="name"><h1 class="menu_dp">Menu</h1></li> <li class="toggle-topbar"><a href="#"></a></li> </ul> <section> <ul class="left"> <!--<li class="menu"><a href="?perfil" title="Ver perfil">Perfil</a></li>--> <li class="menu"><a href="?submit-news" title="Publicar notícia MRN">Publicar notícia MRN</a></li> <li class="menu"><a href="?listar-news" title="Todas as notícias">Todas as notícias</a></li> </ul> </section></nav> <hr class="linha"/> <!--CONTEUDO--> <div class="row"> <div class="twelve columns"> <form action="#" method="post" onsubmit="return $(this).validate()" name="publish" > <h3 class="n3">Publicar notícia</h3> <div class="publish-content"> <div> <h3 class="n3v4">Categoria</h3> <select name="categoria"> <option value="Autos/Pistas">Autos/Pistas</option> <option value="Autos/Ralis-TT">Autos/Ralis-TT</option> <option value="Motos/Pistas">Motos/Pistas</option> <option value="Motos/Ralis-TT">Motos/Ralis-TT</option> <option value="Outros">Outros</option> <option value="Entrevistas">Entrevistas</option> <option value="ci">C&I: OnTheRoad</option> <option value="Multimedia">Multimédia</option> </select> </div> <br/> <div> <h3 class="n3v4">Categoria 2 (opcional)</h3> <select name="categoria2"> <option value="">Nenhuma</option> <option value="Autos/Pistas">Autos/Pistas</option> <option value="Autos/Ralis-TT">Autos/Ralis-TT</option> <option value="Motos/Pistas">Motos/Pistas</option> <option value="Motos/Ralis-TT">Motos/Ralis-TT</option> <option value="Outros">Outros</option> <option value="Entrevistas">Entrevistas</option> <option value="ci">C&I: OnTheRoad</option> <option value="Multimedia">Multimédia</option> </select> </div> <br/> <h3 class="n3v4">Destaque?</h3> <label class="cbox"> <input type="radio" name="destaque" value="sim" checked>Sim</input> <input type="radio" name="destaque" value="não">Não</input> </label> <br/> <h3 class="n3v4">Publicar já?</h3> <label class="cbox"> <input type="radio" name="publicado" value="sim" checked>Sim</input> <input type="radio" name="publicado" value="não">Não</input> </label> <br/> <input name="news_title" type="text" class="title" placeholder="(título)" data-validation="required" title="required"/> <input name="news_subtitle" type="text" class="title" placeholder="(subtítulo)" data-validation="required" maxlength="40" /> <input name="news_desc" type="text" class="description" placeholder="(descrição)" data-validation="required" title="required" maxlength="165"/> <textarea name="news_post" class="post" placeholder="(notícia)" style="width:100%;" ></textarea> <input name="news_date" type="text" class="date" placeholder="(data)" data-validation="required" title="required" id="datepicker" /> <input name="hour" type="text" class="description" placeholder="(hora HH:MM)" data-validation="required" title="required" maxlength="5" data-format="hh:mm:ss" id="datetimepicker3" /> <input name="news_image" type="text" class="description" placeholder="(link imagem)" data-validation="required" title="required"/> <input name="copyright" type="text" class="description" placeholder="(Copyright da/s Imagem/ns)" data-validation="required" title="required"/></div> <div class="publish-footer"> <input type="submit" name="publish-p" value="Publicar" class="button"> <input type="submit" name="cancel" value="Cancelar" class="secondary button" onclick="window.location='../login/?submit-news'" > </div> </form> </div> </div> <?php include ("rodape.php") ?> </body> </html>
  11. Hello. I have a undefined index problem: Notice: Undefined index: submit in C:\wamp\www\mrn_site\login\index3.php on line 106 <?php function clear($message) { if(!get_magic_quotes_gpc()) $message = addslashes($message); $message = strip_tags($message); $message = htmlentities($message); return trim($message); } if ($_POST['submit']) /** LINE 106 **/ { if (empty($_POST['news_title'])) die('Falta o título'); else if (empty($_POST['news_subtitle'])) die('Falta o subtítulo'); else if (empty($_POST['news_post'])) die('Falta o post'); $news_title = clear($_POST['news_title']); $news_subtitle = clear($_POST['news_subtitle']); $news_post = clear($_POST['news_post']); $date = time(); mysql_connect('localhost','root'); mysql_select_db('944273_mrn'); if(mysql_query("INSERT INTO news (news_title , news_subtitle, news_post , news_date) VALUES ('$news_title', '$news_subtitle', '$news_post', '$date')")) echo 'News Entered.'; mysql_close(); } ?> <!--FIM DE SCRIPTS--> </head> <body > <form method="post" action="#"> Posted By:<br /><input name="news_title" id="news_title" type="Text"><br /> Subject:<br /><input name="news_subtitle" id="news_subtitle" type="Text"><br /> <textarea name="news_post" id="news_post" cols="50" rows="5"></textarea><br /> <input type="submit" name="submit" id="submit" value="Enter News"> </form> </body> </html>
  12. Hello. When I copy tables to TinyMCE editor, the numbers in "numeric" columns disappear. The "normal" text is copied normally, but with numbers it happens what you see in attached pictures. Why? Who can help me?
  13. Thank you. I think it's not possible to do what I'm trying to do. This works with pages in what "$pages" variable are usable. However, when I generate the post, I am not asking by "$pages", but for guid in news table. How can I, in this case, to get the news_title row to define page title? <?php if (isset($_REQUEST["guid"])) { $guid = mysql_real_escape_string($_REQUEST["guid"]); // sanitize the guid $query = "SELECT * FROM news WHERE news_guid='".$guid."'"; $result = mysql_query($query); $row = mysql_fetch_array($result);?> <div class="twelve columns"> </div> <div class="row"><!-- Row interior--> <div class="twelve columns"> <div class="panel"> <div class="row"><h3 class="n4"><?php echo $row["news_title"]; ?></h3> </div> <p id="data"><?php echo $row["news_date"]; ?>, <?php echo$row["hour"] ;?> GMT<br/><?php if ($row['copyright'] <> 'Desconhecido') echo "Copyright Imagem: " . $row['copyright'] ;?></p> <p><?php echo $row["news_post"]; ?> </p>
  14. Sorry, I not explained my situation clearly. I have only one page generating all site throug MySQL db...
  15. How can it help me in my case, I'm not seeing...
  16. Hello. I need to change dynamically the title of my website, but keeping the main page title and description only in main page. My website content is all generated (shown) from index.php (code bellow). I can change dynamically the title, but not keeping the main page title and description. In the articles, I would like to present title from news_post and description of _news_desc <!DOCTYPE html> <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]--> <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]--> <!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]--> <head> <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> <meta lang="pt" /> <meta name="author" content="Motor Racing News"> <meta name="description" content="Motor Racing News - Notícias do Desporto Motorizado"> <meta name="keywords" content="motores, formula 1, motogp, gp2 series, automobilismo, motorsport, wrc, rali, rally,dakar,motor racing news, mrn"> <meta name="viewport" content="width=device-width" /><!-- Set the viewport width to device width for mobile --> <title>Motor Racing News | Informações de Altas Rotações</title> <!-- Included CSS Files (Uncompressed) --> <!-- <link rel="stylesheet" href="stylesheets/foundation.css"> --> <!-- Included CSS Files (Compressed) --> <link rel="stylesheet" href="stylesheets/foundation.min.css"> <link rel="stylesheet" href="stylesheets/app.css"> <link rel="shortcut icon" href="images/logobar.ico" type="image/x-icon"> <script src="javascripts/jquery.min.js" type="text/javascript"></script> <script src="javascripts/jquery-1.9.1.min.js" type="text/javascript"></script> <script src="javascripts/modernizr.foundation.js"></script> </head> <body oncontextmenu="return false;"> <?php if (isset($_REQUEST["todas"])) { include("todas.php"); return; } if (isset($_REQUEST["autospt"])) { include("autospt.php"); return; } if (isset($_REQUEST["autosrt"])) { include("autosrt.php"); return; } if (isset($_REQUEST["motospt"])) { include("motospt.php"); return; } if (isset($_REQUEST["motosrt"])) { include("motosrt.php"); return; } if (isset($_REQUEST["entrevistast"])) { include("entrevistast.php"); return; } if (isset($_REQUEST["outrostt"])) { include("outrostt.php"); return; } if (isset($_REQUEST["cit"])) { include("cit.php"); return; } if (isset($_REQUEST["mmt"])) { include("mmt.php"); return; } ?> <!-- Navigation --> <?php include("menu.php"); /* atribui valor a p remetendo para a home page */ if (isset($_REQUEST["p"])) {$p=$_REQUEST["p"];} else {$p=1;} ?> <div class="row"> <?php if (isset($_REQUEST["p"])) { $query = "SELECT * FROM nav WHERE id=".$_REQUEST["p"].""; $result = mysql_query($query); $row = mysql_fetch_array($result); echo "<p style='color:#ffc90d;'><b style='text-decoration:underline; color:#999;'>Página actual:</b> "; echo $row["element"]; echo "</p>"; ?> <?php } else echo ""; ?> </div> <!-- End Navigation --> <!-- Header --> <?php if (isset($_REQUEST["guid"])) { $guid = mysql_real_escape_string($_REQUEST["guid"]); // sanitize the guid $query = "SELECT * FROM news WHERE news_guid='".$guid."'"; $result = mysql_query($query); $row = mysql_fetch_array($result);?> <div class="twelve columns"> </div> <div class="row"><!-- Row interior--> <div class="twelve columns"> <div class="panel"> <div class="row"><h3 class="n4"><?php echo $row["news_title"]; ?></h3> </div> <p id="data"><?php echo $row["news_date"]; ?>, <?php echo$row["hour"] ;?> GMT<br/><?php if ($row['copyright'] <> 'Desconhecido') echo "Copyright Imagem: " . $row['copyright'] ;?></p> <p><?php echo $row["news_post"]; ?></p> <!-- begin htmlcommentbox.com --> <div id="HCB_comment_box">A carregar os comentários...</div> <script type="text/javascript" language="javascript" id="hcb"> /*<!--*/ if(!window.hcb_user){hcb_user={ };} (function(){s=document.createElement("script");s.setAttribute("type","text/javascript");s.setAttribute("src", "http://www.htmlcommentbox.com/jread?page="+escape((window.hcb_user && hcb_user.PAGE)||(""+window.location)).replace("+","%2B")+"&mod=%241%24wq1rdBcg%24al/Hneesch35kyev2Dpyr1"+"&opts=478&num=10");if (typeof s!="undefined") document.getElementsByTagName("head")[0].appendChild(s);})(); /*-->*/ </script> <script> // This code goes ABOVE the main HTML Comment Box code! // replace the text in the single quotes below to customize labels. hcb_user = { //L10N comments_header : '<h4 class="n4">Comentários</h4>', name_label : 'Nome (pode fazer login com a sua conta Google)', content_label: 'Escrever o comentário aqui', submit : 'Comentar', logout_link : '<p id="data">Logout<img src="images/door_out.png" alt="[sair]" class="hcb-icon"/></p>', admin_link : '<p id="data">Login <img src="images/door_in.png" alt="[entrar]" class="hcb-icon"/></p>', no_comments_msg: '<p>Ainda ninguém comentou o artigo. Seja o primeiro!</p>', add: '(+) Adicone o seu comentário', rss: '<img src="images/feed.png" class="hcb-icon" alt="rss"/> ', said: 'disse:', prev_page:'<img src="images/arrow_left.png" class="hcb-icon" alt="[ant.]"/>', next_page:'<img src="images/arrow_right.png" class="hcb-icon" alt="[próx.]"/>', showing:'mostrar', to:'para', website_label:'website (opcional)', email_label:'email', anonymous:'Anónimo', mod_label:'(mod)', subscribe:'subscrever tópico', msg_thankyou:'<b>Obrigado por comentar!</b>', msg_approval:'(este comentário não será publicado até o aprovar)', msg_approval_required:'<b>Obrigado por comentar! O seu comentário aparecerá após ser aprovado por um moderador.</b>', err_bad_html:'O seu comentário contem HTML errado.', err_bad_email:'Por favor escreva um endereço de email válido.', err_too_frequent:'Deve esperar alguns segundos antes de comentar novamente.', err_comment_empty:'O seu comentário não foi publicado porque estava vazio!', //SETTINGS PAGE:'', // ID of the webpage to show comments for. defaults to the webpage the user is currently visiting. RELATIVE_DATES:true // show dates in the form "X hours ago." etc. }; </script> <!-- end htmlcommentbox.com --> </div></div></div> <div class='row'> <?php } else switch ($p) { case 2: include("apresentacao.php"); break; case 3: include("news_principais_autosp.php"); break; case 4: include("news_principais_autosr.php"); break; case 5: include("news_principais_motosp.php"); break; case 6: include("news_principais_motosr.php"); break; case 7: include("news_principais_entrevistas.php"); break; case 8: include("news_principais_outrost.php"); break; case 9: include("news_principais_ci.php"); break; case 10: include("news_principais_mm.php"); break; default: include("news_principais.php"); break; } ?> </div> <!-- End Header --> <!--RECOMENDADOS e Links --> <?php include ("menu_links.php") ?> <!-- End RECOMENDADOS e Links--> <!-- Notícias Pequenas--> <?php switch ($p) { case 2: include("pequenas_news.php"); break; case 3: include("pequenas_news_ap.php"); break; case 4: include("pequenas_news_ar.php"); break; case 5: include("pequenas_news_mp.php"); break; case 6: include("pequenas_news_mr.php"); break; case 7: include("pequenas_news_e.php"); break; case 8: include("pequenas_news_o.php"); break; case 8: include("pequenas_news_o.php"); break; case 9: include("pequenas_news_ci.php"); break; case 10: include("pequenas_news_mm.php"); break; default: include("pequenas_news.php"); break; } ?> <!-- End Notícias Pequenas--> <!-- Footer --> <?php include("rodape.php") ?> <!-- End Footer --> <!-- Included JS Files (Uncompressed) --> <!-- <script src="javascripts/jquery.js"></script> <script src="javascripts/jquery.foundation.mediaQueryToggle.js"></script> <script src="javascripts/jquery.foundation.forms.js"></script> <script src="javascripts/jquery.event.move.js"></script> <script src="javascripts/jquery.event.swipe.js"></script> <script src="javascripts/jquery.foundation.reveal.js"></script> <script src="javascripts/jquery.foundation.orbit.js"></script> <script src="javascripts/jquery.foundation.navigation.js"></script> <script src="javascripts/jquery.foundation.buttons.js"></script> <script src="javascripts/jquery.foundation.tabs.js"></script> <script src="javascripts/jquery.foundation.tooltips.js"></script> <script src="javascripts/jquery.foundation.accordion.js"></script> <script src="javascripts/jquery.placeholder.js"></script> <script src="javascripts/jquery.foundation.alerts.js"></script> <script src="javascripts/jquery.foundation.topbar.js"></script> <script src="javascripts/jquery.foundation.joyride.js"></script> <script src="javascripts/jquery.foundation.clearing.js"></script> <script src="javascripts/jquery.foundation.magellan.js"></script> --> <!-- Included JS Files (Compressed) --> <script src="javascripts/jquery.js"></script> <script src="javascripts/foundation.min.js"></script> <!-- Initialize JS Plugins --> <script src="javascripts/app.js"></script> <script type="text/javascript"> $(window).load(function() { $('#featured').orbit(); }); </script> <!-- Quantcast Tag --> <script type="text/javascript"> var _qevents = _qevents || []; (function() { var elem = document.createElement('script'); elem.src = (document.location.protocol == "https:" ? "https://secure" : "http://edge") + ".quantserve.com/quant.js"; elem.async = true; elem.type = "text/javascript"; var scpt = document.getElementsByTagName('script')[0]; scpt.parentNode.insertBefore(elem, scpt); })(); _qevents.push({ qacct:"p-2G4Bk55Wj3bsE" }); </script> <noscript> <div style="display:none;"> <img src="//pixel.quantserve.com/pixel/p-2G4Bk55Wj3bsE.gif" border="0" height="1" width="1" alt="Quantcast"/> </div> </noscript> <!-- End Quantcast tag --> </body> </html>
  17. Right, now it works, the picture is uploaded, but it goes to uploader.php page and "deletes" the rest of article by not posting that. And I need to upload also for mysql DB
  18. Right. And can I do that without a uploader.php page, I mean, all integrated in the same, with no redirects?
  19. So, I need to separate them to the image uploader works properly?
  20. UPLOAD form page: <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <meta lang="en_US" /> <meta name="viewport" content="width=device-width" /><!-- Set the viewport width to device width for mobile --> <title>Publicar notícia MRN</title> <link href="../stylesheets/foundation.min.css" rel="stylesheet" type="text/css" /> <link href="../stylesheets/app.css" rel="stylesheet" type="text/css" /> <link href="../stylesheets/admin.css" rel="stylesheet" type="text/css" /> <link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /> <link rel="shortcut icon" href="../images/logobar.ico" type="image/x-icon"> <script src="http://code.jquery.com/jquery.js"></script> <script type="text/javascript" src="../js/jquery.formvalidator.js?upd=1.5.1"></script> <script type="text/javascript" src="tinymce/tinymce.min.js"></script> </head> <body > <div class="bo-header"><div class="row"><div class="twelve columns"> <p>Olá <?php echo "<strong>".$_SESSION["name"]."</strong>."; ?><br/><strong><a href="?logout">Logout</a></strong></p> </div></div></div> <!--MENU--> <!-- Navigation --> <nav class="top-bar fixed"> <div class="twelve columns" ><div style="background:url(../images/carbonback.png); margin-top:2px;"><img src="../images/cabecresize.png" alt="Cabeçalho"></div></div> <ul> <li class="name"><h1 class="menu_dp">Menu</h1></li> <li class="toggle-topbar"><a href="#"></a></li> </ul> <section> <ul class="left"> <!--<li class="menu"><a href="?perfil" title="Ver perfil">Perfil</a></li>--> <li class="menu"><a href="?submit-news" title="Publicar notícia MRN">Publicar notícia MRN</a></li> </ul> </section></nav> <hr class="linha"/> <?php if (get_magic_quotes_gpc()) { function stripslashes_gpc(&$value) { $value = stripslashes($value); } array_walk_recursive($_GET, 'stripslashes_gpc'); array_walk_recursive($_POST, 'stripslashes_gpc'); array_walk_recursive($_COOKIE, 'stripslashes_gpc'); array_walk_recursive($_REQUEST, 'stripslashes_gpc'); } ?> <?php if (isset($_POST["publish-p"])) { $categoria= mysql_real_escape_string($_POST['categoria']); $categoria2= mysql_real_escape_string($_POST['categoria2']); $destaque= mysql_real_escape_string($_POST['destaque']); $publicado= mysql_real_escape_string($_POST['publicado']); $news_title= mysql_real_escape_string($_POST['news_title']); $news_subtitle= mysql_real_escape_string($_POST['news_subtitle']); $news_desc= mysql_real_escape_string($_POST['news_desc']); $news_post= mysql_real_escape_string($_POST['news_post']); $news_date= mysql_real_escape_string($_POST['news_date']); $hour= mysql_real_escape_string($_POST['hour']); $news_image= mysql_real_escape_string($_POST['news_image']); $news_image_peq= mysql_real_escape_string($_POST['news_image_peq']); $copyright= mysql_real_escape_string($_POST['copyright']); $publish="INSERT INTO news(news_guid,categoria,categoria2,destaque,publicado,news_title,news_subtitle,news_desc,news_post,news_date,hour,news_image,news_image_peq,copyright) VALUES(uuid(),'$categoria','$categoria2','$destaque','$publicado','$news_title','$news_subtitle','$news_desc','$news_post','$news_date','$hour','$news_image','$news_image_peq','$copyright')"; mysql_query($publish) OR DIE(mysql_error()); //mensagem após submeter dados echo "<script>alert('Notícia publicada!');</script>"; } ?> <!--CONTEUDO--> <div class="row"> <div class="twelve columns"> <form action="#" method="post" onsubmit="return $(this).validate()" name="publish" > <h3 class="n3">Publicar notícia</h3> <div class="publish-content"> <div> <h3 class="n3v4">Categoria</h3> <select name="categoria"> <option value="Autos/Pistas">Autos/Pistas</option> <option value="Autos/Ralis-TT">Autos/Ralis-TT</option> <option value="Motos/Pistas">Motos/Pistas</option> <option value="Motos/Ralis-TT">Motos/Ralis-TT</option> <option value="Outros">Outros</option> <option value="Entrevistas">Entrevistas</option> <option value="ci">C&I: OnTheRoad</option> <option value="Multimedia">Multimédia</option> </select> </div> <br/> <div> <h3 class="n3v4">Categoria 2 (opcional)</h3> <select name="categoria2"> <option value="">Nenhuma</option> <option value="Autos/Pistas">Autos/Pistas</option> <option value="Autos/Ralis-TT">Autos/Ralis-TT</option> <option value="Motos/Pistas">Motos/Pistas</option> <option value="Motos/Ralis-TT">Motos/Ralis-TT</option> <option value="Outros">Outros</option> <option value="Entrevistas">Entrevistas</option> <option value="ci">C&I: OnTheRoad</option> <option value="Multimedia">Multimédia</option> </select> </div> <br/> <h3 class="n3v4">Destaque?</h3> <label class="cbox"> <input type="radio" name="destaque" value="sim" checked>Sim</input> <input type="radio" name="destaque" value="não">Não</input> </label> <br/> <h3 class="n3v4">Publicar já?</h3> <label class="cbox"> <input type="radio" name="publicado" value="sim" checked>Sim</input> <input type="radio" name="publicado" value="não">Não</input> </label> <br/> <input name="news_title" type="text" class="title" placeholder="(título)" data-validation="required" title="required"/> <input name="news_subtitle" type="text" class="title" placeholder="(subtítulo)" data-validation="required" /> <input name="news_desc" type="text" class="description" placeholder="(descrição)" data-validation="required" title="required" maxlength="165"/> <textarea name="news_post" type="text" class="post" placeholder="(notícia)" data-validation="required" title="required" ></textarea> <input name="news_date" type="text" class="date" placeholder="(data)" data-validation="required" title="required" id="datepicker" /> <input name="hour" type="text" class="description" placeholder="(hora HH:MM)" data-validation="required" title="required" maxlength="5" data-format="hh:mm:ss" id="datetimepicker3" /> <form enctype="multipart/form-data" action="uploader.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Choose a file to upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" /> </form> <input name="news_image" type="text" class="description" placeholder="(imagem homepage)" data-validation="required" title="required"/> <input name="news_image" type="text" class="description" placeholder="(imagem main)" data-validation="required" title="required"/> <input name="news_image_peq" type="text" class="description" placeholder="(imagem pequena)" data-validation="required" title="required"/> <input name="copyright" type="text" class="description" placeholder="(Copyright da/s Imagem/ns)" data-validation="required" title="required"/></div> <div class="publish-footer"> <input type="submit" name="publish-p" value="Publicar" class="button"> <input type="submit" name="cancel" value="Cancelar" class="secondary button" onclick="window.location='../login/?submit-news'" > </div> </form> </div> </div> <?php include ("rodape.php") ?> <!--SCRIPTS--> <script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"></script> <script> $(function() { $( "#datepicker" ).datepicker({ changeYear: true, dateFormat: "dd'-'mm'-'yy", showButtonPanel: true, }); }); </script> <!-- script para Toogle Menu --> <script src="../js/toogle-menu.js"></script> <script type="text/javascript"> tinymce.init({ selector: "textarea", plugins: [ "advlist autolink link image lists charmap print preview hr anchor pagebreak spellchecker", "searchreplace wordcount visualblocks visualchars code fullscreen insertdatetime media nonbreaking", "save table contextmenu directionality emoticons template textcolor colorpicker", "paste" ], image_advtab: true, font_size_style_values: "9px,10px,11px,12px,13px,14px,16px,18px,20px", toolbar1: "sizeselect | bold italic | insertfile undo redo | styleselect | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | print preview media",//used font size for showing font size toolbar toolbar2: "fontselect | fontsizeselect | colorpicker",//used font size for showing font size toolbar style_formats: [ {title: 'Bold text', inline: 'b'}, {title: 'Red text', inline: 'span', styles: {color: '#ff0000'}}, {title: 'Red header', block: 'h1', styles: {color: '#ff0000'}}, {title: 'Example 1', inline: 'span', classes: 'example1'}, {title: 'Example 2', inline: 'span', classes: 'example2'}, {title: 'Table styles'}, {title: 'Table row 1', selector: 'tr', classes: 'tablerow1'} ], resize: false, inline_styles : true, }); </script> </body> </html> Uploader.php:
  21. I just followed exactly the steps in this link http://www.tizag.com/phpT/fileupload.php
  22. It just seems that there is no redirect to the uploader.php, I order to upload the file, but only refreshes the page
  23. If I understood, the uploader.php file it's only that: <?php // Where the file is going to be placed $target_path = "uploads/"; /* Add the original filename to our target path. Result is "uploads/filename.extension" */ $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "O ficheiro ". basename( $_FILES['uploadedfile']['name']). " foi carregado"; } else{ echo "Ocorreu um erro, tente novamente!"; } ?> And the Html line I need to enter is <form enctype="multipart/form-data" action="uploader.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Choose a file to upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" /> </form> However, it nothing is happening... even after all details setted-up as tutorial
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.