Go Back   Dynamic Drive Forums > General Coding > Looking for such a script or service
Search Dynamic Drive Forums:

Reply
 
Thread Tools Search this Thread
  #1  
Old 03-11-2007, 04:20 PM
jnscollier jnscollier is offline
Junior Coders
 
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
Reply With Quote
  #2  
Old 03-11-2007, 04:25 PM
BLiZZaRD's Avatar
BLiZZaRD BLiZZaRD is offline
Elite Coders
 
Join Date: Aug 2005
Location: Other Side of My Monitor
Posts: 3,158
Thanks: 1
Thanked 62 Times in 62 Posts
Default

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

If a forum, which type are you running?
Reply With Quote
  #3  
Old 03-11-2007, 04:31 PM
jnscollier jnscollier is offline
Junior Coders
 
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.
Reply With Quote
  #4  
Old 03-11-2007, 04:52 PM
BLiZZaRD's Avatar
BLiZZaRD BLiZZaRD is offline
Elite Coders
 
Join Date: Aug 2005
Location: Other Side of My Monitor
Posts: 3,158
Thanks: 1
Thanked 62 Times in 62 Posts
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();
     
?>
Reply With Quote
  #5  
Old 03-11-2007, 04:58 PM
jnscollier jnscollier is offline
Junior Coders
 
Join Date: Jan 2007
Posts: 94
Thanks: 2
Thanked 0 Times in 0 Posts
Default

thanks!! i'll try it out...
Reply With Quote
  #6  
Old 03-11-2007, 05:04 PM
BLiZZaRD's Avatar
BLiZZaRD BLiZZaRD is offline
Elite Coders
 
Join Date: Aug 2005
Location: Other Side of My Monitor
Posts: 3,158
Thanks: 1
Thanked 62 Times in 62 Posts
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
Reply With Quote
  #7  
Old 03-11-2007, 05:49 PM
thetestingsite's Avatar
thetestingsite thetestingsite is offline
The Guy That Moderates
 
Join Date: Sep 2006
Location: St. George, UT
Posts: 2,795
Thanks: 3
Thanked 156 Times in 154 Posts
Default

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.
__________________
"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
The Testing Site | Atomic Yeti
Reply With Quote
  #8  
Old 03-11-2007, 06:22 PM
jnscollier jnscollier is offline
Junior Coders
 
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
Reply With Quote
  #9  
Old 03-11-2007, 06:32 PM
BLiZZaRD's Avatar
BLiZZaRD BLiZZaRD is offline
Elite Coders
 
Join Date: Aug 2005
Location: Other Side of My Monitor
Posts: 3,158
Thanks: 1
Thanked 62 Times in 62 Posts
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
Reply With Quote
  #10  
Old 05-22-2007, 05:41 PM
jnscollier jnscollier is offline
Junior Coders
 
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!
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:47 AM.

Home - Contact Us - Archives - Link to DD - Top 

Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.