-2

I have built a login application (App), and I'm thinking of implementing another feature.

I want to show users specific content depending on which user is logged in. For example, say I'm user "Dream". When I log in, I should only see the files that are related to me, such as my downloads, images, and so on.

How could I implement this?

Edwin
  • 2,074
  • 1
  • 21
  • 40
Roland
  • 9,321
  • 17
  • 79
  • 135
  • Have you tried Google? There are billions of tutorials on this out there... – kitti Feb 10 '12 at 15:55
  • What particular problem are you having with the task? – Rob Kennedy Feb 10 '12 at 15:56
  • 4
    This is far _far_ too vague to answer. Have a look at some tutorials, try something yourself then come back here with specific, answerable problems. – Bojangles Feb 10 '12 at 15:56
  • [Privacy in simple DB system](http://stackoverflow.com/questions/9228157/privacy-in-simple-db-system/9228251#9228251). Same here – tomexsans Feb 10 '12 at 15:56
  • Take for example freelancer.com, when you log into your account you are shown only content specific to you, not to someone else's account. The same thing I want to implement too. So I cannot be more specific than this. – Roland Feb 10 '12 at 16:04
  • This is overly broad and would require an entire tutorial. We'd be more likely to help you if you had something and were trying to debug/solve an issue with your code. – Edwin Feb 10 '12 at 16:11
  • Oh, sorry, I'm not looking for an entire tutorial. I'm looking for a solution or how would I do this, I mean the means, I don't need code or anything else, I will try to do that on my own. I'm looking for some tips on how to do this, if I need another database, or what other specifics are to it. – Roland Feb 10 '12 at 16:20
  • Write your queries like `SELECT * FROM files WHERE user_id = $logged_in_user`? I don't understand what your concerns or questions are. – Mike B Feb 10 '12 at 16:36
  • What have _you tried_ that is not working? That's what we'll try to help you answer. – MetalFrog Feb 10 '12 at 16:36
  • As I said, I haven't done anything yet. I want to, but I'm not sure in which direction to go. I have written an example in my comment above. What is it so hard to understand ? It's like logging into your stack account, you'll have content specific to you, not another user, per say the questions asked by you, not by another one. So how do I do this ? I don't need tutorials, I need directions. – Roland Feb 10 '12 at 16:42
  • @Edwin - Instead of correcting my grammar mistakes, you could have simply gave me an indication, since this isn't a grammar test. And "per say" would be the same as "for example", just so you know. – Roland Feb 10 '12 at 16:46
  • First off, you have provided __no__ direction as to how you plan to execute such an application. Second, directions in the detail of what you want __would__ be tutorials. And not trying to be nitpicky, but "per se" is slightly different from "for example", and is usually used in the middle of a sentence, not the beginning (which is why I replace it). See http://english.stackexchange.com/questions/40109/whats-the-meaning-when-we-say-per-se – Edwin Feb 10 '12 at 16:56
  • The thing that puzzles me the most about your question, however, is...well, your question. You seem able to handle sessions (via your login app), and sufficient knowledge in database integration. – Edwin Feb 10 '12 at 16:58
  • @Edwin - Yes, I am. That is why I'm not asking how to do this, but what are the means ? Would I need a database, or would I handle this with some id's given to each user independently, or would I use just sessions to show content depending on user, or would I store the content in a database and relate it by something with the username, and so on ? This is in fact my question, not the code I need or anything else, but some directions on how to handle it. – Roland Feb 10 '12 at 17:03
  • Let's continue this in chat. http://chat.stackoverflow.com/rooms/7539/showing-users-specific-files – Edwin Feb 10 '12 at 17:11
  • let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/7544/discussion-between-edwin-and-roland) – Edwin Feb 10 '12 at 18:25

1 Answers1

2

If you have data in database, users has probably its own ID. Personalized content, as images for example, then has to have user ID mark (it creates logic connection). After user is logged, save its ID into session. After he show page with images, pick up user ID form session, select images with user ID mark from database and display them.

If your data are not in database, principle will be the same.

Fanda
  • 3,760
  • 5
  • 37
  • 56