1

Topic: ip address record at login

Well I created this mod to record each IP when users log.

So here are the steps:

1) go to your mysql and execute this sql command:

ALTER TABLE  `vld_members` ADD  `ipaddresslogin` VARCHAR( 16 ) CHARACTER SET ucs2 COLLATE ucs2_general_ci NOT NULL DEFAULT  '127.0.0.1'


2) edit includes/lib/lib.account_login.php

3) search for

if ($SESSION->auth) {


After if ($SESSION->auth) {
add:

// log ip connection MOD by Hacka
$iplogin= $_SERVER['REMOTE_ADDR'];
mysql_query("UPDATE  vld_members SET ipaddresslogin='$iplogin' WHERE member_id=".$_SESSION['member_id']."");


4) edit includes/templates/members_edit.tpl

Search for:

<tr>
                <td class="gridLabels2">
                    {lang:"members","referrer"}

BEFORE ADD:

<tr>
                <td class="gridLabels1">
                    {lang:"members","iplogin"}</td>
                <td class="gridValue1">
                    <!-- IF member_id -->
                        <a target="_blank" href="http://www.infosniper.net/index.php?ip_address={ipaddresslogin}&map_source=1&overview_map=1&lang=1&map_type=1&zoom_level=7">{ipaddresslogin}</a>
                        {country_flag}
                        <!-- IF ipaddress_banned -->
                            [ <a class="grid" href="#" onclick="javascript:confirmLink('{lang:"members","unbanip?"}', '{top.virtual_cp_path}index.php?m=members&p=unbanip&id={member_id}&s={ipaddresslogin}')">{lang:"members","unbanip"}</a> ]
                        <!-- ELSE -->
                            [ <a class="grid" href="#" onclick="javascript:confirmLink('{lang:"members","banip?"}', '{top.virtual_cp_path}index.php?m=members&p=banip&id={member_id}&s={ipaddresslogin}')">{lang:"members","banip"}</a> ]
                        <!-- ENDIF -->
                        [ <a class="grid" href="#" onclick="javascript:confirmLink('{lang:"members","spammer?"}', '{top.virtual_cp_path}index.php?m=members&p=spammer&id={member_id}&s={ipaddresslogin}')">{lang:"members","spammer"}</a> ]
                    <!-- ELSE -->
                        {ipaddresslogin}
                    <!-- ENDIF -->

                </td>
            </tr>


5) Edit your language file in includes/language/{YOUR LANGUAGE FOLDER}/lang.cp.members.php

search for

"unbanip" =>


BEFORE ADD:

"iplogin" =>
"logged-in IP",

6)edit  includes/cp/cp.search.php

after

$TEMPLATE->assign("ipaddress", $ipaddress);

add:

$TEMPLATE->assign("ipaddresslogin", $ipaddresslogin);

search for

    $ipaddress = isset($profile_obj['ipaddress']) ? $profile_obj['ipaddress'] : '127.0.0.1';

after add

    $ipaddresslogin = isset($profile_obj['ipaddresslogin']) ? $profile_obj['ipaddresslogin'] : '127.0.0.1';

7) edit includes/cp/cp.search.php

    if ($where == "all")
        $sqlquery = "(username LIKE '%$what%' OR email LIKE '%$what%' OR ipaddress LIKE '%$what%')";

change into

    if ($where == "all")
        $sqlquery = "(username LIKE '%$what%' OR email LIKE '%$what%' OR ipaddress LIKE '%$what%' OR ipaddresslogin LIKE '%$what%')";

And it is done!

Last edited by Zoheir (2011-12-09 13:00:24)

2

Re: ip address record at login

This record the new ip address but what happens with the old ip addresses?

thanks

VPS & Dedicated Hosting Servint

3

Re: ip address record at login

it record only the last ip used for the login. But it keeps le ip address recorded when user registered.

Last edited by Zoheir (2011-12-01 03:40:36)

4

Re: ip address record at login

