SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Wizard lorenw's Avatar
    Join Date
    Feb 2005
    Location
    was rainy Oregon now sunny Florida
    Posts
    1,099
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    How to get two usernames

    Hi all

    This is for a condo forum that has bad blood.
    The owner wants to view all pm's on his phpbb forum.

    I'm not really on board with this because private means private.

    I may opt out (depending on what you say) but also took this as a challenge.

    The query I have is
    Code:
    SELECT phpbb_privmsgs_text.privmsgs_text, phpbb_users.username 
    FROM phpbb_privmsgs_text
    INNER JOIN 
    phpbb_privmsgs
    ON phpbb_privmsgs.privmsgs_id = phpbb_privmsgs_text.privmsgs_text_id
    INNER JOIN 
    phpbb_users
    ON phpbb_users.user_id = phpbb_privmsgs.privmsgs_from_userid
    AND phpbb_users.user_id = phpbb_privmsgs.privmsgs_to_userid
    How do I select username twice( the from and to)?

    I will not do this unless it is disclosed to th members but members are 60+ and may not understand this and the owner knows this.

    I know this is a grey area but now I am on a quest for this, how do you get two user names with this query?
    Thanks
    What I lack in acuracy I make up for in misteaks

  2. #2
    SitePoint Evangelist
    Join Date
    Aug 2007
    Posts
    566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    How do I select username twice
    Simply, you do 2 joins, on the same table, but matching the 2 users.

    Code:
    SELECT phpbb_privmsgs_text.privmsgs_text, user_from.username as from, user_to.username as to
    FROM phpbb_privmsgs_text
    INNER JOIN  phpbb_privmsgs
      ON phpbb_privmsgs.privmsgs_id = phpbb_privmsgs_text.privmsgs_text_id
    INNER JOIN phpbb_users as user_from
      ON phpbb_users.user_id = phpbb_privmsgs.privmsgs_from_userid
    INNER JOIN phpbb_users as user_to
      ON phpbb_users.user_id = phpbb_privmsgs.privmsgs_to_userid
    I will not do this unless it is disclosed to th members but members are 60+ and may not understand this and the owner knows this.
    I would be you, I'll bail out. As you said, private is private.
    I may be a bit overzealous, but as long as there is no a requirement from the justice, I would refuse to do that.
    More on the point, in my country, you are not allowed to eye drop on a private conversation.
    If the users notice this, they can bring the operator to a court and trial him, as well as the people that helped him to achieve this.
    It goes even as far as the boss of a firm is not allowed to inspect the mails that come from or are going to his employees, except if the employees are noticed of this.
    An email is considered as private as a letter, and protected the same way.

  3. #3
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,241
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    tripy, very nice reply, that was very thorough

    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"

  4. #4
    SitePoint Evangelist
    Join Date
    Aug 2007
    Posts
    566
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Rudy.

  5. #5
    SitePoint Wizard lorenw's Avatar
    Join Date
    Feb 2005
    Location
    was rainy Oregon now sunny Florida
    Posts
    1,099
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Many thanks, I tried the AS but was placing it wrong.

    I will just say it can't be done and move on. I have always expected that moderators could see all of the private mesages and told the person that that feature should already be somewhere in the admin section.

    Privacy laws are so confusing, in Italy all wifi activity must be logged and the US is proposing a similar law.

    Also in the US, the electronic voting machine manufaturer Diebold had their inter office memo/emails posted on the web. At first people were asked to take them down and when it got legal, it was determined that they could be displayed since they were sent unencrypted over the internet.

    The key is "private" message, and once they know they are being monitored they would switch to the phone.

    Last thing I need is a legal issue.
    I am totally against big brother and will opt out of this project and a big thanks for the input and answer, it will be filed away for future use.


    Cheers
    Loren
    What I lack in acuracy I make up for in misteaks


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •