function click_action() {
     $friendlink=new friendlink();
     $friendlink->rec_update(array('hits'=>'[hits+1]'),front::get('id'));
     $where=" id=".front::get('id')." ";
     $friendlinks=$friendlink->getrows($where,$limit,'listorder asc,id asc');
     $url=$friendlinks[0][url];
     header("location: $url");
 }
示例#2
0
function friendlink($type,$catid=0,$limit=100,$width=100) {
    $friendlink=new friendlink();
    switch ($type) {
        case 'image':
            $linktype=2;
            break;
        case 'text':
            $linktype=1;
            break;
        default:
            $linktype='';
            break;
    }
    $where=" state>0 ";
    if ($catid)
        $where.="and typeid=$catid ";
    if ($linktype)
        $where.="and linktype=$linktype ";
    $friendlinks=$friendlink->getrows($where,$limit,'listorder asc,id asc');
    foreach ($friendlinks as $order=>$friendlink) {
        if ($friendlink['logo'] &&$catid=2)
            $link_str=helper::img($friendlink['logo'],$width);
        else
            $link_str=$friendlink['name'];
        $friendlinks[$order]['link']="<a href='$friendlink[url]' onmousedown='this.href=\"".url("friendlink/click/id/$friendlink[id]/r/")."\"+Math.random()*5;' target='_blank'>$link_str</a>";
    }
    return $friendlinks;
}