Question Locked

PHP Question

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I'm developing a website in PHP for my church, and part of the site uses a MySQL database to make maintaining pages that change often easier. I have the code for pulling the data out of the database and displaying it on the page completed, and I have rudimentary code for entering data into the database, but I'm working on implementing a single management page which will branch off into the different sections to make it easier for less technical church members to update and add data.

I don't want just anyone to be able to enter data into the database, so I'm trying to make the page so that a user logs in with database credentials and can then use the admin pages to add/update data. The problem is I can't figure out how to make the login data captured in the form on the first page persist to each page after that without it displaying in the title bar of each subsequent page that loads.

I keep reading about session variables and cookies, but I can't seem to make either of them work. Either I'm not doing something right or they're no better than any other variable I could use in a PHP page.

Could someone please help me figure this out?

5 replies

by m61

is a good place to learn [that's how i the majority of php, the other part is just by doing and reading other people source code]

phpnuke is good, but if you want to learn, investigate "sessions" to start with..

also there are many php sites aimed at beginners complete with code samples...good luck!

by brian.mills

For the amount of functionality I'm needing (at least right now) using PHPNuke would be like hitting something with an atom bomb when I just need a single bullet.

Fortunately on the security end, the website doesn't exist on the internet yet. Right now it's just sitting on a virtual machine on my laptop.

by blckspder

If your interested in learning more, there are some great books out there O'reilly has some good books.

You could use sessions or cookies.. its really your choice if you use a session you could do something like this:

And then in each subsequent page check to make sure your session is set and when the user logs out you can use something like session_unset() or session_destroy()

Check out phpnuke like mentioned before or some other good sites are php.net or phpbuilder.com

Hope that helps.

This discussion is closed to new replies.