Example #1
0
 function get_sidebar_stats($userid)
 {
     $time = time() - 86400;
     $return['score'] = get_score($userid);
     $return['score_yesterday'] = get_score($userid, TRUE);
     $return['following'] = $this->db->query("SELECT COUNT(id) AS total FROM follow WHERE following_user_id='{$userid}' AND deleted_time=''")->row()->total;
     $return['follower'] = $this->db->query("SELECT COUNT(id) AS total FROM follow WHERE follower_user_id='{$userid}' AND deleted_time=''")->row()->total;
     $return['following_yesterday'] = $this->db->query("SELECT COUNT(id) AS total FROM follow WHERE following_user_id='{$userid}' AND time<={$time} AND deleted_time>={$time}")->row()->total;
     $return['follower_yesterday'] = $this->db->query("SELECT COUNT(id) AS total FROM follow WHERE follower_user_id='{$userid}' AND time<={$time} AND deleted_time>={$time}")->row()->total;
     return $return;
 }
 public function chongzhi()
 {
     if (IS_POST) {
         //页面上通过表单选择在线支付类型,支付宝为alipay 财付通为tenpay
         /* 支付设置 */
         $payment = array('tenpay' => array('key' => C('TENPAYKEY'), 'partner' => C('TENPAYPARTNER')), 'alipay' => array('email' => C('ALIPAYEMAIL'), 'key' => C('ALIPAYKEY'), 'partner' => C('ALIPAYPARTNER')), 'palpay' => array('business' => C('PALPAYPARTNER')), 'yeepay' => array('key' => C('YEEPAYPARTNER'), 'partner' => C('YEEPAYKEY')), 'kuaiqian' => array('key' => C('KUAIQIANPARTNER'), 'partner' => C('KUAIQIANKEY')), 'unionpay' => array('key' => C('UNIONPARTNER'), 'partner' => C('UNIONKEY')));
         $paytype = I('post.paytype');
         $pay = new \Think\Pay($paytype, $payment[$paytype]);
         $order_no = $pay->createOrderNo();
         //充值,生成订单号
         $body = C('SITENAME') . "会员充值";
         //商品描述
         $title = C('SITENAME') . "会员充值";
         //设置商品名称
         $vo = new \Think\Pay\PayVo();
         $vo->setBody($body)->setFee(I('post.money'))->setOrderNo($order_no)->setTitle($title)->setCallback("Home/Pay/successaccount")->setUrl(U("Home/Pay/over"))->setParam(array('order_id' => $order_no));
         echo $pay->buildRequestForm($vo);
     } else {
         /* 菜单调用*/
         $menu = R('index/menulist');
         $this->assign('categoryq', $menu);
         /* 热词调用*/
         $hotsearch = R("Index/getHotsearch");
         $this->assign('hotsearch', $hotsearch);
         /* uid调用*/
         $user = session('user_auth');
         $uid = $user['uid'];
         $score = get_score($uid);
         /* 底部分类调用*/
         $menulist = R('Service/AllMenu');
         $this->assign('footermenu', $menulist);
         /* 积分兑换*/
         $ratio = $score / C('RATIO');
         $this->assign('ratio', $ratio);
         $this->meta_title = '账号充值';
         //在此之前goods1的业务订单已经生成,状态为等待支付
         $id = I("get.orderid");
         $order = D("order");
         $this->assign('codeid', $id);
         $total = $order->where("orderid='{$id}'")->getField('pricetotal');
         $this->assign('goodprice', $total);
         $this->display();
     }
 }
$huishoudens = false;
$target = 'high';
$eindjaar = true;
$col = 'val0';
if ($compare_years == "off") {
    get_data($cbs, $regio, $compare, $nr, $oms, $geslacht, $start_lft, $end_lft, $huishoudens, $target, $rand, $cache_table, $indicator, $eindjaar, $scale, $col, $cache);
}
//mantelzorgers (65+)
$nr = 2868;
$oms = 'inwoners (65 en ouder) die afgelopen jaar mantelzorg hebben verleend';
$geslacht = 'totaal';
$start_lft = 65;
$end_lft = 99;
$scale = 100;
$huishoudens = false;
$target = 'high';
$eindjaar = true;
$col = 'val1';
if ($compare_years == "off") {
    get_data($cbs, $regio, $compare, $nr, $oms, $geslacht, $start_lft, $end_lft, $huishoudens, $target, $rand, $cache_table, $indicator, $eindjaar, $scale, $col, $cache);
}
if ($compare_years == "off") {
    get_score($cbs, $compare, $num_comparisons, $rand, $indicator, $rand_pijler, $cache_table, $compare_years);
}
echo "</tbody>";
//totaalscore
get_score_pijler($cbs, $compare, $num_comparisons, $rand_pijler, $pijler, $cache_table, $compare_years);
echo "</table>";
if ($cache == false) {
    set_cache($pijler, $cache_table);
}
Example #4
0
        $c++;
    }
    $query = $dblink->query("SELECT sid,sid1,sort2 FROM {$tablepre}sort WHERE grade=2");
    $count2 = $dblink->num_rows($query);
    $class2 = '';
    $c = 1;
    while ($row2 = $dblink->fetch_array($query)) {
        $class2 .= 'new Array("' . $row2['sid1'] . '","' . $row2['sid'] . '","' . $row2['sort2'] . '")';
        if ($c == $count2) {
            $class2 .= "\n";
        } else {
            $class2 .= ",\n";
        }
        $c++;
    }
    $query = $dblink->query("SELECT sid,sid2,sort3 FROM {$tablepre}sort WHERE grade=3");
    $count3 = $dblink->num_rows($query);
    $class3 = '';
    $c = 1;
    while ($row3 = $dblink->fetch_array($query)) {
        $class3 .= 'new Array("' . $row3['sid2'] . '","' . $row3['sid'] . '","' . $row3['sort3'] . '")';
        if ($c == $count3) {
            $class3 .= "\n";
        } else {
            $class3 .= ",\n";
        }
        $c++;
    }
    $my_score = get_score($cyask_uid);
}
include template('ask');
Example #5
0
 public function chongzhi()
 {
     if (IS_POST) {
         //页面上通过表单选择在线支付类型,支付宝为alipay 财付通为tenpay
         $paytype = I('post.paytype');
         $pay = new \Think\Pay($paytype, C('payment.' . $paytype));
         $order_no = $pay->createOrderNo();
         //充值,生成订单号
         $body = C('SITENAME') . "会员充值";
         //商品描述
         $title = C('SITENAME') . "会员充值";
         //设置商品名称
         $vo = new \Think\Pay\PayVo();
         $vo->setBody($body)->setFee(I('post.money'))->setOrderNo($order_no)->setTitle($title)->setCallback("Home/Pay/successaccount")->setUrl(U("Home/Pay/over"))->setParam(array('order_id' => $order_no));
         echo $pay->buildRequestForm($vo);
     } else {
         /* 菜单调用*/
         $menu = R('index/menulist');
         $this->assign('categoryq', $menu);
         /* 热词调用*/
         $hotsearch = R("Index/getHotsearch");
         $this->assign('hotsearch', $hotsearch);
         /* uid调用*/
         $uid = is_login();
         $score = get_score($uid);
         /* 积分兑换*/
         $ratio = $score / C('RATIO');
         $this->assign('ratio', $ratio);
         $this->meta_title = '账号充值';
         //在此之前goods1的业务订单已经生成,状态为等待支付
         $id = I("get.orderid");
         $order = D("order");
         $this->assign('codeid', $id);
         $total = $order->where("orderid='{$id}'")->getField('pricetotal');
         $this->assign('goodprice', $total);
         $this->display();
     }
 }
