4images Forum & Community
4images Modifications / Modifikationen => Mods & Plugins (Requests & Discussions) => Topic started by: __G__ on January 29, 2007, 05:15:21 PM
-
hi can we record ip of people who registers the account on 4images ?
-
There use to be a mod for this. I think from The Oracle?
I have not seen it in a while and can not find it.
-
Well, just create a new field in your database and use for example
$user_ip = $site_sess->user_ip;
$additional_field_sql .= ", user_ip";
$additional_value_sql .= ", '$user_ip'";
in your register.php ... of course you have to include it in your adminarea etc, but that wouldnt be difficult ;)
-
bro i am not really a coder can u gimme instructions step by step please
-
use the search for "additional user field", there was a large thread somewhere ... use "user_ip" as your new userfield. After you've done that open your register.php,
and find:
if (!$error) {
$additional_field_sql = "";
$additional_value_sql = "";
if (!empty($additional_user_fields)) {
$table_fields = $site_db->get_table_fields(USERS_TABLE);
foreach ($additional_user_fields as $key => $val) {
if (isset($HTTP_POST_VARS[$key]) && isset($table_fields[$key])) {
$additional_field_sql .= ", $key";
$additional_value_sql .= ", '".un_htmlspecialchars(trim($HTTP_POST_VARS[$key]))."'";
}
}
}
right after add:
// IP Logging of new user
$user_ip = $site_sess->user_ip;
$additional_field_sql .= ", user_ip";
$additional_value_sql .= ", '$user_ip'";
save it, and you should see the IP in the admin area under "edit user" (if you followed the thread for the add. user field)
-
bro when i run the run it in php my admin it shows this
Error
There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem
ERROR: Unknown Punctuation String @ 22
STR: -&
SQL: $user_ip = $site_sess->user_ip
SQL query:
$user_ip = $site_sess->user_ip
MySQL said: Documentation
#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '$user_ip = $site_sess->user_ip' at line 1
-
Well, just create a new field in your database
Do you have done it bevor?
$user_ip = $site_sess->user_ip
And this is not for phpmyamdin!!!
-
how do we do that bro
-
ALTER TABLE `XXXX_users` ADD `user_ip` VARCHAR( 20 ) NOT NULL ;
Use the SQL Snippet (in phpmyadmin) to create a new Field (user_ip) in the User Table (rename XXXX_users)...
Good speed....
-
i am still lost abt this database thingy :(
-
SQL query:
ALTER TABLE `XXXX_users` ADD `user_ip` VARCHAR( 20 ) NOT NULL
.XXXX_users' doesn't exist
-
The XXXX is inteded for you to change.
Depending on what you use in your database.
I believe if you did not make any changes to that on install it would be 4Images_users
So then you would run:
ALTER TABLE `4Images_users` ADD `user_ip` VARCHAR( 20 ) NOT NULL ;
-
wow thanks a lot >:D< it worked
-
i did everything i dont see the ip :( Username Email Date of registration Last activity Options
testaccount lol@lol.com 07.02.2007 06:59 07.02.2007 06:59
[Edit] [Delete] [Permissions] [User Groups]
-
hi erveryone.
its the same problem for me.
i can only see:
Username - Date - Date of registry - last action - options
???
thx for reply
-
try
echo "<td>".$user_row['user_ip']."</td>\n";
in your admin/users.php
after that line
echo "<td>".format_date($config['date_format']." ".$config['time_format'], $user_row[$user_table_fields['user_lastaction']])."</td>\n";
-
Hey Trez,
I'm not a coder so I am not sure what you have above.
I have a feeling what they are missing is this
Open lang/english/main.php
Add this before the closing ?>
//-----------------------------------------------------
//--- Registration IP Address----------------------
//-----------------------------------------------------
$lang['registered_ip'] = "Ip Address on Registration";
Open /includes/db_field_definitions.php
Add this before the closing ?>
$additional_user_fields['user_ip'] = array($lang['registered_ip'], "text", 0);
Like I said Im still learning, So if this is not the right way to do this , please let me know.
It worked for me tho.
-
@trez: you forgot something.. :wink:
:arrow: in admin/user find:
if ($countusers['users'] > 0) {
$sql = "SELECT ".USERS_TABLE.".".get_user_table_field("", "user_id").get_user_table_field(", ", "user_name").get_user_table_field(", ", "user_email").get_user_table_field(", ", "user_joindate").get_user_table_field(", ", "user_lastaction")."
replace it with this:
if ($countusers['users'] > 0) {
$sql = "SELECT ".USERS_TABLE.".".get_user_table_field("", "user_id").get_user_table_field(", ", "user_name").get_user_table_field(", ", "user_email").get_user_table_field(", ", "user_joindate").get_user_table_field(", ", "user_lastaction")." , user_ip
:arrow: then find:
echo "<td class=\"tableseparator\">".$lang['field_username']."</td>\n<td class=\"tableseparator\">".$lang['field_email']."</td>\n<td class=\"tableseparator\">".$lang['field_joindate']."</td>\n<td class=\"tableseparator\">".$lang['field_lastaction']."</td>\n<td class=\"tableseparator\">".$lang['options']."</td>\n</tr>\n";
and replace it with this:
echo "<td class=\"tableseparator\">".$lang['field_username']."</td>\n<td class=\"tableseparator\">".$lang['field_email']."</td>\n<td class=\"tableseparator\">".$lang['field_joindate']."</td>\n<td class=\"tableseparator\">".$lang['field_lastaction']."</td>\n<td class=\"tableseparator\">".$lang['field_user_ip']."</td>\n<td class=\"tableseparator\">".$lang['options']."</td>\n</tr>\n";
and then you go on with your steps...
:arrow: and then add in your lang/admin.php:
$lang['field_user_ip'] = "IP Adress";
-
Loda, your're right, i was in a rush ;)
-
What i posted works to..
Can you explain if this is not a good way to do this?
Im still trying to learn
thanks
-
it still don't show ip here r the files i edited