Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Feb 2014
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question on How to Display News Page

    Hi guys, I've been stuck with my website for a while now, I have cutenews instaled on my site.

    www.rhenderson1987.co.uk

    On the index page I want it to display the news pages, but I cant get a code to work so when I click one of the links it shows the information that should be on that page, so i.e you click members in the area where the news is it would then display the member.html file and all the information I have written on the page.

    Big help if anyone can help me make a code for that!

    At the min the is the command i have.

    PHP Code:
    <?PHP
    include("cutenews/show_news.php");
    ?>

  • #2
    New Coder
    Join Date
    Jan 2011
    Posts
    84
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Try this..

    PHP Code:
     <?PHP
    include($_REQUEST['page']);
    ?>

  • #3
    New Coder
    Join Date
    Aug 2010
    Location
    myeik
    Posts
    81
    Thanks
    6
    Thanked 5 Times in 5 Posts
    Quote Originally Posted by embeebutterly View Post
    Try this..

    PHP Code:
     <?PHP
    include($_REQUEST['page']);
    ?>
    The above PHP code is vulnerable. Do not use this on your site!

    Please write below code is more secure.
    Code:
    <?php
    
    
    if (isset($_GET['page']))
    {
         // The GET argument with name "page" is present. Lets look at its value:
         if ($_GET['page'] == "home")
         {
              // The GET argument's value is "home". Lets write out "home" to the HTML source
              echo("home");
         }
         elseif ($_GET['page'] == "page1")
         {
              // The GET argument's value is "page1". Lets write out "page1" to the HTML source
              echo("page1");
         }
         elseif ($_GET['page'] == "page2")
         {
              // The GET argument's value is "page2". Lets write out "page2" to the HTML source
              echo("page2");
         }
         else
         {
              // The GET argument's value is none of what we want, lets just give him the home page
              echo("home");
         }
    }
    else
    {
              // The GET argument is not present in the URL. That means he is at the home page. Lets give him the home page.
              echo("home");
    }
    
    ?>


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •