Jump to content

Recommended Posts

Hello!

 

I'm pretty noob in php and SQL.

Usually I use joomla for createing webpages.

So i'll planning to use joomla for my new project..just useing some modul like - "login"

 

I know how to get data from database and how to upload data e.t.c.

 

Here is my problem:

 

I just don't understand how the script understands which user is logged in.

I know that users have ID-s in database.

And there is an option ...for example:

*If the user is logged in - value = 1

*If not - value = 0

 

I can handle with one user online...(vith value = 1)

But if there is like 200 users online....

 

I need a hint or a peace of script...some kind of explanation...have been stucked with this too long...

 

I need something like this:

- check status

-if offline echo ****

-if online echo users personal info (for example)

 

Incase a copy of joomla created database:

 

Users:

id int(11)  auto_increment             

  name varchar(50) latin1_swedish_ci                 

  username varchar(25) latin1_swedish_ci             

  email varchar(100) latin1_swedish_ci             

  password varchar(100) latin1_swedish_ci                 

  usertype varchar(25) latin1_swedish_ci           

  block tinyint(4)  0               

  sendEmail tinyint(4)  0               

  gid tinyint(3)  UNSIGNED  1               

  registerDate datetime  0000-00-00 00:00:00               

  lastvisitDate datetime  0000-00-00 00:00:00               

  activation varchar(100) latin1_swedish_ci       

  params text latin1_swedish_ci 

 

Session:

 

username varchar(50) latin1_swedish_ci                 

  time varchar(14) latin1_swedish_ci                 

  session_id varchar(200) latin1_swedish_ci  0               

  guest tinyint(4)  1               

  userid int(11)    0               

  usertype varchar(50) latin1_swedish_ci                 

  gid tinyint(3)  UNSIGNED  0 

 

Thank you thank you if you find some time to help.

 

 

 

The 1 or 0 in your example above is a TRUE / FALSE setting, not the actual count of users online.  So since each person has their own session, having a session variable set to 1 or TRUE when they log in carries from page to page with them saying they logged in.

 

You can also store their ROW ID in a session to identify who they are when needed.

Thank you for your time.

 

Yeah, I understan that it is true or false.

But i don't understand how the script knows that this concrete person is logged in.

 

I can make separate lines -

if user_id 1 session_id = 1 show page ****

if user_id 2 session_id = 1 show page ****

if user_id 3 session_id = 1 show page ****

 

But it looks stupid...and pointless...maybe i'm going to have 1000000 users...

 

Hope you understand...

 

Each user has their own session id that ties their session variables to them.

 

echo session_id();

 

You could also use cookies in correlation with server side sessions if you wish.

 

So...how the script knows that it must use that conreet id...when user logs in..

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.