Here are my codes from the login page. I want to be able to count how many times have been using my website and also where they logged in from. I am able to do the count, but not the ipaddress.
In the table, I want it show each user data like this
These are the columns in my table. USERNAME, LAST LOGGED IN, TIMES LOGGING IN, IPADDRESS, IPADDRESS1, IPADDRESS, ...... IPADDRESS10. I have created all 10 different ip address columns ( I am not really sure how to make the followings looks like they are in the table, so I am really sorry )
USERNAME | LAST LOGGED IN | TIMES LOGGING IN | IPADDRESS | IPADDRESS1 | IPADDRESS2 ...... | IPADDRESS10
IHOP | 21-12-2012 8.59PM | 5 | 80.81.82.83 | 80.81.82.82 | 80.81.82.83
Every time a new ip address was used to log in from the same user, the ip address will be record into the table. Each user has up to 10 different ip addresses. The table is from my first thought, so I am not really sure if it's the best way to show them in the table or not, so please also give me a recommendation.
How do I add these ip addresses in to the table? I am not really sure how to separate each ip address column. When I got the new ip address, it just keeps overwriting the old ip address.
Thank you very much.
var $HOST = "website.com";
var $USERNAME = "username";
var $PASSWORD = "password";
var $DBNAME = "database";
function authenticate($username, $password) {
$Auth = new auth();
$detail = $Auth->authenticate($username, $password);
if (ereg("'", $username))
{
return "invalid username";
}
if (ereg("'", $password))
{
return "invalid password";
}
$query = "SELECT * FROM user WHERE uname='$username' AND passwd=MD5('$password') AND status <> 'inactive'";
$UpdateRecords = "UPDATE user SET lastlogin = NOW(), logincount = logincount + 1 WHERE uname='$username'";
$connection = mysql_connect($this->HOST, $this->USERNAME, $this->PASSWORD);
$SelectedDB = mysql_select_db($this->DBNAME);
$result = mysql_query($query);
$numrows = mysql_num_rows($result);
$row = mysql_fetch_array($result);
if ($numrows == 0) {
return 0;
}
*/
else {
$Update = mysql_query($UpdateRecords);
return $row;
}