Jump to content

One Main Page, Different Things Changed Through Php


Sy Mercade

Recommended Posts

Hi, I'm posting this here because it seems like something you guys might already know how to do. I'll keep trying things when I wake up tommorow but maybe someone can solve it before then..rambling...tired.Ok so I've got an image gallery site consisting of 9 images. In it's most basic form it's 9 html pages, each with a different title (not the html tag), image, and description. There is a navigational menu bar on the side. But, using PHP I want to evolve it so it's really only one page, but the title, image, and description are variables that change according to the links on the side. I've already rejoiced after learning "include" for the navigation menu, now I want to use it for a lot more.Using include/require, $_GET, and switches, I've managed to do this to the images, but the title and description remain unchanged. Also, the ?image=# is kind of weird at the end of every URL. I'd rather not create a separate PHP file each for title, image, and description...and now that I think of it that wouldn't work...because the link could only change one PHP at a time. So far I have this.Any advice???Goodnight Thanks

Link to comment
Share on other sites

Hey thanks Distortion, I'll check that out, but I haven't even completed the tutorial on PHP yet...I think I should finish that before moving on to Mysql (I always thought mysql was just a helper application for PHP or something.)Also, do you know of a way to test PHP out without putting it online first?? I understand that PHP is only executed server-side, but there's got to be a way to preview what the PHP will do on your own computer before mucking around with it in the eyes of the public...I use TextWrangler if that's any difference.

Link to comment
Share on other sites

You can set up a server locally on your home machine. For Windows, WampServer is a great product, while for OS X MAMP will serve most your needs.MySQL is a database management system, allowing you to store, retrieve and manipulate data relationally.

Link to comment
Share on other sites

Geez you guys are quick, I like this place already ^^Now, I have followed a tutorial to set up PHP for your computer (cause before, I thought in order to use PHP you had to install something...turns out that was unnecessary) and I turned on this thing, Apache 2 or something. Now, PHP works on my computer, but only in one folder that I never even knew existed in the directory. In order to test PHP I have to make a copy of my site there and try it there??Also, by turning that into a "server", I worry that I've opened a security risk? Is this true??Using Mac, btwThanks all!

Link to comment
Share on other sites

Apache will serve the documents inside the document root, and all files need to be placed in there if you want to view them using the server. This is the same with all sites; as a machine will have many different files, only some relevant to the website, and so they are all grouped together in the document root. That means that when you say, for example, http://w3schools.invisionzone.com/index.php, you are really accessing something like /etc/apache2/www/index.php on the server machine.There will always be a slight security risk in running a server, either through holes in the server software (e.g. Apache or PHP), or problems with your own scripts. However, Apache and PHP are both developed products with all exploits quickly patched, and as long as you don't do anything really stupid with your scripts (e.g. allowing arbitrary strings to be passed to exec()) then it should be fine. Also, Apache has the ability to limit who can access your site, so you can limit it to only yourself (i.e. localhost or 127.0.0.1). Look in httpd.conf.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...