Wiki source for TrackIPaddressMod


Show raw source

The start of my effort to bring sme kind of tracking mode into play for the spam problem. The data is now inserted into the database, I've got it displayed in a couple of places for my (and my Modrators') use ... at least now have a starting point for figuring out where to go next with it ... We're playing around with some of the "Group" mods now trying to see if this is really viable on this tool for doing a Ban action ....

Baseline: Latest stable release: Wikka-1.1.6.1.tar.gz Released on December 23, 2005 is the version available for download, yet .... the version in use at 'Home Base' shows as; Powered by Wikka Wakka Wiki 1.1.6.0 (enhanced with some Beta features) ...

Other than the movement of some file locations, the 'changes' work with 1.1.6.2

http://wikkawiki.org/UserRegistration 2005-07-11 09:48:05 ""NilsLindenberg""
http://wikkawiki.org/RegisterAction 2005-07-19 18:09:53 ""DarTar""
http://wikkawiki.org/RegisterUserIpAddress 2005-07-19 22:15:02 ""JavaWoman""
http://wikkawiki.org/ExpandedAdminBackupTool 2006-02-10 00:37:07 ""GmBowen""
http://wikkawiki.org/PageAdminAction 2006-02-18 06:27:27 ""DarTar""

None of these pages are up to date, content is questionable, status is unknown
However, these are the routines I'm working with, some of them needed work to get running on my install (and some of these need yet other mods installed)

I went with ""IPv4"" (15 digits) for now, hoping that if/when the next release makes it out, ""IPv6"" will be accounted for elsewhere.

I changed the 'ipaddress' variable to 'regipaddress' for the user table .... 'postipaddress' for the page and comment tables.

Quick (?) listing of changes made;
%%(sql)
show tables;
+--------------------------+
| wikka_acls |
| wikka_comments |
| wikka_links |
| wikka_pages |
| wikka_referrer_blacklist |
| wikka_referrers |
| wikka_resetpasswords |
| wikka_users |
| wikka_wikkaforum |
+--------------------------+
9 rows in set (0.00 sec)
%%
mysql> ALTER TABLE wikka_users ADD regipaddress varchar(15) DEFAULT NULL AFTER signuptime;
Query OK, 15 rows affected (0.03 sec)
Records: 15 Duplicates: 0 Warnings: 0

mysql> ALTER TABLE wikka_comments ADD postipaddress varchar(15) DEFAULT NULL;
Query OK, 22 rows affected (0.01 sec)
Records: 22 Duplicates: 0 Warnings: 0

mysql> ALTER TABLE wikka_pages ADD postipaddress varchar(15) DEFAULT NULL AFTER user;
Query OK, 554 rows affected (0.73 sec)
Records: 554 Duplicates: 0 Warnings: 0

%%(sql)
describe wikka_users;
+-----------------+------------------+------+-----+---------------------+-------+
| Field | Type | Null | Key | Default | Extra |
+-----------------+------------------+------+-----+---------------------+-------+
| name | varchar(75) | | PRI | | |
| password | varchar(32) | | | | |
| email | varchar(50) | | | | |
| revisioncount | int(10) unsigned | | | 20 | |
| changescount | int(10) unsigned | | | 50 | |
| doubleclickedit | enum('Y','N') | | | Y | |
| signuptime | datetime | | MUL | 0000-00-00 00:00:00 | |
| regipaddress | varchar(15) | YES | | NULL | |
| show_comments | enum('Y','N') | | | N | |
+-----------------+------------------+------+-----+---------------------+-------+
9 rows in set (0.00 sec)

describe wikka_comments;
+---------------+------------------+------+-----+---------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+------------------+------+-----+---------------------+----------------+
| id | int(10) unsigned | | PRI | NULL | auto_increment |
| page_tag | varchar(75) | | MUL | | |
| time | datetime | | MUL | 0000-00-00 00:00:00 | |
| comment | text | | | | |
| user | varchar(75) | | | | |
| postipaddress | varchar(15) | YES | | NULL | |
+---------------+------------------+------+-----+---------------------+----------------+
6 rows in set (0.01 sec)

