Click to See Complete Forum and Search --> : Pyro, can PHP....


James L.
01-11-2004, 10:42 PM
Hey,

Any and all are welcome to answer this question, but I thought I would ask the question to you as I am sure you can answer it ok.

All of my training to date has consisted of client sided stuff (html/xhtml/css/JavaScript/Flash/Audio/Video/Images). I am set to learn server sided scripting next semester, but thought I would get a jump on it by learning PHP now.

Coincidently, a client that I have worked with for a year or so had a request for me. He runs a training agency, and I did his initial site for him, and now update the course dates and schedules for his courses quarterly. As I only knew client sided development at the time, I just have the course dates for each program embedded within the html, which means that I must edit about 15 pages each time the course schedules are updated. Not the most efficient system, but we all start somewhere!

:)

So, here I am completely comfortable working on client sided stuff, and just starting to dable in the server side. My client asks me if there was a way that he could go in and do the updates himself. What I am thinking is to load all the course dates/names into an SQL database. I would create a new page on his site that is password protected. This page would have a form that would allow him to edit the SQL DB. I would obviously re-code the course pages to dynamically pull the course information from the database.

So, in essence, what I need PHP to do is:

1) Password protect a page, with an admin login on the home page.

2) Interpret the information in an SQL database for each of the courses.

3) Allow a fairly low tech person the ability from his password protected page of updating the database through a form or some other means.


... I know PHP can do all of the above (at least I think it could). I am just not sure if what I envision is the most efficient way of doing it, and was curious of your opinion.

I am not looking for anyone to do the coding for me, as I am looking forward to figuring it out. I was just curious as to anybodies thoughts on the above.

Cheers!

James

hammerslane
01-12-2004, 04:18 AM
i think you're going the right way about it
i'm still quite new to SQL stuffs, but pyro's been helping me through php / sql stuffs.

i've done something very similar to what you want to do, for a client of mine, and although the SQL code is a bit long winded, it works, and my client is happy.

as for the password stuff, what OS is running on your web server?
.htaccess is an easy way to password protect a page if you have a linux server, but windows password protecting directories/pages gets more complicated...

but then again, what do I know about anything :( :rolleyes:

good luck with phping things

pyro
01-12-2004, 11:09 AM
Excellent. That's very close to how I would do it myself. As hammerslane said, one may choose .htaccess/.htpasswd above a PHP solution, for simplicity, but if not, just check here (http://forums.webdeveloper.com/showthread.php?s=&threadid=24192#post125897) for a very basic login routine using MySQL to store the username/passwords. Thankfully, MySQL and PHP go hand in hand, and are very well integrated. Running queries and returning the results is quite simple. Also, using phpMyAdmin (http://www.phpmyadmin.net/) helps you create and manage your databases - I highly recommend it.

James L.
01-12-2004, 03:47 PM
Thanks guys,

I am currently working my way through PHP in 24 hours (got it for $12 bucks!) and it seems quite straight forward... I guess having a background in Pascal (yup, Pascal... high school years ago) and in Javascript helps.

So, I think I get the concept of passwords and having a page dynamically display content from a database. My real question mark is around the form that I will create which enables the client to update the database.

The client would need to be able to select from about 12 different courses, and when the course is selected see all of the dates currently listed. The client should then be able to delete all, several, or just one of the entries, then add in new entries one at a time until they are done. After this the client should be able to select a different course and do the same.

Finally, I guess there should be a client log out from this section of the site.

Is something like the above feasable? I just want to client to be able to use the form much like it is a regular html form....keep it simple for the low level computer guy.

Thanks again guys. Any more advice would be appreciated.

Cheers!

james

pyro
01-12-2004, 04:28 PM
Yes, it shouldn't be overly difficult. Just read up on form processing and database interaction. One thing to be careful of, is some books (especially older ones) tend to assume that register_globals are enabled. Since PHP 4.2.0, they have been disabled as a default, and it is always better not to use them. See http://www.webdevfaqs.com/php.php#globalvariables for a bit more info.

James L.
01-12-2004, 11:59 PM
Thanks!

pyro
01-13-2004, 08:37 AM
Sure thing. :)

chris9902
01-13-2004, 09:06 AM
if you only want to update page without loading every page could you not just use an include.