Thread: last login

Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2007
    Location
    florida.USA();
    Posts
    11
    Plugin Contributions
    0

    Default last login

    I have been working on a little bit of code to mimic the look of my vbulletin site, which most of the users are used to, so when I finally open the store it has a look and feel they are used too.

    Anyways, I have a login box that is in the breadcrumbs, and after login, it works similar to the vbulletin breadcrumb login. Has the Welcome, FirstName. Under that is where I want to add the time of the last visit. Now I accomplished that with a bit of coding ... and I have that working ... however I can't seem to figure out a way to format the output from the SQL table.

    Here is my current code.

    modules/pages/login/head_php.php
    Code to query the last login info.
    Code:
          $last_login_query = "SELECT customers_info_date_of_last_logon
      
                                  FROM " . TABLE_CUSTOMERS_INFO . "
                               
                               WHERE customers_info_id = :customersID";
                                     
          $last_login_query = $db->bindVars($last_login_query, ':customersID', $check_customer->fields['customers_id'], 'integer');
                     
          $last_login = $db->Execute($last_login_query);
    Code to allow east output into the templates.
    Code:
          $_SESSION['customer_last_logon'] = $last_login->fields['customers_info_date_of_last_logon'];
    Now in this same file I noticed the SET of the last_login with the now() function. Which looks like this ...
    Code:
         $sql = "UPDATE " . TABLE_CUSTOMERS_INFO . "
    
                  SET customers_info_date_of_last_logon = now(),
    
                      customers_info_number_of_logons = customers_info_number_of_logons+1
    
                  WHERE customers_info_id = :customersID";
    
    
    
          $sql = $db->bindVars($sql, ':customersID',  $_SESSION['customer_id'], 'integer');
    
          $db->Execute($sql);
    I am in the process of learning SQL, but understand the basics ... I have tried to apply the date_format on that SET customers_info_date_of_last_logon, but it just outputs with all 0's. This is where I would really like to make the changes. I just can't figure it out. Just trying to move along. I also understand it is server based time ... but this can be fixed later. Right now I just need to get a way to format the time, that gets stored to the database.

    You can see the function of the login etc at www.mafia-motorsports.com/store

    Sorry for the long post, but I am hoping someone here can clue me in. Thanks!
    [FONT=Tahoma]- Justin[/FONT]

  2. #2
    Join Date
    Jul 2007
    Location
    florida.USA();
    Posts
    11
    Plugin Contributions
    0

    Default Re: last login

    anyone? this can't be that hard lol.
    [FONT=Tahoma]- Justin[/FONT]

  3. #3
    Join Date
    Jul 2007
    Location
    florida.USA();
    Posts
    11
    Plugin Contributions
    0

    Default Re: last login

    Figured it out ... I was just tired or something last night.


    modules/pages/login/head_php.php

    Code:
    $last_login_query = "SELECT date_format(customers_info_date_of_last_logon, '%m-%d-%Y at %h:%m %p') AS customers_info_date_of_last_logon
      
      				 	       FROM " . TABLE_CUSTOMERS_INFO . "
    						   
    						   WHERE customers_info_id = :customersID";
    						         
          $last_login_query = $db->bindVars($last_login_query, ':customersID', $check_customer->fields['customers_id'], 'integer');
    				 
          $last_login = $db->Execute($last_login_query);
    Code:
    	  $_SESSION['customer_last_logon'] = $last_login->fields['customers_info_date_of_last_logon'];
    which then I can call to from any template with ...

    $_SESSION['customer_last_logon']
    [FONT=Tahoma]- Justin[/FONT]

 

 

Similar Threads

  1. Curious: Customer Account Create, but Last Login Blank
    By chadderuski in forum General Questions
    Replies: 4
    Last Post: 17 Feb 2013, 04:50 PM
  2. Last Login Attempt
    By intcon in forum General Questions
    Replies: 4
    Last Post: 22 Jul 2010, 10:34 PM
  3. Suddenly unable to login to admin area for last 3 days
    By mudguts in forum General Questions
    Replies: 5
    Last Post: 14 Dec 2009, 07:34 PM
  4. Admin-Customer Last Login ip address lookup?
    By Justwade in forum General Questions
    Replies: 2
    Last Post: 20 Dec 2006, 08:01 AM

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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR