Click to See Complete Forum and Search --> : database admin with php
wwwfilmfilercom
Nov 22nd, 2006, 04:30 PM
hi everyone
ok i'm a relative newbie to all of this so ill just explain what im trying to do. im trying to make a simple site where members can post entries up to my database.
i've been on the database forum learning how to set it all up in mysql and i think i've got something quite good so far. the tables are all set up.
now what i've done is make the basic skeleton of my website in php but im stuck. what is the best route to go down now??
i'm thinking i need to set up my admin section but would this be admin.html or admin.php???
please help!
lintz
Nov 22nd, 2006, 04:39 PM
If the rest of your site are PHP pages then be consistant and call your admin page "admin.php".
wwwfilmfilercom
Nov 22nd, 2006, 04:42 PM
Well most of my pages are .html at the moment. So I have index.php and this 'includes' header.html, footer.html, menu.html and content.html
So what I'm thinking is does it matter what the admin page is - .php or .html??
Also I guess I need to start on the Admin page to enter some of the info for the fields now but is this right or should I do something else first??
The Hobo
Nov 22nd, 2006, 04:52 PM
If the admin page has PHP code in it, it should be a .php. If it is just HTML markup and text, then it can be .html. .php is only required if you actually want to utilize PHP code on that page.
Also, if you are including your files via a PHP file, say you have index.php that includes something.html, any PHP code in something.html will be executed.
So as an addition to what I said above, if this admin page is being included by a .php file, then it doesn't matter if it's .html or .php, but I'd go with .php for clarity.
wwwfilmfilercom
Nov 22nd, 2006, 05:00 PM
Ohhhh I see - thanks for that!
I need to put some content into my tables before I can get the registration part of site working (for instance I need to add some categories for people to choose etc.)
For that reason I'm thinking of making my admin page now but I'm kinda confused because the admin page can only work if I add myself to the database as Admin - does that make sense?
How do you guys go about with the first stages of making the php pages for a database site?
The Hobo
Nov 22nd, 2006, 05:04 PM
Well, after you create your database and tables, if you have some kind of user table, you'd probably need to add yourself to the table before you can really do much else.
When I make any application, I first start by drawing out and creating my database, tables and relationships, then I work on solid user authentication and then go on to other areas.
wwwfilmfilercom
Nov 22nd, 2006, 05:09 PM
Right ok, well I've drawn my database and tables up and they are sitting in my MySQL database nicely (I hope)...
Not sure what you mean by solid user authentication... I was told to include a 'level' table which would help distinguish between admin and regular members. So I think what I need to do is add myself to the database as level 1..
Have you ever come across something like this before?
The Hobo
Nov 22nd, 2006, 05:34 PM
Yes, although I don't know if I'd create a seperate table to user level. I'd probably just have it be a field in the user table.
But you definitely need to add yourself to the database.
User authentication meaning user enters username and password, you verify this information against the database, and then use sessions (or cookies if you must) to remember their authentication until they close.
wwwfilmfilercom
Nov 22nd, 2006, 05:37 PM
Hmmm right ok thats fine - I've gone with using levels in a separate table so that I add more at a later time if I must...
What I'm confused with is how to add myself to the database at this stage? Should I make a quick add page? What about the 'categories' and 'skills' which need to be filled in, they are taken from their respective tables - and thats why I was going to make the admin page in the first place lol... confusing...
Also I have not even touched using sessions or cookies yet so any links/tutorials would save me loads of time. Many thanks!
The Hobo
Nov 22nd, 2006, 08:09 PM
If you don't have an UI yet, you can use the database administrative tool that likely came with your database. For mysql, it's mysql and for postgresql, it's psql at the command line (note, in windows you'll need to have it setup in your path variable, or execute it in the bin folder that its stored in):
mysql -u username -p
psql -U username databasename
You might want to look up the command line utility manual for whatever database you're using.
Also, for mysql, you could download and use phpMyAdmin (do a google search for it), or for postgresql, you can use pgAdmin.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.