I try your mod, but this is what it looks in my control panel

{iplogin}  [ ban ip ] [ spammer ]

Instead of getting a ip address I get this {iplogin}

VPS & Dedicated Hosting Servint

5

Re: ip address record at login

i think you didn'tmodify your sql database or your database prefix is different from vld_

please try this sql command in your phpmyadmin :

ALTER TABLE  `vld_members` ADD  `ipaddresslogin` VARCHAR( 16 ) CHARACTER SET ucs2 COLLATE ucs2_general_ci NOT NULL DEFAULT  '127.0.0.1'

if your table prefix is different:

ALTER TABLE  `[b]yourprefix[/b]members` ADD  `ipaddresslogin` VARCHAR( 16 ) CHARACTER SET ucs2 COLLATE ucs2_general_ci NOT NULL DEFAULT  '127.0.0.1'

Last edited by Zoheir (2011-12-08 12:08:14)

6

Re: ip address record at login

My prefix is not different from vld_

VPS & Dedicated Hosting Servint

7

Re: ip address record at login

Zoheir in your mod you are not asigning the ip value to the template variable {iplogin}

8

Re: ip address record at login

Anyone can help with this?

VPS & Dedicated Hosting Servint

9

Re: ip address record at login

I've found my error!!!! I made an error while preparing the toturial

replace $iplogin with $ipaddresslogin in this section:

<tr>
                <td class="gridLabels1">
                    {lang:"members","iplogin"}</td>
                <td class="gridValue1">
                    <!-- IF member_id -->
                        <a target="_blank" href="http://www.infosniper.net/index.php?ip_address={iplogin}&map_source=1&overview_map=1&lang=1&map_type=1&zoom_level=7">{iplogin}</a>
                        {country_flag}
                        <!-- IF ipaddress_banned -->
                            [ <a class="grid" href="#" onclick="javascript:confirmLink('{lang:"members","unbanip?"}', '{top.virtual_cp_path}index.php?m=members&p=unbanip&id={member_id}&s={iplogin}')">{lang:"members","unbanip"}</a> ]
                        <!-- ELSE -->
                            [ <a class="grid" href="#" onclick="javascript:confirmLink('{lang:"members","banip?"}', '{top.virtual_cp_path}index.php?m=members&p=banip&id={member_id}&s={iplogin}')">{lang:"members","banip"}</a> ]
                        <!-- ENDIF -->
                        [ <a class="grid" href="#" onclick="javascript:confirmLink('{lang:"members","spammer?"}', '{top.virtual_cp_path}index.php?m=members&p=spammer&id={member_id}&s={iplogin}')">{lang:"members","spammer"}</a> ]
                    <!-- ELSE -->
                        {iplogin}
                    <!-- ENDIF -->
                </td>
            </tr>

so that it looks like:

<tr>
                <td class="gridLabels1">
                    {lang:"members","iplogin"}</td>
                <td class="gridValue1">
                    <!-- IF member_id -->
                        <a target="_blank" href="http://www.infosniper.net/index.php?ip_address={ipaddresslogin}&map_source=1&overview_map=1&lang=1&map_type=1&zoom_level=7">{ipaddresslogin}</a>
                        {country_flag}
                        <!-- IF ipaddress_banned -->
                            [ <a class="grid" href="#" onclick="javascript:confirmLink('{lang:"members","unbanip?"}', '{top.virtual_cp_path}index.php?m=members&p=unbanip&id={member_id}&s={ipaddresslogin}')">{lang:"members","unbanip"}</a> ]
                        <!-- ELSE -->
                            [ <a class="grid" href="#" onclick="javascript:confirmLink('{lang:"members","banip?"}', '{top.virtual_cp_path}index.php?m=members&p=banip&id={member_id}&s={ipaddresslogin}')">{lang:"members","banip"}</a> ]
                        <!-- ENDIF -->
                        [ <a class="grid" href="#" onclick="javascript:confirmLink('{lang:"members","spammer?"}', '{top.virtual_cp_path}index.php?m=members&p=spammer&id={member_id}&s={ipaddresslogin}')">{lang:"members","spammer"}</a> ]
                    <!-- ELSE -->
                        {ipaddresslogin}
                    <!-- ENDIF -->
                </td>
            </tr>

