diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2005-09-07 04:28:33 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2005-09-07 04:28:33 +0000 |
commit | 0a9fcb0298a4febc6287c77d29929a1cb833eb8b (patch) | |
tree | a2490a7d89e60c225141728e7102d20dd5e40e7d /lib | |
parent | be23e09225cb961e94dbd95c6f394a5d5d7036cb (diff) | |
download | ampache-0a9fcb0298a4febc6287c77d29929a1cb833eb8b.tar.gz ampache-0a9fcb0298a4febc6287c77d29929a1cb833eb8b.tar.bz2 ampache-0a9fcb0298a4febc6287c77d29929a1cb833eb8b.zip |
fixed stats clearing error
Diffstat (limited to 'lib')
-rw-r--r-- | lib/general.lib.php | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/general.lib.php b/lib/general.lib.php index e343b75c..7eebe074 100644 --- a/lib/general.lib.php +++ b/lib/general.lib.php @@ -756,4 +756,44 @@ function tbl_name($table) { } // tbl_name +/** + * clear_catalog_stats() + * + * Use this to clear the stats for the entire Ampache server. + * @package Catalog + * @catagory Clear + */ +function clear_catalog_stats() { + + $dbh = dbh(); + + /* Wipe out the object_count table */ + $sql = "TRUNCATE object_count"; + $results = mysql_query($sql, $dbh); + + /* Set every song to unplayed */ + $sql = "UPDATE song SET played='0'"; + $results = mysql_query($sql, $dbh); + +} // clear_catalog_stats + +/** + * check_username + * this function checks to make sure the specified username doesn't already exist + * @package General + * @catagory Users + */ +function check_username($username) { + + $sql = "SELECT username FROM user WHERE username = '" . sql_escape($username) . "'"; + $db_results = mysql_query($sql, dbh()); + + if (mysql_fetch_row($db_results)) { + return fakse; + } + + return true; + +} // check_username + ?> |