Re: Looking for a username change log database script
Why dont you just make it so they have to pay to change there name?
Or heres a quick username log for you.
V2
staff_logs.php
Find:
case 'stafflogs': view_staff_logs(); break;
Add after:
case 'usernamelogs': view_name_logs(); break;
Find:
$h->endpage();
Add befor:
function view_name_logs()
{
global $db,$ir,$c,$h,$userid;
if($ir['user_level'] != 2)
{
die("403");
}
$_GET['st']=abs((int) $_GET['st']);
$rpp=100;
echo "<h3>Username Logs</h3>
<table width=100% cellspacing='0' border='1' class='table'><tr> <th>Userid</th> <th>Old Name</th> <th>New Name</th><th>Time</th> <th>IP</th> </tr>";
$q=$db->query("SELECT n.*, u.* FROM namelogs n LEFT JOIN users u ON n.user=u.userid ORDER BY n.time DESC LIMIT {$_GET['st']},$rpp");
while($r=$db->fetch_row($q))
{
echo "<tr><td>{$r['user']}</td> <td>{$r['oldname']}</td> <td>{$r['newname']}</td><td>".date('F j Y g:i:s a', $r['time'])."</td><td>{$r['ip']}</td></tr>";
}
echo "</table>
";
$mypage=floor($_GET['st']/$rpp)+1;
$q2=$db->query("SELECT id FROM namelogs");
$rs=$db->num_rows($q2);
$pages=ceil($rs/$rpp);
echo "Pages: ";
for($i=1;$i<=$pages;$i++)
{
$st=($i-1)*$rpp;
echo "[url='staff_logs.php?action=usernamelogs&st=$st']$i[/url] ";
if($i % 7 == 0) { echo "
\n"; }
}
}
Open preferences.php
Fine:
$_POST['newname']=str_replace(array("<", ">", "\\\'"), array("<", ">", "'"), $_POST['newname']);
Add befor
$db->query("INSERT INTO namelogs VALUES('',$userid,'{$ir['username']}','{$_POST['newname']}', unix_timestamp(), '{$ir['lastip']}')");
SQL:
CREATE TABLE `namelogs` (
`id` int(11) NOT NULL auto_increment,
`user` int(11) NOT NULL default '0',
`oldname` varchar(255) NOT NULL default '',
`newname` varchar(255) NOT NULL default '',
`time` int(11) NOT NULL default '',
`ip` varchar(15) NOT NULL default '',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
I have not tested this but it should work.