View Single Post
  #1  
Old 08-21-2011, 01:54 AM
ipengu's Avatar
ipengu ipengu is offline
Member
 
Join Date: Aug 2011
Location: Central NY
Posts: 50
Gender: Male
Credits: 7,563
ipengu is on a distinguished road
Default IP Tracking/Account Limiter

BROKEN AS OF 1.2.3, WORKING ON NEW RELEASE.

So this was the first mod I ever did to this script, simply because I forseen possible abuse (besides fact the donate script is 100% bugged and should be fixed/removed)

MAKE SURE YOU MAKE BACKUPS

To start you need to open phpmyadmin or whatever you use to manage your MySQL database.
Add a new column to YOURPREFIXHERE_users name the column "ip" (Obviously not the " 's only the word ip)

Open: register.php
Find: (Around line 25)
PHP Code:
$hidden $_POST["hidden"]; 
Add After:
PHP Code:
$ip=$_SERVER['REMOTE_ADDR']; 
Find: (Around line 57-66)
PHP Code:
    //Next check that the username does not already exist...

    
$flag 0;
    
$query "SELECT * FROM ".$prefix."users WHERE username = '$username'";
    
$result = @runquery($query);
    
$num = @mysql_numrows($result);

    if(
$num 0){
    
$flag 1;
    } 
Add After:
PHP Code:
    //Let's deny them if they already have an account with their current IP - BETA
    
    
$ipflag 0;
    
$ipquery "SELECT * FROM ".$prefix."users WHERE ip = '$ip'";
    
$ipresult = @runquery($ipquery);
    
$ipnum = @mysql_numrows($ipresult);

    if(
$ipnum 0){
    
$ipflag 1;
    } 
Find: (Around line 112-116)
PHP Code:
    else if($flag 0){

    
//Username already exists
    
$article_title "Your username already exists";
    
$article_content $userexists;    

    } 
Add After:
PHP Code:
    else if($ipflag 0){

    
//ip already exists
    
$article_title "You already have an account";
    
$article_content $ipexists;    

    } 
Find: (Around line 140) NOTE: If you've already done edits to the registration this may not be what you find, that's alright just add , '$ip' to the end of whatever you have as since you just made the ip column it should be the last.
PHP Code:
runquery("INSERT INTO ".$prefix."users VALUES ('', '$username', '$pass1','$email','3','1', '$date', '0', '0' ,'0','0','','','','','', '{$GLOBALS['settings']['startmoney']}','','','$avatar', '', '', '', '0', 'Unknown', '')"); 
Replace with:
PHP Code:
runquery("INSERT INTO ".$prefix."users VALUES ('', '$username', '$pass1','$email','3','1', '$date', '0', '0' ,'0','0','','','','','', '{$GLOBALS['settings']['startmoney']}','','','$avatar', '', '', '', '0', 'Unknown', '', '$ip')"); 
Close + Save register.php

Open: admin.php
Find: (Around line 1570)
PHP Code:
<td width='60'><strong>Usergroup:</strong></td
Add After:
PHP Code:
<td width='60'><strong>IP:</strong></td
Find: (Around line 1611)
PHP Code:
$level=@mysql_result($result,$i,"usergroup"); 
Add After:
PHP Code:
$ip=@mysql_result($result,$i,"ip"); 
Find: (Around line 1619)
PHP Code:
<td><center>".$level."</center></td
Add After:
PHP Code:
<td><center>".$ip."</center></td
Close + Save admin.php

Open: login.php
Find: (Around line 20, still no idea why I did this but eh it's there.)
PHP Code:
$password $_POST["password"]; 
Add After:
PHP Code:
$ip=$_SERVER['REMOTE_ADDR']; 
Find:(Around line 68)
PHP Code:
$lpass=@mysql_result($result,$i,"password"); 
Add After:
PHP Code:
$lip=@mysql_result($result,$i,"ip"); 
Find: (Around line 71 ITS RIGHT AFTER THE LAST EDIT)
PHP Code:
$i++;

Add After:
PHP Code:
if ($lip == ""){
mysql_query("UPDATE ".$prefix."users SET ip='".$ip."' WHERE ip=''");  

Close + Save login.php

Open: lang/lang.php
Find: (Around line 18)
PHP Code:
$userexists "We're sorry, but the username you have selected already exists.  Please <a href='register.php'>go back</a> and choose another username."
Add After:
PHP Code:
$ipexists "We're sorry, but you're only allowed one account, our records show you already have an account.  Please <a href='login.php'>login here</a>."
Close + Save lang/lang.php
__________________
Coder/Marketer/Etc
Super busy, lack of time for computer related things for awhile.

Current Mods:
Slim Profile | Disallow unfreezing adoptable
Longer Shoutbox | IP Tracking/Account Limiter
Colorblast | Flux Series

In the works:
Integrated Forum (Very unlikely to be a free public mod, at first anyways)15%
Better admin control panel (current one is terrible)
Couple Themes
Few other things.

Last edited by ipengu; 08-28-2011 at 07:25 AM.
Reply With Quote