oskare100 Posted November 23, 2006 Share Posted November 23, 2006 Hello,I have a few fileds in my database where I want to save information about which IP addresses my members have when they login.In one table I've fields for the username, password, member group and so on. Then I've a few fields with the names login_ip_1, login_ip_2, login_ip_3, login_ip_4 and login_ip_5 where I want to save the IP numbers the member used when he/she loged in the four last times.So basicly what I need to do it that if let say a user log in with one IP the ip is saved in the login_ip_1 field. If then the user logs in again with another IP I want that one to be saved in login_ip_2 and so on until login_ip_5 and when login_ip_5 is filled I want it to send an email.. but that last part with the reporting shouldn't be a problem.Best RegardsOskar R Quote Link to comment Share on other sites More sharing options...
ataria Posted November 23, 2006 Share Posted November 23, 2006 just do if statements..if (!$login_ip_1) { // Log IP.}elseif (!$login_ip_2) {// LOG IP.}elseif (!$login_ip_2) {// LOG IP.}elseif (!$login_ip_4) {// LOG IP.}else {// LOG IP.} Quote Link to comment Share on other sites More sharing options...
Stooney Posted November 23, 2006 Share Posted November 23, 2006 well first off that will give you a max of 5 recorded ip's. Instead use 2 tables, one will be for storing user data (username, password, etc) and their user id. Then in the second table, record ip's with it. (table will look like id, ip, userid). Now each time an ip is stored, store their userid with it so it can be matched to a username from table 1. Hope it makes sense.Table 1:idusernamepasswordemailetc etcTable 2:id (not user id, this is the ip's id)ip_addressuser_id (the user id corresponding to this ip address) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.