PHP Question

By brian.mills ·
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?

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

Reinventing the wheel may be great, but....

by robo_dev In reply to PHP Question

You don't want your church website to get hacked in the meantime.

PHP Nuke. Download it, install it, run it.

Collapse -

reinvent the wheel...

by m61 In reply to Reinventing the wheel may ...

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!

Collapse -


by brian.mills In reply to Reinventing the wheel may ...

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.

Collapse -


by blckspder In reply to PHP Question

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:


//some code to make sure the form was submitted

//some more code to pull the login information and to validate it

//now assign the session
if(!isset($_SESSION['login'])) {
$_SESSION['login'] = $username;


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 or

Hope that helps.

Related Discussions

Related Forums