Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 02-19-2009, 04:39 AM Membership Area
ihsaan's Avatar
Extreme Talker

Posts: 155
Name: Ihsaan
Location: Botswana
Trades: 0
Hi all,

I am building a little php site where users can log in and modify there settings and send private messages to each other. I have managed to do this but i think i need to enable cookies/session variables. Where is the best place to learn how to make such a site? I do have a basic php knoledge.
__________________

Please login or register to view this content. Registration is FREE
ihsaan is offline
Reply With Quote
View Public Profile Visit ihsaan's homepage!
 
 
Register now for full access!
Old 02-19-2009, 08:03 AM Re: Membership Area
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
http://uk2.php.net/manual/en/index.php < the PHP manual, everything you ever need to know is there.

http://uk2.php.net/manual/en/ref.session.php < the documentation for sessions.
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 02-19-2009, 09:18 AM Re: Membership Area
EdB
Skilled Talker

Posts: 79
Name: Ed Barnett
Trades: 0
Sessions and cookies can be used and accessed like any other variables. The values are stored in the $_SESSION and $_COOKIE arrays respectively.

Sessions allow values to persist between page loads without using a form to send it via the post or get methods. That session is unique to each user for the length of time that they have the browser open. As soon as the browser is closed the session array is destroyed. This is where cookies come in - cookies allow for values to persist between browser open/closing. These are stored on the user's PC and can be edited by the user. Be careful with the information that you store in cookies - usernames and passwords would be a big no no.

There is one drawback of session data and that is the fact that temporary files are stored on the server in a folder that can be accessed by users if you aren't careful. Stealing each other's session data/values will mean your users can access each other's details/pages. There is a custom script that stores all session data in a table in your MySQL database which increases security significantly. I have attached it as a .zip file )

Just change the details of the .config file and paste this into your MySQL database.

CREATE TABLE `sessions` (
`session_id` varchar(32) NOT NULL,
`session_access` int(255) unsigned default NULL,
`session_data` text,
PRIMARY KEY (`session_id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
Attached Files
File Type: zip session_function.zip (1.3 KB, 2 views)
EdB is offline
Reply With Quote
View Public Profile Visit EdB's homepage!
 
Reply     « Reply to Membership Area
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.12148 seconds with 13 queries