Ja ich weiß du hast auch so einen programmiert oxpus, aber mir gefällt der andere besser..
Ich hoffe ich bekomme aber trotzdem Hilfe!
Also, ich würde es gerne machen dass der MOD alle User außer mich zählt.
D.h. wenn ich ein Profil anklicke, soll der Counter nicht um eins hochgehen.
Aber wenn ich ein Profil anklicke, soll die Views schon sehen können, deshalb geht es nicht dass ich einfach vor den ganzen Code-Block if ( $userdata['user_id'] != 2 ) { --code -- } schreib, oder?.
Wo genau in diesem Code muss das hin, sodass oben beschriebener Effekt sich einstellt?
Code: Alles auswählen
#
#-----[ OPEN ]------------------------------------------
#
includes/usercp_viewprofile.php
#
#-----[ FIND ]------------------------------------------
#
if ( empty($HTTP_GET_VARS[POST_USERS_URL]) || $HTTP_GET_VARS[POST_USERS_URL] == ANONYMOUS )
{
message_die(GENERAL_MESSAGE, $lang['No_user_id_specified']);
}
$profiledata = get_userdata($HTTP_GET_VARS[POST_USERS_URL]);
#
#-----[ AFTER, ADD ]------------------------------------------
#
// Profile views MOD, By Manipe (Begin)
$current_time = time();
$delete_time = $current_time - 86400;
//
// Delete old entries
//
$sql = "DELETE FROM " . PROFILE_VIEWS_TABLE . "
WHERE time < '$delete_time'";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not update profile views', '', __LINE__, __FILE__, $sql);
}
//
// Find out if the same person has visited the same user profile
//
$sql = "SELECT ip_address
FROM " . PROFILE_VIEWS_TABLE . "
WHERE ip_address = '$user_ip'
AND user_id = '" . $profiledata['user_id'] . "'";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not update profile views', '', __LINE__, __FILE__, $sql);
}
$is_ip_there = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
//
// If so, don't incriment the profile views counter
//
if ( empty($is_ip_there['ip_address'][0]))
{
$sql = "INSERT INTO " . PROFILE_VIEWS_TABLE . " (user_id, time, ip_address)
VALUES ('" . $profiledata['user_id'] . "', '$current_time', '$user_ip')";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not update profile views', '', __LINE__, __FILE__, $sql);
}
$sql = "UPDATE " . USERS_TABLE . "
SET user_profile_views = user_profile_views + 1
WHERE user_id = '" . $profiledata['user_id'] . "'";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not update profile views', '', __LINE__, __FILE__, $sql);
}
}
//
// Retrieve the number of views
//
$sql = "SELECT user_profile_views
FROM " . USERS_TABLE . "
WHERE user_id = " . $profiledata['user_id'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, 'Could not retreive profile views', '', __LINE__, __FILE__, $sql);
}
$row = $db->sql_fetchrow($result);
$total_profile_views = ( $row['user_profile_views'] ) ? $row['user_profile_views'] : 0;
$db->sql_freeresult($result);
// Profile views MOD, By Manipe (End)
