Checking Last IP Address used
Last Post 09-03-2011 04:29 AM by Josh Slaughter. 1 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages
Josh SlaughterUser is Offline
new to the springs
new to the springs
Posts:3
Avatar

--
08-26-2011 03:40 AM
    Hello,

    I purchased the Dynamic Login module and the main task that I'm trying to accomplish is, when the user logs in I want to check the last IP address that was used and recorded by DNN and if the timestamp on the last login is less than 24 hours, I need to make sure that the user is logging in from the same IP address as the previous one.  I'm pretty sure the way to accomplish this is to use SQL Validation.  I've written the query but for some reason, it doesn't seem to evaluate the ip address correctly.  I'm not sure if it's something with my code or with the module. This is the SQL that I have.  Any help with this would be greatly appreciated!!

    IF ( SELECT LEN(LastIPAddress)
         FROM   dbo.Users
         WHERE  UserID = $(UserID)
       ) < 1
        BEGIN
            SELECT  IsValid = 1
        END
    ELSE
        IF ( SELECT LEN(LastIPAddress)
             FROM   dbo.Users
             WHERE  UserID = $(UserID)
           ) > 1
            BEGIN
                IF ( SELECT DATEDIFF(HOUR, LastModifiedOnDate, GETDATE())
                     FROM   dbo.Users
                     WHERE  UserID = $(UserID)
                            AND UserId NOT IN ( 1, 2 )
                   ) < 24
                    BEGIN
                        DECLARE @IP AS VARCHAR(50)
                        SELECT  @IP = ( SELECT  LastIPAddress
                                        FROM    dbo.Users
                                        WHERE   UserID = $(UserID)
                                      )
                            
                        SELECT  IsValid = CASE WHEN @IP = $(IPAddress) THEN 1
                                               ELSE 0
                                          END                     
                    END
                ELSE
                    BEGIN
                        SELECT  IsValid = 1
                    END
               
            END
    Josh SlaughterUser is Offline
    going with the flow
    going with the flow
    Posts:55
    Avatar

    --
    09-03-2011 04:29 AM
    Does anyone know how I can check to see if the user's last login was less than 24 hours ago, that they are using the same IP Address? It seems that the DNN Users table is already updated with the new IP address by the time the SQL validation code is executed.

    With the SQL Validation, are you limited to only running queires and not inserting records? I created a stored procedure that would insert user info into a table so that I can track login information and the SP tested fine in SSMS but as soon as I added it to the Dynamic Login control it doesn't seem to work anymore. Are there any limitations to the kind of SQL statements you can execute?


    ---
  • film izle
  • 720 izle
  • film
  • sinema izle
  • film makinesi
  • T�rk�e dublaj film
  • film izle
  • film izle
  • baglan film izle
  • sinema izle
  • 1080 film izle
  • film mercegi