mysql> describe wikka_pages;
+---------------+-----------------------+------+-----+---------------------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+-----------------------+------+-----+---------------------+----------------+
| id | int(10) unsigned | | PRI | NULL | auto_increment |
| tag | varchar(75) | | MUL | | |
| time | datetime | | MUL | 0000-00-00 00:00:00 | |
| body | mediumtext | | MUL | | |
| owner | varchar(75) | | | | |
| user | varchar(75) | | | | |
| postipaddress | varchar(15) | YES | | NULL | |
| latest | enum('Y','N','H','V') | | MUL | N | |
| note | varchar(100) | | | | |
| handler | varchar(30) | | | page | |
+---------------+-----------------------+------+-----+---------------------+----------------+
10 rows in set (0.00 sec)
%%
%%(php)
....../actions/useradmin.php

if ($userdata) {

/*$ipheader = '<a href="'.$this->Href('','', (($sort == 'ipaddress' && $d == 'desc')? 'l='.$l.'&sort=ipaddress&d=asc' : 'l='.$l.'&sort=ipaddress&d=desc')).'" title="'.TABLE_HEADING_SIGNUPIP_TITLE.'">'.TABLE_HEADING_SIGNUPIP.'</a>'; # installed as beta feature at wikka.jsnx.com */
$ipheader = '<a href="'.$this->Href('','', (($sort == 'regipaddress' && $d == 'desc')? 'l='.$l.'&sort=regipaddress&d=asc' : 'l='.$l.'&sort=regipaddress&d=desc')).'" title="'.TABLE_HEADING_SIGNUPIP_TITLE.'">'.TABLE_HEADING_SIGNUPIP.'</a>'; # per modifications here

// build table headers
/* " <th>".$ipheader."</th>\n". # installed as beta feature at wikka.jsnx.com */
" <th>".$ipheader."</th>\n". # definite quesrion mark here ...?????

// build table body
$htmlout .= "<tbody>\n";
if ($r_color == 1) {
$htmlout .= "<tr ".(($r%2)? '' : 'class="alt"').">\n"; #enable alternate row color
} else {
$htmlout .= "<tr>\n"; #disable alternate row color
}
$htmlout .= " <td><input type=\"checkbox\" id=\"".$user['id']."\"".$checked." title=\"".sprintf(SELECT_RECORD_TITLE,$user['name'])."\"/></td>\n".
" <td>".(($this->ExistsPage($user['name']))? $this->Link($user['name']) : $user['name'])."</td>\n". #check if userpage exists
" <td>".$user['email']."</td>\n".
" <td class=\"time\">".$user['signuptime']."</td>\n".
/* " <td>".$user['ipaddress']."</td>\n". # installed as beta feature at wikka.jsnx.com */
" <td>".$user['regipaddress']."</td>\n". # per modofied files here
" <td class=\"number".(($c_color == 1)? ' c1' : '')."\">".$ownedlink."</td>\n". #set column color
" <td class=\"number".(($c_color == 1)? ' c2' : '')."\">".$changeslink."</td>\n". #set column color
" <td class=\"number".(($c_color == 1)? ' c3' : '')."\">".$commentslink."</td>\n". #set column color
" <td class=\"center\">".$deleteuser." :: ".$feedbackuser."</td>\n";
$htmlout .= " </tr>\n</tbody>\n";

......./actions/usersettings.php

// is user trying to log in or register?

$this->Query("insert into ".$this->config["table_prefix"]."users set ".
"signuptime = now(), ".
"name = '".mysql_real_escape_string($name)."', ".
"email = '".mysql_real_escape_string($email)."', ".
"regipaddress = '".mysql_real_escape_string($_SERVER['REMOTE_ADDR'])."', ".
"password = md5('".mysql_real_escape_string($_POST["password"])."')");

........./wikka.php (1.1.6.1)
........./libs/Wakka.class.php (1.1.6.2)
function SavePage($tag, $body, $note)

// add new revision
// added the postipaddress line per IP address Tracking mod 10 Apr 2006
$this->Query("insert into ".$this->config["table_prefix"]."pages set ".
"tag = '".mysql_real_escape_string($tag)."', ".
"time = now(), ".
"owner = '".mysql_real_escape_string($owner)."', ".
"user = '".mysql_real_escape_string($user)."', ".
"postipaddress = '".mysql_real_escape_string($_SERVER['REMOTE_ADDR'])."', ".
"note = '".mysql_real_escape_string($note)."', ".
"latest = 'Y', ".
"body = '".mysql_real_escape_string($body)."'");


/* Code section below modified per a IP address tracking mod applied 10 Apr 2006
function SaveComment($page_tag, $comment)
{
// get current user
$user = $this->GetUserName();

// add new comment
$this->Query("INSERT INTO ".$this->config["table_prefix"]."comments SET ".
"page_tag = '".mysql_real_escape_string($page_tag)."', ".
"time = now(), ".
"comment = '".mysql_real_escape_string($comment)."', ".
"user = '".mysql_real_escape_string($user)."'");
} */

function SaveComment($page_tag, $comment)
{
// get current user
$user = $this->GetUserName();

// add new comment
$this->Query("INSERT INTO ".$this->config["table_prefix"]."comments SET ".
"page_tag = '".mysql_real_escape_string($page_tag)."', ".
"time = now(), ".
"comment = '".mysql_real_escape_string($comment)."', ".
"user = '".mysql_real_escape_string($user)."', ".
"postipaddress = '".mysql_real_escape_string($_SERVER['REMOTE_ADDR'])."'");
}
// Code section above modified per a IP address tracking mod applied 10 Apr 2006
%%

%%(php)
........../actions/wikkamanagement.php
// Modified below with postipaddress stuff for IP address tracking
$revisions = $this->LoadAll("SELECT `id`,`tag`,`time`,`user`,`latest`,`postipaddress` FROM `$t_pages` WHERE `tag`='$show_page' ORDER BY `time` DESC");
echo
'<H4>Manage Revisions: '.$show_page.'</H4>'.
'<a href="'.$this_link4.'"><=Back</a>'.
'<form action="'.$this_link3.'" method="POST">'.
'<table border="0" callspacing="0" cellpadding="0">'.
'<tr bgcolor="#DDDDDD">'.
'<th nowrap> Time: </th>'.
'<th nowrap> User: </th>'.
'<th nowrap> PostingIP: </th>'.
'<th nowrap>  </th>'.
'<th nowrap> Delete: </th>'.
'<th nowrap> Hide: </th>'.
'</tr>';

$i = 0;
foreach ($revisions as $revision) {
$id = &$revision['id'];
$tag = &$revision['tag'];
$time = &$revision['time'];
$user = &$revision['user'];
$postip = &$revision['postipaddress'];
$latest = &$revision['latest'];
$current_rev = ($latest == 'Y');
$hidden_rev = ($latest == 'V');

$color = ($i%2)?"#ffffff":"#f5f6f7";
echo
'<tr bgcolor="'.$color.'">';

if ($current_rev) {
echo '<td nowrap> <a href="'.$this->Href('show',$tag).'"><b>'.$time.'</b></a> </td>'.
'<td nowrap> <b>'.$user.'</b> </td>';
} else if ($hidden_rev) {
echo '<td nowrap> <font color="gray">'.$time.'</font> </td>'.
'<td nowrap> <font color="gray">'.$user.'</font> </td>';
} else {
echo '<td nowrap> <a href="'.$this->Href('show',$tag,'time=').urlencode($time).'">'.$time.'</a> </td>'.
'<td nowrap> '.$user.' </td>';
}
echo '<td nowrap> '.$postip.' </td>';
echo
'<td align="center">'.
'<input type="hidden" name="id['.$i.']" value="'.$id.'" />'.
'<input type="radio" name="action['.$i.']" value="restore_revision" '.($current_rev?'disabled':'').' '.(!$hidden_rev?'checked':'').'/>'.
'</td>'.
'<td align="center">'.
'<input type="radio" name="action['.$i.']" value="delete_revision" '.($current_rev?'disabled':'').'/>'.
'</td>'.
'<td align="center">'.
'<input type="radio" name="action['.$i.']" value="hide_revision" '.($current_rev?'disabled':'').' '.($hidden_rev?'checked':'').'/>'.
'</td>'.
'</tr>';
$i++;
}
//end of mod
%%
----
CategoryDevelopmentSecurity
CategoryDevelopmentAntiSpam
CategoryUserContributions
----
Valid XHTML :: Valid CSS: :: Powered by WikkaWiki