logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > General
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 06-18-2007, 05:18 AM   #1
Karkar
Karkar's Avatar
 
Join Date: Apr 2007
Location: Melbourne, Australia
Posts: 173
Default Sessions

I want every user who joins my site to have their own section that only they can see. Does this mean I have to assign a different session to each user so that different info is grabbed from the DB for every user.
Karkar is offline   Reply With Quote
Old 06-18-2007, 05:34 AM   #2
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

yes

just use a user_id (auto increment) and assign it when your logging in

you can use that user_id to query the database every time you need data
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 06-18-2007, 05:58 AM   #3
Karkar
Karkar's Avatar
 
Join Date: Apr 2007
Location: Melbourne, Australia
Posts: 173
Default

Ok, i think i know what you mean, I'm just not exactly sure what to do:

<?php
session_start();

require_once("connections/connection.php");
include("includes/securityclient.php");

$idclient = $_SESSION['idclient'];

/////////////////////
$query = sprintf("SELECT * FROM users where field_id='$idclient' ");
$result = @mysql_query($query);
$rowAccount = @mysql_fetch_array($result);
/////////////////////

///////////////////////////////////////////////
$query = sprintf("SELECT * FROM usr_upd");
$result = @mysql_query($query);
$row = mysql_fetch_array($result);
///////////////////////////////////////////////
?>

What is happening in that script is allowing access to a members' page that only people who login can see. As I stated before I want every member to see their own page, and as you can see in the script that's not happening.

So this session is 'idclient' and it's getting the data from the usr_upd table on the db.

$query = sprintf("SELECT * FROM users where field_id='$idclient' ");

field_id is my autoincriment. Above is getting info from a table of users. field_id = $idclient - isn't that saying that whatever the field_id AI is will decide on which session is going to load - but in this case, the idclient session is the only one the script knows about.

This is so confuding
Karkar is offline   Reply With Quote
Old 06-18-2007, 06:09 AM   #4
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

ok you would have a contents table in your db. The contents table has its own id but also has a user_id which links that content to the user_id in the user table on a join.

when you login just set a $_SESSION['user_id'] with the user id of that person logging in. Carry that around your application until you need to render the user page where you can query the contents table and display the information
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 06-18-2007, 06:13 AM   #5
Karkar
Karkar's Avatar
 
Join Date: Apr 2007
Location: Melbourne, Australia
Posts: 173
Default

ok. I will try to figure this out from here with what you've told me and see how far i can get before i'll need your help again hehe

ty
Karkar is offline   Reply With Quote
Old 06-18-2007, 08:56 AM   #6
Karkar
Karkar's Avatar
 
Join Date: Apr 2007
Location: Melbourne, Australia
Posts: 173
Default

100 posts. Yay!
Karkar is offline   Reply With Quote
Old 06-18-2007, 08:57 AM   #7
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

thats cheating
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 06-18-2007, 08:58 AM   #8
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

your not allowed to post shite
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 06-18-2007, 08:58 AM   #9
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

to improve
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 06-18-2007, 08:58 AM   #10
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

your post count
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Reply


Thread Tools
Display Modes

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

Forum Jump


All times are GMT. The time now is 01:25 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com