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 9 of 9
  1. #1
    New Coder
    Join Date
    May 2011
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Adding PHP page?

    A friend made a site for me at http://avertsoftware.com.

    I'm not a web developer, so I'm having a hard time updating it, not to mention it was compromised yesterday. But thankfully, I've been able to remedy that issue.

    Now, I'm trying to add a new page. But, it's not working.

    The current links through out the site look like this:

    PHP Code:
    <li><a href="info/history">History</span></a></li
    Within that list, a page called "history.php" is navigated to under the "info" folder when that link is clicked.

    So, I thought to just copy a page, rename it and make a similar anchor:

    PHP Code:
    <li><a href="info/gallery">Gallery</a></li
    But when I do, I get a 404 message.

    Does anyone know what I need to do to get this working?

    Thanks

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Take a look at your .htaccess file. That's probably where the nice URL is being interpreted. I would think you could just add a new file (like you added gallery) and it would work but it really depends on what's going in with your Apache Redirect commands.

  • #3
    New Coder
    Join Date
    May 2011
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Fumigator View Post
    Take a look at your .htaccess file. That's probably where the nice URL is being interpreted. I would think you could just add a new file (like you added gallery) and it would work but it really depends on what's going in with your Apache Redirect commands.
    I looked through the entire directory structure of my website and found 2 .htaccess files, but neither had any information about this.

    Do you know how I can check the other thing you mentioned?

  • #4
    Regular Coder djh101's Avatar
    Join Date
    May 2009
    Location
    California
    Posts
    626
    Thanks
    51
    Thanked 67 Times in 67 Posts
    It looks to me more like a navigation to a containing folder than a URL rewrite. info/history/history.php and info/history.php both give 404 errors while info/history/index.php does not (which is where the page, without any URL rewriting, would be navigated to by an extension-less URL).
    "Yeah science!"

  • #5
    New Coder
    Join Date
    May 2011
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by djh101 View Post
    It looks to me more like a navigation to a containing folder than a URL rewrite. info/history/history.php and info/history.php both give 404 errors while info/history/index.php does not (which is where the page, without any URL rewriting, would be navigated to by an extension-less URL).
    Hm... I'm not really sure how to use this information.

    I went looking for 'index.php' files, to see if they would help me identify what's going on. But each file only contains the following:

    PHP Code:
    <html>
    <
    head>
        <
    title>403 Forbidden</title>
    </
    head>
    <
    body>

    <
    p>Directory access is forbidden.</p>

    </
    body>
    </
    html
    Which is odd to me. That particular index.php files is in my "view" folder, where the rest of pages are. So I navigated to http://avertsoftware.com/index.php and it brought up my home page. It's clear my understanding of web technologies is severely lacking, because I would have thought I'd see the 403 page.

    So I started looking through more files and pages to see if there was anything that seemed like it might help. It turns out that the site built on a PHP framework called codeignitor. I'm not sure if that helps, but hopefully it will help you all understand how everything is being used.

    When looking through the directories, I came across two files of interest, "config.php" and "routes.php." Earlier I mentioned that my site was comprised, so when I looked through the "config.php" page, I saw a reference to the spam site:

    PHP Code:
    /*
    |--------------------------------------------------------------------------
    | Base Site URL
    |--------------------------------------------------------------------------
    |
    | URL to your CodeIgniter root. Typically this will be your base URL,
    | WITH a trailing slash:
    |
    |    http://example.com/
    |
    */
    $config['base_url']    = "http://www.http://secitysupply.com/";

    /*
    |--------------------------------------------------------------------------
    | Index File
    |--------------------------------------------------------------------------
    |
    | Typically this will be your index.php file, unless you've renamed it to
    | something else. If you are using mod_rewrite to remove the page set this
    | variable so that it is blank.
    |
    */
    $config['index_page'] = ""
    I didn't know if that was actually causing any problems because the site is mostly running OK. But I changed it back to my site anyway.

    In the routes.php file I saw this:

    PHP Code:
    <?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
    /*
    | -------------------------------------------------------------------------
    | URI ROUTING
    | -------------------------------------------------------------------------
    | This file lets you re-map URI requests to specific controller functions.
    |
    | Typically there is a one-to-one relationship between a URL string
    | and its corresponding controller class/method. The segments in a
    | URL normally follow this pattern:
    |
    |     example.com/class/method/id/
    |
    | In some instances, however, you may want to remap this relationship
    | so that a different class/function is called than the one
    | corresponding to the URL.
    |
    | Please see the user guide for complete details:
    |
    |    http://codeigniter.com/user_guide/general/routing.html
    |
    That sounds exactly what I'm aiming for. But... I looked through the file and there's really not much else there. I expected to see a list of pages and their routes, but I got nada. I've attached 'routes.php' as a text file so you all can take a look at it, if you like.
    Attached Files Attached Files
    Last edited by eperez; 05-22-2011 at 05:59 PM.

  • #6
    Senior Coder
    Join Date
    Aug 2006
    Posts
    1,390
    Thanks
    11
    Thanked 295 Times in 294 Posts
    Quote Originally Posted by eperez View Post
    Hm... I'm not really sure how to use this information.
    I think djh's point was that you have a file at http://avertsoftware.com/info/history/index.php which is displayed with the link: http://avertsoftware.com/info/history. Have you made a folder inside info called "gallery" and put your gallery code in that folder as index.php?

    Seems like that would work, with no .htaccess or other stuff.

    Dave

  • #7
    New Coder
    Join Date
    May 2011
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by tracknut View Post
    I think djh's point was that you have a file at http://avertsoftware.com/info/history/index.php which is displayed with the link: http://avertsoftware.com/info/history. Have you made a folder inside info called "gallery" and put your gallery code in that folder as index.php?

    Seems like that would work, with no .htaccess or other stuff.

    Dave
    Hm... I can try that, but I'm not sure it will work. Looking through the directory structure, there is no "history" folder and I can't find "index.php" that has any actual code in it.

    This is how the directories are setup:


    You can see the "info" folder up top and the pages below. There is no history subdirectory and no index.php files here. This is what's confusing me. I tried what he said and navigated to the /info/history/index.php file and it did indeed work, but the files on my server aren't matching up with that. Whenever I need to make an edit, I just download the appropriate page, make the edit and upload it again. If I need to make a new link to a page, I just create an anchor and call the name of the page without ".php", though it's not working for my "home" page at the moment.

    This means that some other code is working behind the scenes, but I have no idea where.

  • #8
    Regular Coder djh101's Avatar
    Join Date
    May 2009
    Location
    California
    Posts
    626
    Thanks
    51
    Thanked 67 Times in 67 Posts
    Since you are using a framework, you could try going to CodeIgniter's site and looking through their user guide and forums. Without looking through all your files, it's going to be hard to help you, myself (since I don't know how CodeIgniter handles URIs).
    "Yeah science!"

  • #9
    New Coder
    Join Date
    May 2011
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks everyone for the help.

    I took djh101's advice and visited CodeIgniter's forums and through some guidance, I was able to figure it out.

    If you're interested, you can view the thread here.


  •  

    Posting Permissions

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