Jump to content

cdmafra

Members
  • Posts

    61
  • Joined

  • Last visited

cdmafra's Achievements

Member

Member (2/5)

0

Reputation

  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...
×
×
  • 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.