Website & Database....

Discussion in 'Web Design and Development' started by smilinmonki666, Aug 13, 2009.

  1. smilinmonki666 macrumors regular

    Joined:
    Jan 20, 2008
    #1
    Hi,

    i need help on the following:

    Firstly, I would like to restrict access to folders on my webpage so people can't enter the folder unless the use the link on the website.

    The next part is more difficult. I would like a local database to upload files to the website I am making. The website is for my dads restaurant. On there is a specials menu that constantly changes, &; instead of me uploading it all the time I would like to create a database front for my dad to use when ever he want's to change prices, meals & also add news & job listings. I would use Joomla or something, but, he's no so computer literate & I also have an iPhone version I am creating. Any help is very much appreciated. I have search the web the past few days but found that theirs alot of code but nothing telling you how to use it.

    Many thanks
     
  2. thejadedmonkey macrumors 604

    thejadedmonkey

    Joined:
    May 28, 2005
    Location:
    Pa
    #2
    In the most simplest form, you'll want to use PHP to pull variables from a database of sorts.

    Probably the easiest thing to do would be to create the webpage first. Then look at it and try to determine what parts of it are static, and which parts are dynamic.

    For each dynamic portion, create a database entry for it. Then manually populate the database, and just working on pulling the info from the database and putting it into the page. Once you have that working properly, you can proceed to work on a backend that allows you to update the database.

    ------------------------------------------------------------------------------

    When I mention a database, it doesn't have to be MySQL or anything of the sort, you can choose to simply use a file that contains all of the PHP variables and their values.

    Example

    PHP:
    database.php
    <?
    $food1 
    'Spaghetti';
    $price1 '$7.99';
    ?>
    PHP:
    menu.php
    <?php
    include("database.php");
    echo
    " We serve $food1 for $price1";
    ?>
    Then later you can work on writing a way to update database.php, with password protection and the like.

    ------------------------------------------------------------------------------

    If you want to control whether a user can see a webpage, you'll have to look into using the HTTP referrer to see where the user is coming from... make a simple IF Then statement with PHP,

    If (the ref is from the webpage you want) {
    allow
    } else {
    deny access
    }

    It is considered bad practice to force a user to get to a page (say a page with your menu on it) by forcing them to go through the front page. If someone wants to bookmark a page, they should be allowed to go back to it.

    Also, this method is not fool proof, and in fact easily hackable, and should not be used instead of password protection.
     

Share This Page