Steffen Buschkemper
June 8, 2013, 06:08 PM
Hello Juergen and all who need this feature,
Because of this thread here (http://www.flynax.com/forum/showthread.php?1227-Storing-IP-address-for-registration-listing-creation-and-comments-plugin&p=5210&viewfull=1#post5210) i present today this "little" guide.
Due to legal situations in some countries is the storing of User-IP addresses an important evidentiary.
Missing evidentiary can be expensive for website operators.
For example applies in Germany the "liability for interference".
Storing the IP Address at the registration process
The result you can see in the follow picture
540
Now let us start.
PART 1
Login into the Admin Panel and go to Common -> Database
Paste the follow SQL query
ALTER TABLE `{sql_prefix}accounts` ADD `User_IP` INT(11) UNSIGNED NOT NULL
and press the button "Go".
Finally paste the following SQL query to insert the phrase "User-IP" for table header (ext_userip). Language is english.
INSERT INTO `{sql_prefix}lang_keys` (`ID`, `Code`, `Module`, `Key`, `Value`, `Plugin`, `Status`) VALUES (NULL, 'en', 'ext', 'ext_userip', 'User-IP', '', 'active')
and press the button "Go".
PART 2
Open admin => tpl => controllers => accounts.tpl
Find the follow code
{name: 'Username', mapping: 'Username', type: 'string'},
{name: 'Name', mapping: 'Name', type: 'string'},
{name: 'Mail', mapping: 'Mail', type: 'string'},
{name: 'Status', mapping: 'Status'},
{name: 'Type', mapping: 'Type', type: 'string'},
{name: 'Type_name', mapping: 'Type_name', type: 'string'},
{name: 'thumbnail', mapping: 'thumbnail', type: 'string'},
{name: 'fields', mapping: 'fields', type: 'string'},
{name: 'ID', mapping: 'ID', type: 'int'},
{name: 'Date', mapping: 'Date', type: 'date', dateFormat: 'Y-m-d H:i:s'}
and change as follow
{name: 'Username', mapping: 'Username', type: 'string'},
{name: 'Name', mapping: 'Name', type: 'string'},
{name: 'Mail', mapping: 'Mail', type: 'string'},
{name: 'Status', mapping: 'Status'},
{name: 'Type', mapping: 'Type', type: 'string'},
{name: 'Type_name', mapping: 'Type_name', type: 'string'},
{name: 'User_IP', mapping: 'User_IP', type: 'string'}, /*New data definition for User-IP field*/
{name: 'thumbnail', mapping: 'thumbnail', type: 'string'},
{name: 'fields', mapping: 'fields', type: 'string'},
{name: 'ID', mapping: 'ID', type: 'int'},
{name: 'Date', mapping: 'Date', type: 'date', dateFormat: 'Y-m-d H:i:s'}
Next find the follow code
{
header: lang['ext_type'],
dataIndex: 'Type_name',
width: 13/*,
renderer: function(val, obj, row){
var out = '<a target="_blank" ext:qtip="'+lang['ext_click_to_edit']+'" href="'+rlUrlHome+'index.php?controller=account_types&action=edit&type='+row.data.Type+'">'+val+'</a>';
return out;
}*/
},
and change as follow
{
header: lang['ext_type'],
dataIndex: 'Type_name',
width: 13/*,
renderer: function(val, obj, row){
var out = '<a target="_blank" ext:qtip="'+lang['ext_click_to_edit']+'" href="'+rlUrlHome+'index.php?controller=account_types&action=edit&type='+row.data.Type+'">'+val+'</a>';
return out;
}*/
},{
header: lang['ext_userip'], /*Table header for User-IP field*/
dataIndex: 'User_IP', /*User_IP Data Field*/
width: 13,
},
Save and close the File.
PART 3
Open includes => classes => rlAccount.class.php
Find the follow code
// step 1
$data = array(
'Type' => $account_type_key,
'Username' => $profile['username'],
'Own_address' => $profile['location'],
'Password' => md5($profile['password']),
'Password_tmp' => $account_types[$type_id]['Email_confirmation'] ? $profile['password'] : '',
'Lang' => strtolower(RL_LANG_CODE),
'Mail' => $profile['mail'],
'Date' => 'NOW()'
);
and change as follow
function getClientIp()
{
$result = null;
$ipSourceList = array(
'HTTP_CLIENT_IP',
'HTTP_X_FORWARDED_FOR',
'HTTP_X_FORWARDED',
'HTTP_FORWARDED_FOR',
'HTTP_FORWARDED',
'REMOTE_ADDR'
);
foreach ($ipSourceList as $ipSource) {
if (isset($_SERVER[$ipSource])) {
$result = $_SERVER[$ipSource];
break;
}
}
return $result;
}
$user_ip = getClientIp();
// step 1 incl. new User-IP
$data = array(
'User_IP' => ip2long($user_ip),
'Type' => $account_type_key,
'Username' => $profile['username'],
'Own_address' => $profile['location'],
'Password' => md5($profile['password']),
'Password_tmp' => $account_types[$type_id]['Email_confirmation'] ? $profile['password'] : '',
'Lang' => strtolower(RL_LANG_CODE),
'Mail' => $profile['mail'],
'Date' => 'NOW()'
);
Save and close the File.
PART 4
Open admin => controllers => accounts.inc.php
Find the follow code
$sql = "SELECT SQL_CALC_FOUND_ROWS `ID`, CONCAT(`First_name`, ' ', `Last_name`) AS `Name`, `Username`, `Type`, `Status`, `Mail`, `Date`, `Photo`, ";
and change as follow
$sql = "SELECT SQL_CALC_FOUND_ROWS `ID`, CONCAT(`First_name`, ' ', `Last_name`) AS `Name`, `Username`, `Type`, INET_NTOA(`User_IP`) AS `User_IP`, `Status`, `Mail`, `Date`, `Photo`, ";
Save and close the File.
OK these were the parts to store the user ip during the registration process.
Next part is "Storing the User-IP address when add comments"
Best regards
Steffen
Because of this thread here (http://www.flynax.com/forum/showthread.php?1227-Storing-IP-address-for-registration-listing-creation-and-comments-plugin&p=5210&viewfull=1#post5210) i present today this "little" guide.
Due to legal situations in some countries is the storing of User-IP addresses an important evidentiary.
Missing evidentiary can be expensive for website operators.
For example applies in Germany the "liability for interference".
Storing the IP Address at the registration process
The result you can see in the follow picture
540
Now let us start.
PART 1
Login into the Admin Panel and go to Common -> Database
Paste the follow SQL query
ALTER TABLE `{sql_prefix}accounts` ADD `User_IP` INT(11) UNSIGNED NOT NULL
and press the button "Go".
Finally paste the following SQL query to insert the phrase "User-IP" for table header (ext_userip). Language is english.
INSERT INTO `{sql_prefix}lang_keys` (`ID`, `Code`, `Module`, `Key`, `Value`, `Plugin`, `Status`) VALUES (NULL, 'en', 'ext', 'ext_userip', 'User-IP', '', 'active')
and press the button "Go".
PART 2
Open admin => tpl => controllers => accounts.tpl
Find the follow code
{name: 'Username', mapping: 'Username', type: 'string'},
{name: 'Name', mapping: 'Name', type: 'string'},
{name: 'Mail', mapping: 'Mail', type: 'string'},
{name: 'Status', mapping: 'Status'},
{name: 'Type', mapping: 'Type', type: 'string'},
{name: 'Type_name', mapping: 'Type_name', type: 'string'},
{name: 'thumbnail', mapping: 'thumbnail', type: 'string'},
{name: 'fields', mapping: 'fields', type: 'string'},
{name: 'ID', mapping: 'ID', type: 'int'},
{name: 'Date', mapping: 'Date', type: 'date', dateFormat: 'Y-m-d H:i:s'}
and change as follow
{name: 'Username', mapping: 'Username', type: 'string'},
{name: 'Name', mapping: 'Name', type: 'string'},
{name: 'Mail', mapping: 'Mail', type: 'string'},
{name: 'Status', mapping: 'Status'},
{name: 'Type', mapping: 'Type', type: 'string'},
{name: 'Type_name', mapping: 'Type_name', type: 'string'},
{name: 'User_IP', mapping: 'User_IP', type: 'string'}, /*New data definition for User-IP field*/
{name: 'thumbnail', mapping: 'thumbnail', type: 'string'},
{name: 'fields', mapping: 'fields', type: 'string'},
{name: 'ID', mapping: 'ID', type: 'int'},
{name: 'Date', mapping: 'Date', type: 'date', dateFormat: 'Y-m-d H:i:s'}
Next find the follow code
{
header: lang['ext_type'],
dataIndex: 'Type_name',
width: 13/*,
renderer: function(val, obj, row){
var out = '<a target="_blank" ext:qtip="'+lang['ext_click_to_edit']+'" href="'+rlUrlHome+'index.php?controller=account_types&action=edit&type='+row.data.Type+'">'+val+'</a>';
return out;
}*/
},
and change as follow
{
header: lang['ext_type'],
dataIndex: 'Type_name',
width: 13/*,
renderer: function(val, obj, row){
var out = '<a target="_blank" ext:qtip="'+lang['ext_click_to_edit']+'" href="'+rlUrlHome+'index.php?controller=account_types&action=edit&type='+row.data.Type+'">'+val+'</a>';
return out;
}*/
},{
header: lang['ext_userip'], /*Table header for User-IP field*/
dataIndex: 'User_IP', /*User_IP Data Field*/
width: 13,
},
Save and close the File.
PART 3
Open includes => classes => rlAccount.class.php
Find the follow code
// step 1
$data = array(
'Type' => $account_type_key,
'Username' => $profile['username'],
'Own_address' => $profile['location'],
'Password' => md5($profile['password']),
'Password_tmp' => $account_types[$type_id]['Email_confirmation'] ? $profile['password'] : '',
'Lang' => strtolower(RL_LANG_CODE),
'Mail' => $profile['mail'],
'Date' => 'NOW()'
);
and change as follow
function getClientIp()
{
$result = null;
$ipSourceList = array(
'HTTP_CLIENT_IP',
'HTTP_X_FORWARDED_FOR',
'HTTP_X_FORWARDED',
'HTTP_FORWARDED_FOR',
'HTTP_FORWARDED',
'REMOTE_ADDR'
);
foreach ($ipSourceList as $ipSource) {
if (isset($_SERVER[$ipSource])) {
$result = $_SERVER[$ipSource];
break;
}
}
return $result;
}
$user_ip = getClientIp();
// step 1 incl. new User-IP
$data = array(
'User_IP' => ip2long($user_ip),
'Type' => $account_type_key,
'Username' => $profile['username'],
'Own_address' => $profile['location'],
'Password' => md5($profile['password']),
'Password_tmp' => $account_types[$type_id]['Email_confirmation'] ? $profile['password'] : '',
'Lang' => strtolower(RL_LANG_CODE),
'Mail' => $profile['mail'],
'Date' => 'NOW()'
);
Save and close the File.
PART 4
Open admin => controllers => accounts.inc.php
Find the follow code
$sql = "SELECT SQL_CALC_FOUND_ROWS `ID`, CONCAT(`First_name`, ' ', `Last_name`) AS `Name`, `Username`, `Type`, `Status`, `Mail`, `Date`, `Photo`, ";
and change as follow
$sql = "SELECT SQL_CALC_FOUND_ROWS `ID`, CONCAT(`First_name`, ' ', `Last_name`) AS `Name`, `Username`, `Type`, INET_NTOA(`User_IP`) AS `User_IP`, `Status`, `Mail`, `Date`, `Photo`, ";
Save and close the File.
OK these were the parts to store the user ip during the registration process.
Next part is "Storing the User-IP address when add comments"
Best regards
Steffen