Misc Links
Forum Archive
News Archive
File DB
 

Ads
 

Advertisement
 

Latest Forum Topics
wow 56 k modems are
Posted by Red Squirrel
on Oct 14 2013, 11:52:23 pm

I Need A Program
Posted by rovingcowboy
on Sep 23 2013, 5:37:59 pm

having trouble witn lan
Posted by rovingcowboy
on Sep 23 2013, 5:40:56 pm

new problem for me
Posted by rovingcowboy
on Sep 23 2013, 5:54:09 pm

RBC Royal Bank
Posted by Red Squirrel
on Aug 13 2013, 6:48:08 pm

 

Creating your own content management system with php
Better control of site content and access
By Red Squirrel


Since the examples did not use mysql, I figured I would show a real time example of a login system that does use mysql, since you now know the basics of login systems, and probably know mysql if you read my php data storage tutorial, I won't go in as much detail but rather point out the main parts.



1: We do the usual mysql stuff, those vars are simply stored in some other file and well, the values are none of your business. :P

2: The query checked to see if a user matched with the username and password given so if there's 1 result, we keep going, but if there's 0 results, then we do stuff. Usually we'd give a chance, but since only admins use this particular system we're more strict.

3: Since the user got the password wrong, we block him off, don't mind what that function does, since it's one I made and use in that script, normally you would display a "bad username/password" message.

4: This is really interesting. Basically we want to generate a random string that we will use for the session string. But to make it super unique, we just MD5 a bunch of stuff together, including the IP address and random numbers, then make a super long string. The possibilities are endless here, just have fun!

5: Then we put the cookie (this is why doing the auth stuff before data output is a must) and also update the user record with that session.

6: Then we're ready to do whatever we want to do once we're logged in! There better not be security exploits in this since I'm screwed. :P

Well this ends the tutorial. I hope that you learned something from it. And with the knowledge gained from this article and my other php related ones, you should be able to make a rather advanced CMS system if you put all those skills together.

If you're wondering out of curiosity how this site is run, it is actually a very different system. Each page is somewhat independent of each other in terms of html. There are various reasons for this, one of them is that it is more flexible in terms of ad placements, as I can put different ads on different pages as easly as it would on fully static html pages.

This is something you should ask yourself, do you really need a CMS, or do you simply want to plug in php code in html pages? A full featured CMS where you can add modules etc and different sections is cool and all, but if you don't really need it, then stick with static html and php where needed.

But if you need to be able to password protect stuff, and make it easier to change the look then a CMS is the way to go, and coding it yourself is a good start.

Red Squirrel
IceTeks Owner




spacer
27236 Hits Pages: [1] [2] [3] [4] 1 Comments
spacer


Latest comments (newest first)
Posted by Andy on October 10th 2004 (08:52)
LOL I was about to say. WOW this guest is smart. Why can't i find someone like that at my site. laugh.gif
spacer
View all comments
Post comment


Top Articles Latest Articles
- What are .bin files for? (669062 reads)
- Text searching in linux with grep (161180 reads)
- Big Brother and Ndisuio.sys (150471 reads)
- PSP User's Guide (139547 reads)
- SPFDisk (Special Fdisk) Partition Manager (117240 reads)
- How to Use MDADM Linux Raid (188 reads)
- What is Cloud Computing? (1225 reads)
- Dynamic Forum Signatures (version 2) (8769 reads)
- Successfully Hacking your iPhone or iTouch (18714 reads)
- Ultima Online Newbie Guide (35906 reads)
corner image

This site best viewed in a W3C standard browser at 800*600 or higher
Site design by Red Squirrel | Contact
© Copyright 2019 Ryan Auclair/IceTeks, All rights reserved