Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Last Visited

  1. #1
    Join Date
    Jan 2007
    Posts
    94
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Cool Last Visited

    On the top of this page it shows the date and time I last visited... Anyone know of where I can find a script for a feature like this?

    I want to put the date and time of the members' last logins on their profiles

    Any help would be appreciated...
    Thanks!
    -Sammy

  2. #2
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Would this be in a forum or another "profile" on your site?

    If a forum, which type are you running?
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  3. #3
    Join Date
    Jan 2007
    Posts
    94
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Well, I don't think you'd classify my site as a forum. It's basically a blogging site... I think thats the best way to classify it.
    Basically, if you go to www.StupidPeoplePissMeOff.com, Click on one of the new members, a box should pop up with any profile info they have filled out, I'd like their last log in date and time to show there.

  4. #4
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Okay I am not very good at this, but basically you will have to go into your MySQL database and figure out which table stores the log in information, specifically the time field.

    Then you will have to pull that out with php, and show it on the page.

    Something like this should get you started:

    PHP Code:
         <?php
               
    /* Data of SQL-server */ 
              
    $server"localhost";     /* Address database server */ 
              
    $user"xxxxxx";                   /* Database username */ 
              
    $password"yyyyyyy";              /* Database Password */ 
              
    $database"dbxxxxxx";             /* name of database */ 
              
    $table"zzzzzzz";                /* Name of table, you can select that */ 

              /* Accessing SQL-Server and querying table */ 
              
    MYSQL_CONNECT($server$user$password) or die ( "<H3>Server unreachable</H3>");
              
    MYSQL_SELECT_DB($database) or die ( "<H3>Database non existent</H3>");
              
    $result=MYSQL_QUERY"SELECT * FROM $table order by name");

              
    /* Output data into a HTMl table */ 
              
    echo  "<table  border=\"1\" align=center width=50%"
              echo  
    "<tr>"
              echo  
    "<div color=\"#ffff00\">";
              while (
    $field=mysql_fetch_field($result))  { 
                     echo  
    "<th>$field->name</A></th>";
              }
              echo  
    "</font></tr>"
              while(
    $row  =  mysql_fetch_row($result))  { 
                      echo    
    "<tr>"
                      for(
    $i=0;  $i mysql_num_fields($result);  $i++)  { 
                           echo    
    "<td align=center>$row[$i]</td>"
                      }            
                      echo    
    "</tr>\n";
              }
              echo  
    "</table><BR><BR>";   

              
    /* Close SQL-connection */ 
              
    MYSQL_CLOSE();
         
    ?>
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  5. #5
    Join Date
    Jan 2007
    Posts
    94
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    thanks!! i'll try it out...

  6. #6
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    It may not work exactly right, as I said SQL is NOT my thing. If you have further problems you can take this question and posted code to the SQL board and perhaps testingsite or Twey can further get it tweaked for you
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  7. #7
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    Im not 100&#37; sure, but pretty sure that the functions like "mysql_connect", "mysql_[insert_line_here]" should be lowercase. Other than that, should work (although not tested). Let us know if you get any errors or need help tweaking it.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

  8. #8
    Join Date
    Jan 2007
    Posts
    94
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    I'll keep you guys posted on the results.. thanks a bunch

  9. #9
    Join Date
    Aug 2005
    Location
    Other Side of My Monitor
    Posts
    3,494
    Thanks
    5
    Thanked 105 Times in 104 Posts
    Blog Entries
    1

    Default

    Quote Originally Posted by thetestingsite View Post
    Im not 100% sure, but pretty sure that the functions like "mysql_connect", "mysql_[insert_line_here]" should be lowercase. Other than that, should work (although not tested). Let us know if you get any errors or need help tweaking it.
    Yes I believe they should be lowercase. Sorry, this is from an old php3 script
    {CWoT - Riddle } {Freelance Copywriter} {Learn to Write}
    Follow Me on Twitter: @InkingHubris
    PHP Code:
    $result mysql_query("SELECT finger FROM hand WHERE id=3");
    echo 
    $result

  10. #10
    Join Date
    Jan 2007
    Posts
    94
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default

    Right now I have nothing recording users log in times or dates, so I guess that's where I need to start... How can I track this?

    Thanks in advance!

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
  •