1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-03 17:59:21 +02:00

Strange error occured while commiting

This commit is contained in:
pb1dft 2006-10-27 21:14:40 +00:00
parent e502a62b1d
commit 5db7a0e53c
6 changed files with 84 additions and 3 deletions

View file

@ -155,6 +155,9 @@ switch ($action) {
show_confirmation(_("Delete Error"), _("Unable to delete last Admin User"),"admin/users.php"); show_confirmation(_("Delete Error"), _("Unable to delete last Admin User"),"admin/users.php");
} }
break; break;
case 'show_ip_history':
show_ip_history();
break;
case 'show_add_user': case 'show_add_user':
if (conf('demo_mode')) { break; } if (conf('demo_mode')) { break; }
$type = 'new_user'; $type = 'new_user';

View file

@ -90,6 +90,34 @@ class Stats {
} // get_top } // get_top
/**
* get_ip_history
* This returns the ip_history from the
* last conf('user_ip_cardinality') days
*/
function get_ip_history($count,$type,$user) {
$count = intval($count);
$type = $this->validate_type($type);
$date = time() - (86400*conf('user_ip_cardinality'));
/* Select ip history */
$sql = "SELECT ip,date FROM ip_history" .
" WHERE user='$user->username' AND date >= '$date'" .
" ORDER BY `date` DESC LIMIT $count";
$db_results = mysql_query($sql, dbh());
$results = array();
while ($r = mysql_fetch_assoc($db_results)) {
$results[] = $r;
}
return $results;
} // get_ip_history
/** /**
* get_user * get_user
* This gets all stats for atype based on user with thresholds and all * This gets all stats for atype based on user with thresholds and all

View file

@ -509,8 +509,8 @@ class User {
else { $this->f_create_date = date("m\/d\/Y - H:i",$user->create_date); } else { $this->f_create_date = date("m\/d\/Y - H:i",$user->create_date); }
/* Calculate their total Bandwidth Useage */ /* Calculate their total Bandwidth Useage */
$sql = "SELECT song.size FROM object_count LEFT JOIN song ON song.id=object_count.object_id " . $sql = "SELECT song.size FROM song LEFT JOIN object_count ON song.id=object_count.object_id " .
"WHERE object_count.userid='$this->uid' AND object_count.object_type='song'"; "WHERE object_count.user='$this->uid' AND object_count.object_type='song'";
$db_results = mysql_query($sql, dbh()); $db_results = mysql_query($sql, dbh());
while ($r = mysql_fetch_assoc($db_results)) { while ($r = mysql_fetch_assoc($db_results)) {
@ -534,6 +534,16 @@ class User {
$this->f_useage = round($total,2) . $name; $this->f_useage = round($total,2) . $name;
/* Get Users Last ip */
$sql = "SELECT ip FROM ip_history WHERE user = '$this->username' ORDER BY ip DESC LIMIT 1";
$db_results = mysql_query($sql, dbh());
while ($r = mysql_fetch_assoc($db_results)) {
$this->ip_history = int2ip($r[ip]);
}
} // format_user } // format_user
/*! /*!

View file

@ -150,6 +150,38 @@ function show_users () {
} // show_users() } // show_users()
/**
* show_ip_history
* shows ip_history of specific user(admin function)
*/
function show_ip_history (){
$dbh = dbh();
$date = time() - (86400*conf('user_ip_cardinality'));
$sql = "SELECT ip,date FROM ip_history where user = '$_REQUEST[user]' and date >= '$date' ORDER BY date DESC";
$db_results = mysql_query($sql, $dbh);
show_box_top();
echo " <table class=\"tabledata\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\">\n".
" <tr class=\"table-header\">\n".
" <td colspan=2>$_REQUEST[user]: IP History</td>\n".
" </tr>\n".
" <tr class=\"table-header\">\n".
" <td align=\"center\">\n".
" <b>Date</b>\n".
" </td>\n".
" <td align=\"center\">\n".
" <b>Ip Address</b>\n".
" </td>\n".
" </tr>\n";
while ($r = mysql_fetch_array($db_results)){
echo "<tr class=". flip_class() .">\n <td>".date("m\/d\/Y-H:i",$r[date])."</td>\n <td>".int2ip($r[ip])."</td>\n</tr>\n";
}
echo "</table>\n";
show_box_bottom();
} // show_ip_history
/** /**
* return_referer * return_referer

View file

@ -29,6 +29,6 @@ if (!conf('use_rss') || conf('demo_mode')) {
} }
#show_now_playingRSS($_REQUEST['username']); #show_now_playingRSS($_REQUEST['username']);
show_RSS($_REQUEST['type']); show_RSS($_REQUEST['type'],$_REQUEST['username']);
?> ?>

View file

@ -57,6 +57,9 @@ $admin_menu = "admin/";
<td align="center"> <td align="center">
<b><?php echo _("Activity"); ?></b> <b><?php echo _("Activity"); ?></b>
</td> </td>
<td align="center">
<b><?php echo _("Last Ip"); ?></b>
</td>
<td colspan="5">&nbsp;</td> <td colspan="5">&nbsp;</td>
<!-- <!--
@ -106,6 +109,11 @@ while ($results = mysql_fetch_object($db_result)) {
<td> <td>
<?php echo $user->f_useage; ?> <?php echo $user->f_useage; ?>
</td> </td>
<td>
<a href="<?php echo $web_path; ?>/admin/users.php?action=show_ip_history&amp;user=<?php echo $user->username; ?>">
<?php echo $user->ip_history; ?>
</a>
</td>
<td> <td>