Example #6
0
                    echo $row->total;
                    ?>
" target="_blank"><?php 
                    echo $row->total;
                    ?>
</a>
<?php 
                } elseif ($sidebar_type != 'user') {
                    ?>
									<span class="number"><?php 
                    echo round($row->total);
                    ?>
</span> point<?php 
                    echo get_plural($row->total);
                } else {
                    $points = get_score($row->username);
                    ?>
									<span class="number"><?php 
                    echo $points;
                    ?>
</span> point<?php 
                    echo get_plural($points);
                }
                ?>
								</li>
								<li class="fourth_column center">
									<?php 
                echo get_follow($username, $row->username);
                if ($body_title == 'Leaderboard' && $username == $row->username) {
                    ?>
									<a href="http://twitter.com/?status=I'm the <?php 
Example #7
0
        //other than quesiton_* will be removed
        $question_data[substr($k, 9)] = $v;
    }
    if ($active == 0) {
        $final_result['question_attempted'] = count($question_data);
        $fquestion_data = array();
        $q_list = get_quiz_questions_id($quiz_id);
        //pr($q_list,1);
        foreach ($q_list as $k => $v) {
            $fquestion_data[$k] = isset($question_data[$k]) ? $question_data[$k] : "";
        }
        $answer_data = get_correct_answers($fquestion_data);
        //pr($question_data);
        //pr($answer_data);
        $final_result['total_question'] = $total;
        $final_result['correct_answer'] = get_score($fquestion_data, $answer_data);
        $final_result['result_percentage'] = $final_result['correct_answer'] * 100 / $total;
        save_score($_SESSION['user']['quiz']['qs_id'], $final_result['result_percentage']);
    }
}
//if(isset($_POST['submit-quiz-question'])) {
if (isset($_POST['begin_time'])) {
    $_POST = array_map('addslashes', $_POST);
    $_POST = array_map('htmlentities', $_POST);
    $lapse_time = time() - $_POST['begin_time'];
    $user_id = $_SESSION['user']['user_id'];
    $active = $_POST['active'];
    $answer_sl_array = $_POST;
    $answer_sl = serialize($_POST);
    $score = '0.00';
    //pr($_POST,1);
Example #8
0
 //  $groups[$group]['has_perms'] = false;
 //}
 $groups[$group]['has_perms'] = true;
 // If there is no threshold specified for a group, pick the configured default threshold
 $group_threshold_a = $rs->fields['group_threshold_a'] ? $rs->fields['group_threshold_a'] : $conf_threshold;
 $group_threshold_c = $rs->fields['group_threshold_c'] ? $rs->fields['group_threshold_c'] : $conf_threshold;
 $groups[$group]['threshold_a'] = $group_threshold_a;
 $groups[$group]['threshold_c'] = $group_threshold_c;
 $net = $rs->fields['net_name'];
 // current metrics
 $net_current_a = get_current_metric($host_qualification_cache, $net_qualification_cache, $net, 'net', 'attack');
 $net_current_c = get_current_metric($host_qualification_cache, $net_qualification_cache, $net, 'net', 'compromise');
 @($groups[$group]['current_a'] += $net_current_a);
 @($groups[$group]['current_c'] += $net_current_c);
 // scores
 $score = get_score($net, 'net');
 @($groups[$group]['max_c'] += $score['max_c']);
 @($groups[$group]['max_a'] += $score['max_a']);
 $net_max_c_time = strtotime($score['max_c_date']);
 $net_max_a_time = strtotime($score['max_a_date']);
 if (!isset($groups[$group]['max_c_date'])) {
     $groups[$group]['max_c_date'] = $score['max_c_date'];
 } else {
     $group_max_c_time = strtotime($groups[$group]['max_c_date']);
     if ($net_max_c_time > $group_max_c_time) {
         $groups[$group]['max_c_date'] = $score['max_c_date'];
     }
 }
 if (!isset($groups[$group]['max_a_date'])) {
     $groups[$group]['max_a_date'] = $score['max_a_date'];
 } else {
Example #9
0
 # 0 if =
 $AIVRPPAFD = 1.15;
 # 0 if =
 $PATROL_MULTIPLIER = 1;
 # 0 if =
 // https://en.wikipedia.org/wiki/User_talk:JackPotte#Benchmarking
 $queries = array(1 => array('Account age', "SELECT user_registration FROM user WHERE user_name='" . $_REQUEST['account'] . "';", 'date'), 2 => array('Edit count', "SELECT user_editcount FROM user WHERE user_name='" . $_REQUEST['account'] . "';", '-100+0.01*'), 3 => array('User page', "SELECT page_len FROM page WHERE page_namespace=2 AND page_title='" . $_REQUEST['account'] . "';", '-100+0.1*'), 4 => array('Patrols', "SELECT COUNT(*) FROM logging WHERE log_type='patrol' and log_action='patrol' and log_namespace=0 and log_deleted=0 and log_user_text='" . $_REQUEST['account'] . "';", '-100+0.01*'), 5 => array('Block count', "SELECT COUNT(*) FROM logging WHERE log_type=\"block\" AND log_action=\"block\" AND log_namespace=2 AND log_deleted=0 AND log_title='" . $_REQUEST['account'] . "';", '100-10*'), 6 => array('WP:AFD', "SELECT COUNT(*) FROM revision WHERE rev_page like 'Articles for deletion/%' and rev_page not like 'Articles_for_deletion/Log/%' and rev_user_text='" . $_REQUEST['account'] . "';", '1*'), 7 => array('Recent activity', "SELECT COUNT(*) FROM revision WHERE rev_user_text='" . $_REQUEST['account'] . "' AND rev_timestamp > (now()-INTERVAL 730 day) and rev_timestamp < now();", '1*'), 8 => array('WP:RPP', "SELECT COUNT(*) FROM revision WHERE rev_page like 'Administrator intervention against vandalism%' and rev_user_text='" . $_REQUEST['account'] . "';", '1*'), 9 => array('Edit summaries', "SELECT COUNT(*) FROM revision JOIN page ON rev_page=page_id WHERE page_namespace=0 AND rev_user_text='" . $_REQUEST['account'] . "' AND rev_comment='';", '1*'), 10 => array('Namespaces', "SELECT count(*) FROM revision JOIN page ON rev_page=page_id WHERE rev_user_text='" . $_REQUEST['account'] . "' AND page_namespace=0;", '1*'), 11 => array('Articles created', "SELECT DISTINCT page_id FROM page JOIN revision ON page_id=rev_page WHERE rev_user_text='" . $_REQUEST['account'] . "' and page_namespace=0 AND page_is_redirect=0;", '1*'), 12 => array('WP:AIV', "SELECT COUNT(*) FROM revision WHERE rev_page like 'Requests_for_page_protection%' and rev_user_text='" . $_REQUEST['account'] . "';", '1*'));
 print "<H1>Admin eligibility score for <a href='https://en.wikipedia.org/wiki/User:"******"'>" . $_REQUEST['account'] . "</a></H1>";
 print '<table border="1px;">';
 print '<th>Label</th><th>Value</th><th>Points</th>';
 $score = 0;
 $now = new DateTime();
 for ($l = 1; $l <= sizeof($queries); $l++) {
     print '<tr>';
     print '<td>' . $queries[$l][0] . '</td>';
     $value = get_score($queries[$l][1]);
     if ($queries[$l][2] == 'date') {
         $date = new DateTime($value);
         $diff = $date->diff($now);
         $formula = 365 * $diff->format("%y") + 30 * $diff->format("%m") + $diff->format("%d");
         print '<td>' . $formula . ' days</td>';
         $formula = $formula - 365;
     } else {
         print '<td>' . $value . '</td>';
         $formula = calculate_string($queries[$l][2] . $value);
     }
     $formula = max(min($formula, 100), -100);
     print '<td align=right><font color=' . get_color($formula) . '>' . $formula . '</font></td>';
     $score += $formula;
     print '</tr>';
 }
 /**
  * 生成订单信息
  * 
  */
 public function add()
 {
     if (!is_login()) {
         $this->error("您还没有登陆", U("User/login"));
     }
     /* uid调用*/
     $uid = is_login();
     $score = get_score($uid);
     /* 积分兑换*/
     $ratio = $score / C('RATIO');
     $this->assign('ratio', $ratio);
     $this->assign('uid', $uid);
     /* 创建订单*/
     if (IS_POST) {
         $goodlist = M("shoplist");
         $tag = $this->ordersn();
         //创建支付订单号
         for ($i = 0; $i < count($_POST["id"]); $i++) {
             $id = $_POST["id"][$i];
             $num = $_POST["num"][$i];
             if ($num < 1) {
                 $this->error("无效数量");
             }
             $goodlist->goodid = $id;
             $goodlist->status = 1;
             $goodlist->orderid = '';
             $goodlist->parameters = $_POST["parameters"][$i];
             $goodlist->sort = $_POST["sort"][$i];
             $goodlist->num = $num;
             $goodlist->uid = $uid;
             $goodlist->tag = $tag;
             //标识号必须相同
             $goodlist->create_time = NOW_TIME;
             $goodprice = $_POST["price"][$i];
             $goodlist->price = $goodprice;
             $goodtotal = $num * $goodprice;
             $goodlist->total = $goodtotal;
             $goodlist->add();
         }
         $defaultaddress = get_address($uid);
         $this->assign('address', $defaultaddress);
         $a = M("shoplist")->where(" tag='{$tag}'")->select();
         $total = '';
         $num = '';
         foreach ($a as $k => $val) {
             $total += $val['total'];
             $num += $val['num'];
         }
         if ($total < C('LOWWEST')) {
             $trans = C('SHIPMONEY');
         } else {
             $trans = 0;
         }
         $all = $total + $trans;
         $shoplist = M('shoplist')->where("tag='{$tag}'")->select();
         $this->assign('shoplist', $shoplist);
         $map["pid"] = 0;
         $list = M("area")->where($map)->select();
         $this->assign('list', $list);
         $this->assign('all', $all);
         $this->assign('num', $num);
         $this->assign('tag', $tag);
         $this->assign('total', $total);
         $this->assign('trans', $trans);
         $this->meta_title = '订单结算';
         $this->display('Shopcart/add');
     }
 }
Example #11
0
                echo $row->id;
                ?>
<br />
			Username: <a target="_blank" href="/<?php 
                echo $row->username;
                ?>
"><?php 
                echo $row->username;
                ?>
</a><br />
			Fullname: <?php 
                echo $row->fullname;
                ?>
<br />
			Score: <?php 
                echo get_score($row->username);
                ?>
<br />
			Email: <a href="mailto:<?php 
                echo $row->email;
                ?>
"><?php 
                echo $row->email;
                ?>
</a><br />
			Bio: <?php 
                echo $row->bio;
                ?>
<br />
			Website: <a target="_blank" href="<?php 
                echo $row->website;
Example #12
0
function score_track($file, $answers = [])
{
    global $coordinate_1, $coordinate_2, $coordinate_3, $cwd;
    $file = $cwd . '/' . $file;
    $time = microtime(true);
    echo "------------------------" . PHP_EOL;
    _log("Memory", memory_get_usage(true));
    _log("Track", $file);
    _log('Creating set:');
    $set_2 = new coordinate_set();
    action('Parsing file', $set_2->parse_igc(file_get_contents($file)));
    _log("Date", $set_2->date());
    _log('Duration', $set_2->last()->timestamp() - $set_2->first()->timestamp() . 's');
    $intial = $set_2->count();
    _log('Points', $set_2->count() . " (" . $intial . ")");
    _log('Parts', $set_2->part_count());
    // action('Simplifing file', $set_2->simplify());
    // _log('Points', $set_2->count() . " (" . $intial . ")");
    // action('Trimming file', $set_2->trim());
    // _log('Points', $set_2->count() . " (" . $intial . ")");
    // _log('Parts',  $set_2->part_count());
    action('Repairing track', $set_2->repair());
    action('Graphing track', $set_2->set_graph_values());
    action('Ranging track', $set_2->set_ranges());
    if ($set_2->part_count() > 1) {
        action('Setting section', $set_2->set_section(1));
    }
    _log('Points', $set_2->count() . " (" . $intial . ")");
    _log('Parts', $set_2->part_count());
    action('Building map', ($map_2 = new distance_map($set_2)) ? "Ok" : "Fail");
    echo get_score($map_2, $od = $map_2->score_open_distance_3tp(), $answers[0], 'OD');
    echo get_score($map_2, $or = $map_2->score_out_and_return(), $answers[1], 'OR');
    echo get_score($map_2, $tr = $map_2->score_triangle(), $answers[2], 'TR');
    _log('Coordinates', $od->get_gridref());
    _log('Duration', $set_2->last()->timestamp() - $set_2->first()->timestamp() . 's');
    $task = new task($coordinate_1, $coordinate_2, $coordinate_3);
    _log('Checking task:');
    echo pass_fail('Valid task is found' . PHP_EOL, $od->completes_task($set_2) == true);
    echo pass_fail('Invalid task not found' . PHP_EOL, $task->completes_task($set_2) == false);
    _log('Outputting kml');
    $formatter = new formatter_kml($set_2, $file, $od, $or, $tr, $od);
    file_put_contents(str_replace('.igc', '.kml', $file), $formatter->output());
    _log('Outputting js');
    $formatter = new formatter_js($set_2, 10);
    file_put_contents(str_replace('.igc', '.js', $file), $formatter->output());
    _log('Outputting kml (Split)');
    $formatter = new formatter_kml_split($set_2);
    file_put_contents(str_replace('.igc', '_split.kml', $file), $formatter->output());
    _log('Outputting KML (Earth)');
    $formatter = new formatter_kml_earth($set_2, $file, $od, $or, $tr);
    file_put_contents(str_replace('.igc', '_earth.kml', $file), $formatter->output());
    unset($set_2);
    unset($formatter);
    _log("Memory", memory_get_usage(true));
}
 /**
  * 加入shoplist中
  */
 public function order()
 {
     /* uid调用*/
     $uid = $this->login();
     $score = get_score($uid);
     /* 积分兑换*/
     $ratio = ceil($score / C('RATIO'));
     $this->assign('ratio', $ratio);
     $this->assign('uid', $uid);
     /* 创建订单*/
     if (IS_POST) {
         $goodlist = M("shoplist");
         $tag = $this->ordersn();
         //标识号
         $total_money = 0;
         $total_num = 0;
         $res_data = array();
         for ($i = 0; $i < count($_POST["id"]); $i++) {
             $data = array();
             $id = $_POST["id"][$i];
             $num = $_POST["num"][$i];
             $data['goodid'] = $id;
             $data['status'] = 1;
             $data['orderid'] = '';
             $data['parameters'] = $_POST["parameters"][$i];
             $data['sort'] = $_POST["sort"][$i];
             $data['num'] = $num;
             $data['uid'] = $uid;
             $data['tag'] = $tag;
             //标识号必须相同
             $data['create_time'] = NOW_TIME;
             $goodprice = $_POST["price"][$i];
             $data['price'] = $goodprice;
             $goodtotal = $num * $goodprice;
             $data['total'] = $goodtotal;
             $total_money += $goodtotal;
             $total_num += $num;
             $goodlist->add($data);
             array_push($res_data, $data);
         }
         $useraddress = get_address($uid, false);
         $this->assign('address', $useraddress);
         if ($total_money < C('LOWWEST')) {
             $trans = C('SHIPMONEY');
         } else {
             $trans = 0;
         }
         $all = $total_money + $trans;
         // $shoplist = M('Shoplist')->where("tag='$tag'")->field('parameters,goodid,price,num')->select();
         $this->assign('shoplist', $res_data);
         $this->assign('all', $all);
         $this->assign('num', $total_num);
         $this->assign('tag', $tag);
         $this->assign('total', $total_money);
         $this->assign('trans', $trans);
         $this->meta_title = '订单结算';
         $this->display();
     } else {
         $this->error('对不起,错误访问!');
     }
 }
Example #14
0
    show_message('username_error', './');
    exit;
}
$username = $dblink->result($query, 0);
if ($command == 'info') {
    $query = $dblink->query("select username,email,gender,bday,qq,msn,signature from {$tablepre}member where uid={$uid}");
    $members = $dblink->fetch_array($query);
    $member_username = $members['username'];
    $member_email = $members['email'];
    $member_gender = $members['gender'];
    $member_bday = $members['bday'];
    $member_qq = $members['qq'];
    $member_msn = $members['msn'];
    $member_signature = $members['signature'];
} elseif ($command == 'score') {
    $totalscore = get_score($uid);
    $query = $dblink->query("select count(*) from {$tablepre}answer where uid={$uid}");
    $answercount = $dblink->result($query, 0);
    $query = $dblink->query("select count(*) from {$tablepre}answer where uid={$uid} and adopttime<>0");
    $adoptcount = $dblink->result($query, 0);
    if ($answercount) {
        $rightvalage = $adoptcount / $answercount * 100;
        $rightvalage = round($rightvalage) . '%';
    } else {
        $rightvalage = '0%';
    }
    $query = $dblink->query("select count(*) from {$tablepre}question where uid={$uid}");
    $question_allcount = $dblink->result($query, 0);
    $query = $dblink->query("select count(*) from {$tablepre}question where uid={$uid} and status=2");
    $questionOK = $dblink->result($query, 0);
    $query = $dblink->query("select count(*) from {$tablepre}question where uid={$uid} and status=1");
 public function order()
 {
     /* 菜单调用*/
     $menu = R('index/menulist');
     $this->assign('categoryq', $menu);
     /* 热词调用*/
     $hotsearch = R("Index/getHotsearch");
     $this->assign('hotsearch', $hotsearch);
     /* uid调用*/
     $user = session('user_auth');
     $uid = $user['uid'];
     $score = get_score($uid);
     /* 积分兑换*/
     $ratio = $score / C('RATIO');
     $this->assign('ratio', $ratio);
     $this->assign('uid', $uid);
     /* 创建订单*/
     if (IS_POST) {
         $order = D("order");
         $goodlist = M("shoplist");
         $makeid = $this->ordersn();
         $order->orderid = $makeid;
         $order->uid = $uid;
         $order->add();
         $orderid = $order->where("orderid='{$makeid}'")->getField('id');
         for ($i = 0; $i < count($_POST["id"]); $i++) {
             $id = $_POST["id"][$i];
             $num = $_POST["num"][$i];
             $goodlist->goodid = $id;
             $goodlist->status = 1;
             $goodlist->orderid = $orderid;
             $goodlist->num = $num;
             $goodlist->time = NOW_TIME;
             $goodprice = get_good_price($id);
             $goodtotal = $num * $goodprice;
             $goodlist->total = $goodtotal;
             $result = $goodlist->add();
         }
         $shoplist = $goodlist->where("orderid='{$orderid}'")->select();
         $this->assign('shoplist', $shoplist);
         $this->assign('uid', $uid);
         $this->assign('orderid', $orderid);
         $msg = get_address($uid);
         $total = $this->getPricetotal($orderid);
         if ($total < C('LOWWEST')) {
             $trans = C('SHIPPRICE');
         } else {
             $trans = 0;
         }
         $all = $total + $trans;
         $allnum = $this->getpriceNum($orderid);
         $this->assign('all', $all);
         $this->assign('allnum', $allnum);
         $this->assign('trans', $trans);
         $this->assign('total', $total);
         $this->assign('address', $msg);
     }
     $this->display();
 }
function format_as_json($output_dir, $corpus, $path_to_corpus, $file_path = FALSE)
{
    global $test_meta_file;
    //The tests to perform in json format
    global $country_map;
    //Maps lanaguages to countries
    global $metadata;
    //Holds the data that will be saved to json. Declared as global so we can use it in the get_score function
    global $test_meta;
    //This is the data about the tests held in an accessible array. Declared as global so we can use it in the get_score function
    $output_file = $output_dir . $corpus . '_transparency.json';
    //echo $output_file;
    //Get the existing data on this provider from a file
    //If file doesn't exist create the start of one
    if (!file_exists($output_file)) {
        $metadata_header = array("provider" => $corpus, "hierarchy" => 0, "activityCount" => 100);
        $json = json_encode($metadata_header);
        file_put_contents($output_file, $json);
        //die;
    }
    $json = file_get_contents($output_file);
    $metadata = json_decode($json, true);
    //print_r($metadata); //die;
    //Get the test metadata so we know what threasholds and scores to apply to this test
    $test_meta = file_get_contents($test_meta_file);
    $test_meta = json_decode($test_meta, true);
    //print_r($test_meta); die;
    //test the providers files and return the data for us
    if ($file_path) {
        $data = count_attributes($path_to_corpus, basename($file_path));
        //echo "yes";
    } else {
        $data = count_attributes($path_to_corpus);
    }
    //print_r($data) ; die;
    //Set the hierarcy that we're going to test one. the rule is the lowest i.e. highest number which should be the last value of $data["hierarchies"]
    $metadata["hierarchy"] = end($data["hierarchies"]);
    reset($data["hierarchies"]);
    //end moves the array pointer to the end of the array, so lets rest it
    // Number of activities
    $metadata["activityCount"] = $data["no-activities"][$metadata["hierarchy"]];
    //number of activities tested at our hierarchy level
    //echo $metadata["activityCount"]; die;
    //get the results for the json file
    //sTet up some variables for activiy-date element first
    //$attribute_values = array("start-planned","start-actual","end-planned","end-actual");
    $attribute_values = array("start", "end");
    //$attribute_start_values = array("start-planned","start-actual");
    //$attribute_end_values = array("end-planned","end-actual");
    $start = $end = 0;
    //print_r($data["participating_org_implementing"]); die;
    foreach ($data["hierarchies"] as $hierarchy) {
        //The count attributes routine fetches data at all hierarchies, but we only need to test the lowest usually.
        if ($hierarchy == $metadata["hierarchy"]) {
            //Set for each provider in a metadata file
            //Elements
            $document_links = $result_element = $conditions = 0;
            if (isset($data["document_links"][$hierarchy])) {
                $document_links = count($data["document_links"][$hierarchy]);
            }
            if (isset($data["result_element"][$hierarchy])) {
                $result_element = count($data["result_element"][$hierarchy]);
            }
            if (isset($data["conditions"][$hierarchy])) {
                $conditions = count($data["conditions"][$hierarchy]);
            }
            //Participating org test
            $participating_org_accountable = $participating_org_implementing = 0;
            if (isset($data["participating_org_accountable"][$hierarchy])) {
                $participating_org_accountable = array_unique($data["participating_org_accountable"][$hierarchy]);
                $participating_org_accountable = count($participating_org_accountable);
            }
            if (isset($data["participating_org_implementing"][$hierarchy])) {
                $participating_org_implementing = array_unique($data["participating_org_implementing"][$hierarchy]);
                $participating_org_implementing = count($participating_org_implementing);
            }
            //echo $participating_org_implementing; die;
            //Budget/Planned Disbursement
            $budget = 0;
            if (isset($data["budget"][$hierarchy])) {
                $budget = count($data["budget"][$hierarchy]);
            }
            //Identifiers
            $unique_ids = array_unique($data["identifiers"][$hierarchy]["good"]);
            //In case identifiers are used more than once
            $good_ids = count($unique_ids);
            //Transactions
            $transaction_type_commitment = $transaction_type_disbursements = $transaction_type_expenditure = 0;
            $unique_commitments = $unique_disbursements = $unique_expenditure = array();
            if (isset($data["transaction_type_commitment"][$hierarchy])) {
                $unique_commitments = array_unique($data["transaction_type_commitment"][$hierarchy]);
                //In case one activity has more than one commitment
                $transaction_type_commitment = count($unique_commitments);
            }
            if (isset($data["transaction_type_disbursement"][$hierarchy])) {
                $unique_disbursements = array_unique($data["transaction_type_disbursement"][$hierarchy]);
                //In case one activity has more than one commitment
                $transaction_type_disbursements = count($unique_disbursements);
                //echo $transaction_type_disbursements; //die;
            }
            if (isset($data["transaction_type_expenditure"][$hierarchy])) {
                $unique_expenditure = array_unique($data["transaction_type_expenditure"][$hierarchy]);
                //In case one activity has more than one commitment
                $transaction_type_expenditure = count($unique_expenditure);
            }
            //echo $transaction_type_expenditure; die;
            //Test to see if an activity has either
            //Both a disbursement and an expenditure
            /* This would mean looping through one array and seeing if iati-identifier values are in both. And getting a count 
                * Or if one array is smaller than the treashold then it's a fail??
                * Or an array diff would give us numbers of activites that don't have both (but not the numbers without any!!
               //OR
               //Either a disbursement or an expenditure
               * We could merge the arrays, and then array unique it to get our count
               */
            $disbursements_expenditure = array_merge($unique_disbursements, $unique_expenditure);
            $unique_disbursements_expenditure = array_unique($disbursements_expenditure);
            $disbursements_expenditure_count = count($unique_disbursements_expenditure);
            //Tracable Transactions
            $no_disbursements = $data["no_disbursements"][$hierarchy];
            //echo $no_disbursements . PHP_EOL;
            $no_incoming_funds = $data["no_incoming_funds"][$hierarchy];
            //echo $no_incoming_funds . PHP_EOL;
            $transactions_that_should_be_traced = $no_disbursements + $no_incoming_funds;
            //echo $transactions_that_should_be_traced . PHP_EOL;
            $no_tracable_transactions = $data["no_tracable_transactions"][$hierarchy];
            //echo $no_tracable_transactions . PHP_EOL;
            // die;
            if ($no_tracable_transactions > 0) {
                //avoid divide by zero
                $percent_tracable = 100 * round($no_tracable_transactions / $transactions_that_should_be_traced, 2);
                $tracable_threashold = $test_meta["test"]["Financial transaction recipient / Provider activity Id"]["threashold"];
                //echo $test_meta["test"]["Financial transaction recipient / Provider activity Id"]["threashold"];
                if ($percent_tracable >= $tracable_threashold) {
                    //echo "yes"; die;
                    $tracable_score = $test_meta["test"]["Financial transaction recipient / Provider activity Id"]["score"];
                } else {
                    $tracable_score = 0;
                }
            } else {
                $tracable_score = $percent_tracable = 0;
            }
            //Location
            //$activities_with_location = $activities_with_coordinates = $activities_with_adminstrative = 0;
            //Count activities with structured location data
            //This is either co-ordinates present or
            //administartive element and adm1 or adm2 attribute
            //This MUST be a subset of the location count (mustn't it?)
            $activities_with_coordinates = $activities_with_adminstrative = array();
            //set up empty arrays first
            if (isset($data["activities_with_coordinates"][$hierarchy])) {
                $activities_with_coordinates = array_unique($data["activities_with_coordinates"][$hierarchy]);
            }
            if (isset($data["activities_with_adminstrative"][$hierarchy])) {
                $activities_with_adminstrative = array_unique($data["activities_with_coordinates"][$hierarchy]);
            }
            $activities_with_structure_locations = array_merge($activities_with_coordinates, $activities_with_adminstrative);
            //if arrays are empty this is ok!
            $activities_with_structure_locations = array_unique($activities_with_structure_locations);
            //need to unique them as activities can have both
            $activities_with_structure_locations_count = count($activities_with_structure_locations);
            //echo $activities_with_structure_locations_count . PHP_EOL;
            $activities_with_location_count = 0;
            $activities_with_location = array();
            if (isset($data["activities_with_location"][$hierarchy])) {
                $activities_with_location = array_unique($data["activities_with_location"][$hierarchy]);
            }
            //$activities_with_location = array_merge($activities_with_location,$activities_with_structure_locations);
            $activities_with_location = array_unique($activities_with_location);
            $activities_with_location_count = count($activities_with_location);
            //echo $activities_with_location_count . PHP_EOL;
            //
            $location_level_1 = $activities_with_location_count;
            $location_level_2 = $activities_with_structure_locations_count;
            //die;
            //Sector
            $activities_sector_declared_dac = $activities_sector_assumed_dac = array();
            if (isset($data["activities_sector_declared_dac"][$hierarchy])) {
                $activities_sector_declared_dac = $data["activities_sector_declared_dac"][$hierarchy];
                $activities_sector_declared_dac = array_unique($activities_sector_declared_dac);
            }
            if (isset($data["activities_sector_assumed_dac"][$hierarchy])) {
                $activities_sector_assumed_dac = $data["activities_sector_assumed_dac"][$hierarchy];
                $activities_sector_assumed_dac = array_unique($activities_sector_assumed_dac);
            }
            $activities_with_dac_sector = array_merge($activities_sector_declared_dac, $activities_sector_assumed_dac);
            //probably don't need to 'unique' this, but won't hurt
            $activities_with_dac_sector = array_unique($activities_with_dac_sector);
            $activities_with_dac_sector_count = count($activities_with_dac_sector);
            //echo $activities_with_dac_sector_count . PHP_EOL;
            // die;
            // die;
            //Last-updated-datetime
            //$most_recent = $data["most_recent"][$hierarchy];
            //Activity Dates
            foreach ($attribute_values as $value) {
                //Loop through all possible results
                if (isset($data["activities_with_attribute"][$hierarchy][$value])) {
                    //echo $value . PHP_EOL;
                    $count = count(array_unique($data["activities_with_attribute"][$hierarchy][$value]));
                    //if (in_array($value, $attribute_start_values)) {
                    if ($value == "start") {
                        $start = $start + $count;
                        //} elseif (in_array($value, $attribute_end_values)) {
                    } else {
                        if ($value == "end") {
                            $end = $end + $count;
                        }
                    }
                }
            }
            //Languages
            $activies_in_country_lang = array();
            if (isset($data["activies_in_country_lang"][$hierarchy])) {
                $activies_in_country_lang = $data["activies_in_country_lang"][$hierarchy];
                $activies_in_country_lang = array_unique($activies_in_country_lang);
            }
            $activies_in_country_lang_count = count($activies_in_country_lang);
            //echo $activies_in_country_lang_count; //die;
        }
    }
    //echo $start . PHP_EOL;
    //echo $end . PHP_EOL;
    //Work out the scores
    $start_score = get_score($start, "Activity Dates (Start Date)");
    $end_score = get_score($end, "Activity Dates (End Date)");
    $document_links_score = get_score($document_links, "Activity Documents");
    $conditions_score = get_score($conditions, "Text of Conditions");
    $result_element_score = get_score($result_element, "Results data");
    $participating_org_accountable_score = get_score($participating_org_accountable, "Participating Organisation (Accountable)");
    $participating_org_implementing_score = get_score($participating_org_implementing, "Participating Organisation (Implementing)");
    $budget_score = get_score($budget, "Activity Budget / Planned Disbursement");
    $good_ids_score = get_score($good_ids, "IATI activity identifier");
    $transaction_type_commitment_score = get_score($transaction_type_commitment, "Financial transaction (Commitment)");
    $transaction_type_disb_expend_score = get_score($disbursements_expenditure_count, "Financial transaction (Disbursement & Expenditure)");
    $location_level_1_score = get_score($location_level_1, "Sub-national Geographic Location (text)");
    $location_level_2_score = get_score($location_level_2, "Sub-national Geographic Location (structure)");
    $activities_with_dac_sector_score = get_score($activities_with_dac_sector_count, "Sector (DAC CRS)");
    $activies_in_country_lang_score = get_score($activies_in_country_lang_count, "Activity Title or Description (Recipient language)");
    $metadata["tests"]["activityDateStart"]["count"] = $start;
    $metadata["tests"]["activityDateStart"]["score"] = $start_score["score"];
    $metadata["tests"]["activityDateStart"]["percentage"] = $start_score["percentage"];
    $metadata["tests"]["activityDateEnd"]["count"] = $end;
    $metadata["tests"]["activityDateEnd"]["score"] = $end_score["score"];
    $metadata["tests"]["activityDateEnd"]["percentage"] = $end_score["percentage"];
    $metadata["tests"]["documentLink"]["count"] = $document_links;
    $metadata["tests"]["documentLink"]["score"] = $document_links_score["score"];
    $metadata["tests"]["documentLink"]["percentage"] = $document_links_score["percentage"];
    $metadata["tests"]["result"]["count"] = $result_element;
    $metadata["tests"]["result"]["score"] = $result_element_score["score"];
    $metadata["tests"]["result"]["percentage"] = $result_element_score["percentage"];
    $metadata["tests"]["conditions"]["count"] = $conditions;
    $metadata["tests"]["conditions"]["score"] = $conditions_score["score"];
    $metadata["tests"]["conditions"]["percentage"] = $conditions_score["percentage"];
    $metadata["tests"]["participatingOrgImplementing"]["count"] = $participating_org_implementing;
    $metadata["tests"]["participatingOrgImplementing"]["score"] = $participating_org_implementing_score["score"];
    $metadata["tests"]["participatingOrgImplementing"]["percentage"] = $participating_org_implementing_score["percentage"];
    $metadata["tests"]["participatingOrgAccountable"]["count"] = $participating_org_accountable;
    $metadata["tests"]["participatingOrgAccountable"]["score"] = $participating_org_accountable_score["score"];
    $metadata["tests"]["participatingOrgAccountable"]["percentage"] = $participating_org_accountable_score["percentage"];
    $metadata["tests"]["budget"]["count"] = $budget;
    $metadata["tests"]["budget"]["score"] = $budget_score["score"];
    $metadata["tests"]["budget"]["percentage"] = $budget_score["percentage"];
    $metadata["tests"]["iatiIdentifier"]["count"] = $good_ids;
    $metadata["tests"]["iatiIdentifier"]["score"] = $good_ids_score["score"];
    $metadata["tests"]["iatiIdentifier"]["percentage"] = $good_ids_score["percentage"];
    $metadata["tests"]["transactionTypeCommitment"]["count"] = $transaction_type_commitment;
    $metadata["tests"]["transactionTypeCommitment"]["score"] = $transaction_type_commitment_score["score"];
    $metadata["tests"]["transactionTypeCommitment"]["percentage"] = $transaction_type_commitment_score["percentage"];
    $metadata["tests"]["transactionTypeDisbursementExpenditure"]["count"] = $disbursements_expenditure_count;
    $metadata["tests"]["transactionTypeDisbursementExpenditure"]["score"] = $transaction_type_disb_expend_score["score"];
    $metadata["tests"]["transactionTypeDisbursementExpenditure"]["percentage"] = $transaction_type_disb_expend_score["percentage"];
    $metadata["tests"]["transactionTracability"]["eligable"] = $transactions_that_should_be_traced;
    $metadata["tests"]["transactionTracability"]["count"] = $no_tracable_transactions;
    $metadata["tests"]["transactionTracability"]["score"] = $tracable_score;
    $metadata["tests"]["transactionTracability"]["percentage"] = $percent_tracable;
    $metadata["tests"]["locationText"]["count"] = $location_level_1;
    $metadata["tests"]["locationText"]["score"] = $location_level_1_score["score"];
    $metadata["tests"]["locationText"]["percentage"] = $location_level_1_score["percentage"];
    $metadata["tests"]["locationStructure"]["count"] = $location_level_2;
    $metadata["tests"]["locationStructure"]["score"] = $location_level_2_score["score"];
    $metadata["tests"]["locationStructure"]["percentage"] = $location_level_2_score["percentage"];
    $metadata["tests"]["sector"]["count"] = $activities_with_dac_sector_count;
    $metadata["tests"]["sector"]["score"] = $activities_with_dac_sector_score["score"];
    $metadata["tests"]["sector"]["percentage"] = $activities_with_dac_sector_score["percentage"];
    $metadata["tests"]["language"]["count"] = $activies_in_country_lang_count;
    $metadata["tests"]["language"]["score"] = $activies_in_country_lang_score["score"];
    $metadata["tests"]["language"]["percentage"] = $activies_in_country_lang_score["percentage"];
    $json = json_encode($metadata);
    $json = json_format($json);
    //pretty it up . Function from include functions/pretty_json.php
    file_put_contents($output_file, $json);
    //die;
}
Example #17
0
    $id = $rs->fields['id'];
    $name = $rs->fields['hostname'];
    $threshold_a = $rs->fields['threshold_a'] ? $rs->fields['threshold_a'] : $net_threshold_a;
    $threshold_c = $rs->fields['threshold_c'] ? $rs->fields['threshold_c'] : $net_threshold_c;
    // get host & global metrics
    list($current_a, $current_c) = get_current_metric($host_qualification_cache, $net_qualification_cache, $net, 'host');
    $global_a += $current_a;
    $global_c += $current_c;
    $data = array('name' => $name, 'threshold_a' => $threshold_a, 'threshold_c' => $threshold_c, 'max_c' => $rs->fields['max_c'], 'max_a' => $rs->fields['max_a'], 'max_c_date' => $rs->fields['max_c_date'], 'max_a_date' => $rs->fields['max_a_date'], 'current_a' => $current_a, 'current_c' => $current_c, 'network' => $net_belong, 'group' => $group_belong);
    $hosts[$id] = $data;
    $rs->MoveNext();
}
////////////////////////////////////////////////////////////////
// Global score
////////////////////////////////////////////////////////////////
$global = get_score("global_{$user}", 'global');
list($_current_a, $_current_c) = get_current_metric($host_qualification_cache, $net_qualification_cache, 'global', 'global');
$global['current_a'] = $_current_a;
$global['current_c'] = $_current_c;
$global['threshold_a'] = $conf_threshold;
$global['threshold_c'] = $conf_threshold;
////////////////////////////////////////////////////////////////
// Permissions & Ordering
////////////////////////////////////////////////////////////////
foreach ($networks as $net => $net_data) {
    $net_perms = $net_data['has_perms'];
    if (!$net_perms) {
        unset($networks[$net]);
    }
}
// Groups
Example #18
0
<?php

echo $this->load->view('header');
//Begin HTML
?>
<div class="row" style="min-height:500px;">
<?php 
echo get_score(1);
echo form_open('home', '', $hidden[1]);
$data = array('name' => 'button1', 'id' => 'button1', 'class' => 'btn primary', 'content' => 'Votes');
echo form_button($data);
echo form_close();
?>

<?php 
echo get_score(2);
echo form_open('home', '', $hidden[2]);
$data1 = array('name' => 'button2', 'id' => 'button2', 'value' => 'Votes');
//echo form_button($data1);
echo form_submit($data1);
echo form_close();
?>

</div><!--row-->
<?php 
echo $this->load->view('footer');
//Begin HTML
echo $allnum;
?>
</b>件商品</p>     
                     <p>商品金额<b><?php 
echo $total;
?>
</b>元 </p>                     
                       <p>运费<b ><?php 
echo $trans;
?>
</b>元</p>
                       <p><input type="checkbox" name="score" id="huo" value="<?php 
echo get_score($uid);
?>
"> <b class="red" ><strong>积分<?php 
echo get_score($uid);
?>
,可兑换成<?php 
echo $ratio;
?>
元</strong></b></p>
                          <p class="jiesuan">应付总额 <span id="TotalNeedPay" class="red">¥<?php 
echo $all;
?>
</span>元 <a class="btn_submit_pay"   onclick="makeorder()" >提交订单</a>  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </p>            <!--提交信息 结束-->              

   
</div>   </form> 
    <script type="text/javascript">_init_area();</script>
        <hr/>
        <?php 
 public function order()
 {
     if (!is_login()) {
         $this->error("您还没有登陆", U("User/login"));
     }
     /* 菜单调用*/
     $menu = R('index/menulist');
     $this->assign('categoryq', $menu);
     /* 热词调用*/
     $hotsearch = R("Index/getHotsearch");
     $this->assign('hotsearch', $hotsearch);
     /* uid调用*/
     $uid = D('member')->uid();
     $score = get_score($uid);
     /* 底部分类调用*/
     $menulist = R('Service/AllMenu');
     $this->assign('footermenu', $menulist);
     /* 积分兑换*/
     $ratio = $score / C('RATIO');
     $this->assign('ratio', $ratio);
     $this->assign('uid', $uid);
     /* 创建订单*/
     if (IS_POST) {
         $goodlist = M("shoplist");
         $order = M("order");
         $tag = $this->ordersn();
         //标识号
         for ($i = 0; $i < count($_POST["id"]); $i++) {
             $id = htmlspecialchars($_POST["id"][$i]);
             $num = htmlspecialchars($_POST["num"][$i]);
             $goodlist->goodid = $id;
             $goodlist->status = 1;
             $goodlist->orderid = '';
             $goodlist->parameters = htmlspecialchars($_POST["parameters"][$i]);
             $goodlist->sort = htmlspecialchars($_POST["sort"][$i]);
             $goodlist->num = $num;
             $goodlist->uid = $uid;
             $goodlist->tag = $tag;
             //标识号必须相同
             $goodlist->create_time = NOW_TIME;
             $goodprice = htmlspecialchars($_POST["price"][$i]);
             $goodlist->price = $goodprice;
             $goodtotal = $num * $goodprice;
             $goodlist->total = $goodtotal;
             $goodlist->add();
         }
         $defaultaddress = get_address($uid);
         $this->assign('address', $defaultaddress);
         $a = M("shoplist")->where(" tag='{$tag}'")->select();
         $total = '';
         $num = '';
         foreach ($a as $k => $val) {
             $total += $val['total'];
             $num += $val['num'];
         }
         if ($total < C('LOWWEST')) {
             $trans = C('SHIPMONEY');
         } else {
             $trans = 0;
         }
         $all = $total + $trans;
         $shoplist = M('shoplist')->where("tag='{$tag}'")->select();
         $this->assign('shoplist', $shoplist);
         $this->assign('all', $all);
         $this->assign('num', $num);
         $this->assign('tag', $tag);
         $this->assign('total', $total);
         $this->assign('trans', $trans);
         $this->meta_title = '订单结算';
         $this->display();
     }
 }
Example #21
0
<?php

/*
	[CYASK] (C)2007 Cyask.com QQ: 240508015
	Revision: 3.0.0 for Discuz
	Date: 2007/4/23
*/
define('CURSCRIPT', 'my');
require './include/common.inc.php';
$command = empty($command) ? 'myscore' : $command;
if ($command == 'myscore') {
    $totalscore = get_score($cyask_uid);
    $query = $dblink->query("select count(*) from {$dbprefix}answer where uid={$cyask_uid}");
    $answercount = $dblink->result($query, 0);
    $query = $dblink->query("select count(*) from {$dbprefix}answer where uid={$cyask_uid} and adopttime<>0");
    $adoptcount = $dblink->result($query, 0);
    if ($answercount) {
        $rightvalage = $adoptcount / $answercount * 100;
        $rightvalage = round($rightvalage) . '%';
    } else {
        $rightvalage = '0%';
    }
    $query = $dblink->query("select count(*) from {$dbprefix}ques where uid={$cyask_uid}");
    $question_allcount = $dblink->result($query, 0);
    $query = $dblink->query("select count(*) from {$dbprefix}ques where uid={$cyask_uid} and status=2");
    $questionOK = $dblink->result($query, 0);
    $query = $dblink->query("select count(*) from {$dbprefix}ques where uid={$cyask_uid} and status=1");
    $questionASK = $dblink->result($query, 0);
    $query = $dblink->query("select count(*) from {$dbprefix}ques where uid={$cyask_uid} and status=3");
    $questionVOTE = $dblink->result($query, 0);
    $query = $dblink->query("select count(*) from {$dbprefix}ques where uid={$cyask_uid} and status=4");