Example #1
0
function logUserAction()
{
    $command = "--";
    if (isset($_POST['command'])) {
        $command = strtolower($_POST['command']);
    }
    if ($command == 'user_login' || $command == 'user_logout' || $command == 'new_comment' || $command == 'rate_comment' || $command == 'register_new_user' || $command == 'update_page_rating' || $command == 'add_tag' || $command == 'rate_tag' || $command == 'delete_tag' || $command == 'get_pages_with_tag' || $command == 'follow_contact' || $command == 'unfollow_contact' || $command == 'add_link' || $command == 'rate_link') {
        $IP = getIP();
        $user_id = -1;
        if (isset($_SESSION['user_id'])) {
            $user_id = $_SESSION['user_id'];
        } else {
            if (isset($_POST['user_name'])) {
                $user_name = $_POST['user_name'];
                $query = "SELECT id FROM User WHERE name = '" . $user_name . "'";
                $result = mysql_query($query);
                if (mysql_num_rows($result) != 0) {
                    $result_row = mysql_fetch_assoc($result);
                    $user_id = $result_row['id'];
                }
            }
        }
        $country = IPtoCountry($IP);
        $query = "INSERT INTO ActivityLog (user_id, command, ip, country_code2) VALUE ('{$user_id}', '{$command}', '{$IP}', '{$country}')";
        $result = mysql_query($query);
    }
}
Example #2
0
	<tr align="center"><td colspan="2"><input type="submit" name="submit" value="Edit User"></td></tr>
</form>	
</table>
<br><br>
<table border="0" width="15%">
	<tr align="center">
		<td>IP</td>
		<td>Date last used</td>
	</tr>
	<?php 
    $result = $db->query('SELECT * FROM ' . $bot_name . '_ips WHERE id=' . $id) or f**k('Unable to fetch user IPs', true);
    while ($ips = $db->fetch_assoc($result)) {
        ?>
	<tr align="center">
		<td><?php 
        echo $ips['ip'] . ' (' . IPtoCountry($ips['ip']) . ')';
        ?>
</td>
		<td><?php 
        echo date($date_format, $ips['date']);
        ?>
</td>
	</tr>
	<?php 
    }
    ?>
</table>
<?php 
} elseif ($_GET['act'] == 'submitedit' && isset($_POST['form_sent'])) {
    $new_id = $_POST['form_id'];
    $new_username = strtolower(trim(stripslashes($_POST['form_username'])));