newbie: sessions: example

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
thomasd1
Forum Commoner
Posts: 80
Joined: Sat Nov 22, 2003 2:48 pm
Location: Belgium

newbie: sessions: example

Post by thomasd1 »

hi, i'm planning on making an admin login system for my CMS but i wouldn't know how ...
can anybody explain to me how? can someone give me some startingpoints...
i use apache, php and mysql
User avatar
DuFF
Forum Contributor
Posts: 495
Joined: Tue Jun 24, 2003 7:49 pm
Location: USA

Post by DuFF »

There are 2 main ways of user authentication: cookies and sessions. Look into both and choose which one you want to use (I recommend sessions). There are tons of user authentication tutorials out there. Check out the links below.

Cookies - http://www.php.net/manual/en/function.setcookie.php
Sessions - http://www.php.net/manual/en/ref.session.php

Good Tutorial Sites:
http://www.devshed.com/c/b/PHP/
http://www.phpbuilder.com/
viewforum.php?f=28
http://www.spoono.com/php/

More advanced tuts:
http://www.zend.com/zend/tut/
http://www.onlamp.com/php/
http://phppatterns.com/
User avatar
thomasd1
Forum Commoner
Posts: 80
Joined: Sat Nov 22, 2003 2:48 pm
Location: Belgium

Post by thomasd1 »

thanks alot D
basdog22
Forum Contributor
Posts: 158
Joined: Sun Nov 30, 2003 3:03 pm
Location: Greece

Post by basdog22 »

to prevent some headaches:

Always put this line of code on top of your pages that need $_SESSION vars:

Code: Select all

<?php
session_start();
?>
Post Reply