Last edited by Zoheir (2011-12-09 03:15:29)

10

Re: ip address record at login

It still does't work, now it reads {$ipaddresslogin}

VPS & Dedicated Hosting Servint

11

Re: ip address record at login

it works for me.

12

Re: ip address record at login

thejackal wrote:

It still does't work, now it reads {$ipaddresslogin}


you made an error! it is not {$ipaddresslogin} but {ipaddresslogin}

13

Re: ip address record at login

Ok I type it wrong, the error that I get now is {ipaddresslogin}

VPS & Dedicated Hosting Servint

14

Re: ip address record at login

have you cleared you cp cache?

15

Re: ip address record at login

Sorry, but it still not working...

VPS & Dedicated Hosting Servint

16

Re: ip address record at login

which vldpersonals version do you have

17

Re: ip address record at login

Zoheir wrote:

which vldpersonals version do you have

try this:

edit includes/cp/cp.members.php

after

$TEMPLATE->assign("ipaddress", $ipaddress);

add:

$TEMPLATE->assign("ipaddresslogin", $ipaddresslogin);

18

Re: ip address record at login

Nope that didn't' work. Is this mod working on you?

VPS & Dedicated Hosting Servint

19

Re: ip address record at login

yes it works on my vldpersonals website. on my version i didn't need to assign variable.

Last edited by Zoheir (2011-12-09 12:17:08)

20

Re: ip address record at login

you can also add:

after

    $ipaddress = isset($profile_obj['ipaddress']) ? $profile_obj['ipaddress'] : '127.0.0.1';
    $ipaddresslogin = isset($profile_obj['ipaddresslogin']) ? $profile_obj['ipaddresslogin'] : '127.0.0.1';

21

Re: ip address record at login

It work some now, it display the ipaddress, but I don't think is recorded on the database. When you do a search for that new Ipaddress no members are displayed.

for instance this work

<a href="http://www.mydomain.com/cpll/index.php?what={ipaddress}&where=all&submit=Submit&issearch=1&m=search&p=search"><u>IP Search</u></a>

but your don't

<a href="http://www.mydomain.com/cpll/index.php?what={ipaddresslogin}&where=all&submit=Submit&issearch=1&m=search&p=search"><u>IP Search</u></a>

Last edited by thejackal (2011-12-09 12:37:10)

VPS & Dedicated Hosting Servint

22

Re: ip address record at login

this ip address is recorded in database at each user login. but with my mod you cannot search member with the ip address.

I have to update this mod to allow ip login search

23

Re: ip address record at login

i think this will work:

search for

    if ($where == "all")
        $sqlquery = "(username LIKE '%$what%' OR email LIKE '%$what%' OR ipaddress LIKE '%$what%')";

change into

    if ($where == "all")
        $sqlquery = "(username LIKE '%$what%' OR email LIKE '%$what%' OR ipaddress LIKE '%$what%' OR ipaddresslogin LIKE '%$what%')";

24

Re: ip address record at login

Oh no...that's the only reason I installed it. Don't think it would be of any use without that.

VPS & Dedicated Hosting Servint

25

Re: ip address record at login

Zoheir wrote:

i think this will work:

search for

    if ($where == "all")
        $sqlquery = "(username LIKE '%$what%' OR email LIKE '%$what%' OR ipaddress LIKE '%$what%')";

change into

    if ($where == "all")
        $sqlquery = "(username LIKE '%$what%' OR email LIKE '%$what%' OR ipaddress LIKE '%$what%' OR ipaddresslogin LIKE '%$what%')";

What file?

VPS & Dedicated Hosting Servint