The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.2.25 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Assigning my Guests User IDs
#1
Hi there,

How can I go about assigning my guest users some sort of ID for logging purposes? Every guest visits landing.php where they must enter their name, and this is the last reference I have to track who did what unless the user logs in. If they are logged in, the user_id column is logged in the logs table, but if they aren't, it just uses user ID 30 which is guest. How can I assign some type of ID for each session and it inputs, for example, in a column called "user_name" the name of the guest who submitted the request.

I hope this is enough information, if not let me know and I will break it down more.
  Reply
#2
Hmm. You have access to their IP address. Could you log that?
  Reply
#3
That's my issue, the system I built is used in a call center so we share the same IP......so I need to do some kind of assigning of some type of ID or something based on a browser-based or computer based item or something.
  Reply
#4
So if you look at the table users_session, you'll notice I'm doing some fun things to establish a very unique key for each person who visits the site. We're taking their user agent and doing some other trickery to generate a unique hash for everyone who visits the site.

You could take that unique hash and tie it to each session.
  Reply
#5
Now this will get my somewhere...however how does the system handle sessions that are timed out? My users can visit the webpage for up to 24 hours before it forces refresh, what if this session times out and there is no dB record? Should I just assign a failsafe? And how do I call the records from this table based on the user? Is there a function somewhere I can duplicate to my requirements. Thanks Dan!
  Reply
#6
I guess I'm not understanding why you wouldn't just want them to have a regular username/password. That would make your tracking simple.

Even if you don't use userspice's user management system, they will need to "log in" somehow or a cookie/session won't be created.

The only other thing I can think of is that you COULD use a deterministic hash where every time the same values are hashed they get the same outcome and you could check that in the header every page load to make sure those things haven't changed.

Without fully knowing the use case, it's a little hard to think that through.
  Reply
#7
I'll explain it a bit more and hopefully we can brainstorm something.

Basically when you visit index.php you have the option to continue as Guest but entering your name and pressing "Continue", Logging in or Registering. The user system is great, but not everyone wants to join, so there is guest access, and user access. However, having an account allows you to have access to certain sections, e.g. special headers, additions and edits for templates and what not.

I currently log all clicks, visits, tabs, etc on the site, and this is done from logtemplate.php which submits whatever value via Javascript to this file, and then the file uses if($user->isLoggedIo() to determine whether to use the $user->data()->id or use $user_id = 30; (which is the Guest ID).

However, what I am thinking I want to do is store a value in the logs table if the user_id value is 0 that is some sort of identifier for the user, so this is a value I can submit to the db using my javascript.

Maybe I can make a static table that stores the guests name (which they enter and is stored in the URL as ?marker=NAMEHERE) and whatever identifier I choose to use, so when I pull the log records, I can check this static table for the name value.

Thoughts on how I could achieve this? I really appreciate your input!
  Reply
#8
You basically want what's called Browser Fingerprinting, which isn't easy. If you look at the second answer on this question, that is probably a point in the right direction...
https://stackoverflow.com/questions/1596...al-storage
  Reply
#9
I think cookies might be an okay option for this - I've done a little but not a lot of work with cookies, if I design a function to define insert their cookie variable into the DB with their name, how do I read, and write this cookie? I've only ever copied scripts that have done it for me, never had to actually design it myself. Thoughts??
  Reply
#10
I'm going to avoid this browser fingerprinting...

A user visits a page and can "Login", "Register" or "Guest Access" - in which case I want to submit the variable they enter into the Guest form (their name) to the database with a unique ID - maybe this one you are using in the guest tracking?

How can I access this information? How long does it last for? Just the 24 hours it is tracked in the admin panel or whatever?

I stopped looking into this for a bit but I am doing a big migration to a new server which in the time I am also rewriting the system to integrate multiple systems (non-US and US projects) together.

What I'm thinking of doing with this information is using it for analytics and reaching out to certain guests in a manner of "You've copied 1000 templates, why don't you just register". And also, to track the users that are currently registered, that their sessions timed out but they are still logging, so I can assign their logs that were not signed in to them.

Thoughts?

Sorry for all of the information just hoping I can get somewhere.
  Reply


Forum Jump:


Users browsing this thread: 5 Guest(s)