View Full Version : MYSQL/PHP Profile System
tekneek
07-28-2005, 10:38 AM
Hey... i need to set up a profiling system for a website. A good example would be buddypic.com.
Ive got pretty limited php knowledge, but hopefully enough to get me through this... anyone able to help?
thanks
dalar
07-28-2005, 01:30 PM
Something like that is a little too big to discuss in one post, you will need a mysql database too, so you can store the profile information.
You really need to buy a book and learn PHP, its not hard at all - dont use web tutorials as your base for learning PHP! A book will guide you in the right direction, and it will also teach you how to use PHP with MySQL - once you have read a book on php - the answer to your question will be soo much more easier - with limited knowledge of PHP this is a hard task.
I recomened you read the WROX books, WROX PHP 5 - excellent book, its what I first used and now I can fully program php applications.
The first thing I read was this online tutorial at webmonkey.com http://webmonkey.wired.com/webmonkey/programming/php/tutorials/tutorial4.html
It shows you how to integrate php and mysql - after learning this tutorial I went out and bought the book!
:thumbsup:
Fou-Lu
07-28-2005, 03:42 PM
My personal recommendation would be to seek online tutorials, and not to buy a book. Yeah I know, sounds odd doesn't it. Well, heres why. I've seen, all the time actually, depreciated code being used by people following a book's guidlines. Not to say its wrong, but it is old code. And its their brand new book as well. The problem is the speed in which languages evolve.
With that aside, first thing you will need to do is determine what you want and how to structure it.
You will need at least the following:
a method of tracking users. Can vary between database sessions to php sessions. If you're new with php I'd recommend the use of php sessions as they are extremely simplistic.
Usernames and password. I combine these with all other profile information into a simple table. `Users` for instance.
Usergroup functionality. I'd add this for simplistic usage on your end. As the administrator, I wouldn't want to make it any more difficult on myself. Depending on your methods and how many permissions you would like to use, you can range from a single value: COLUMN ADMIN 1 = administrator, to individual columns for permissions: CANADMIN, CANEDITTEMPLATES, etc, and to my favorite, bitwise permissions (limited to 32 bits btw): CANADAMIN=1, CANEDITUSER=2, CANALTERPERMISSIONS=4 - a user with the above three would have permissions set as 7.
Settings. You want to have these for things like the page title, page url, cookiedomains, version information, currently online (on/off feature), etc.
[optional]Tempates system. These can become very complex especially if you are new to php, but are excellent experience when learning.
[optional]Database driven code. I use this in conjunction with database created sessions, features, permissions, etc.
Now, to make it functional, you really only need two things from my recommended list, a way to track, and a way to compare - which is your users table. Seems easy yeah? It is. Its all the little extras you put it that will make you sink if you ever get lost.
If your interested in how any of these work, please let me know either by a post or a pm I can show you how its done.
dalar
07-28-2005, 03:50 PM
you have a point with out of date code - but that really depends when the book was published... more to the point the book does have some structure to it, and it teaches beginners how to code properly - whereas online tutorials are not as closley organised...
my path was buying the book, learning about variables, loops etc... these things are core to any language... after scoping the book and able to write php i now refer to online forums and code sites for the latest snippets and more in depth problems...
there are also a lot of badly written books out there and some really excellent ones, so be careful not to by a bad one - had it not been for my humble php book I certainly would not be able to build decent apps.
Fou-Lu
07-28-2005, 03:57 PM
Ah, yes I see what you mean.
Good idea actually. Heres how we sum it up:
Use a book to learn about the syntax and usage of php.
Use a tutorial to learn about something specific you need to make.
also...
Stick around here, you'll learn a lot about good coding (and bad coding too, lol), as well as different ideas to the same goal, some better, some worse.
Good good.
dumpfi
07-28-2005, 05:35 PM
You could use the online documentation of php at www.php.net. Its available in many languages (only partly translated though) and you can download it.
It's the only thing you need to learn php.
dumpfi
tekneek
07-28-2005, 11:31 PM
Thanks a lot for that.
I think i might follow both of you and get a book and then learn from the net as well. You guys seem very knowlegable also, so this forum looks to be a frequent visiting place for me.
Ill google WROX PHP 5 and see if i cant get it shipped to my country.
Ill let you know how im going.
Thanks ;)
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.