Jump to content
MakeWebGames

Add Users IP into Database


Galahad

Recommended Posts

This is a simple modification to the register that inputs the users ip in the database upon registration.

 

This is very useful if you want to stop cheaters who try to multi ip.

Put this query in phpmyadmin -

 

ALTER TABLE players ADD regip varchar(16) NOT NULL

 

Now open up the register module and find this -

$insert['password'] = sha1($insert['secret_key'] . $_POST['password'] . SECRET_KEY);

 

Add below -

$insert['regip'] = $_SERVER['REMOTE_ADDR'];

 

and your done!

I may make a module soon to find out all the players with the same ip.

You could also add to viewplayer.tpl (if you have the module)

 

{if $player->rank == 10}
[b]IP:[/b]: {$player->regip}

{/if}
Link to comment
Share on other sites

Update -

Add last login IP address

/modules/login.index.php

Find -

$query = $this->db->execute('UPDATE `<ezrpg>players` SET `last_login`=? WHERE `id`=?', array(time(), $player->id));

 

Add underneath -

$query = $this->db->execute('UPDATE `<ezrpg>players` SET `lastip`=? WHERE `id`=?', array($_SERVER['REMOTE_ADDR'], $player->id));

 

And run this query -

ALTER TABLE players ADD lastip varchar(16) NOT NULL

 

Next IP module will be logs for my send gold module.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...