<?php

/**
 * 歌手资料采集
 * 包括歌手姓名、头像、生日、地区
 * 此采集较慢,因为要下载歌手头像到本地
 * 最好每次只采 500 位歌手的资料
 */
if (!defined('APP_PATH')) {
    exit("Access is denied.");
}
require_once APP_PATH . 'util/db.php';
require_once APP_PATH . 'util/Collect.class.php';
$collect_size = 500;
// 采集数量
$con = get_con();
$collect = new Collect();
$result = mysql_query("select id from {DBPREFIX}artist where name='' or name is null limit {$collect_size}", $con);
$artistIdArr = array();
while (!!($row = mysql_fetch_array($result))) {
    $artistIdArr[] = $row['id'];
}
if (!empty($artistIdArr)) {
    $artistInfoArr = $collect->artistInfo($artistIdArr, AVATARSAVEPATH, AVATARRELATIVEPATH);
    if (!empty($artistInfoArr)) {
        foreach ($artistInfoArr as $artist) {
            $data['id'] = $artist['id'];
            $data['name'] = $artist['name'];
            $data['avatar'] = $artist['avatar'];
            $data['area'] = $artist['area'];
            $data['birth'] = $artist['birth'];
Example #2
0
function delete_user($uid)
{
    $stmnt = "delete from users where id={$uid}";
    return query_or_die($stmnt, get_con());
}
Example #3
0
unset($get_copy['q']);
$uid = NULL;
if (isset($_SESSION['user_id'])) {
    $uid = $_SESSION['user_id'];
}
$start = NULL;
$limit = 100;
if (isset($_GET['start'])) {
    $start = $_GET['start'];
}
if (isset($_GET['limit'])) {
    $limit = $_GET['limit'];
}
unset($get_copy['start']);
unset($get_copy['limit']);
$result_array = filtered_search($query, $get_copy, $uid, $limit, $start, get_con());
$result = $result_array['result'];
$num_rows = $result_array['count'];
$num_returned = mysql_num_rows($result);
ob_start();
//echos the result into a variable
if (!$start) {
    $count = 0;
} else {
    $count = $start;
}
while ($row = mysql_fetch_array($result)) {
    include 'prof_box.php';
    $count++;
}
$html = ob_get_contents();
Example #4
0
function data_count()
{
    global $g_config;
    $con = get_con();
    $count = mysqli_query($con, 'SELECT COUNT(*) FROM `' . $g_config['database']['db_prefix'] . 'accounting`');
    return mysqli_fetch_assoc($count)['COUNT(*)'];
}