Ejemplo n.º 1
0
     $arr = explode(',', $_REQUEST['sub']);
     array_pop($arr);
     foreach ($arr as $k => $v) {
         $array[] = explode('.', $v);
     }
     foreach ($array as $k => $v) {
         $vote[$v[0]] = $v;
     }
     foreach ($vote as $k => $v) {
         unset($vote[$k][0]);
     }
     results_show($vote);
 } else {
     if ($_REQUEST['action'] == 'list') {
         $year = year();
         $mouth = mouth();
         $date = date1();
         $time = date_handling();
         $sql = "select * from vote_view";
         $view = $db->getOne($sql);
         if (is_numeric($view['number']) && is_numeric($view['group'])) {
             $sql = "select t1.*,t2.* from vote as t1 left join vote_content as t2 on t1.vid = t2.vid where t1.is_show = 1 and t2.content != '0' and t1.is_show =1 and t1.vote_starttime<={$time} and t1.vote_endtime>={$time} and t1.`group` = '{$view['group']}' order by t1.vid desc   limit 0,{$view['number']}";
         } else {
             $sql = "select t1.*,t2.* from vote as t1 left join vote_content as t2 on t1.vid = t2.vid where t1.is_show = 1 and t2.content != '0' and t1.is_show =1 and t1.vote_starttime<={$time} and t1.vote_endtime>={$time} order by t1.vid desc   limit 0,4";
         }
         $vote = $db->getAll($sql);
         $vote = data_handling($vote);
         //var_dump($GLOBALS['user']);
         if (($_REQUEST['user_id'] || $_COOKIE[user_id]) && empty($_COOKIE['Moo_username'])) {
             $uid = $_REQUEST['user_id'];
             $sql = "select nick_name from vote_member where uid = '{$uid}'";
Ejemplo n.º 2
0
function member_add($add)
{
    global $db;
    global $smarty;
    //GLOBAL $mem;
    //var_dump($add);
    $sql = "select nick_name from  vote_member where nick_name = '{$add['nickname']}'";
    //$one = $db->getOne($sql);
    if ($one) {
        $year = year();
        $mouth = mouth();
        $date = date1();
        $text = '昵称重复';
        $sex = $add['sex'];
        $region = $add['region'];
        $password = $add['passwd'];
        $region_city = $add['region_city'];
        $birthdatey = $add['birthdatey'];
        $birthdatem = $add['birthdatem'];
        $birthdated = $add['birthdated'];
        $cellphone = $add['cellphone'];
        $phone = $add['phone'];
        $marriage = $add['marriage'];
        $education = $add['education'];
        $email = $add['email'];
        $time = date_handling();
        $sql = "select * from vote_view";
        $view = $db->getOne($sql);
        if (is_numeric($view['number']) && is_numeric($view['group'])) {
            $sql = "select t1.*,t2.* from vote as t1 left join vote_content as t2 on t1.vid = t2.vid where t1.is_show = 1 and t2.content != '0' and t1.is_show =1 and t1.vote_starttime<={$time} and t1.vote_endtime>={$time} and t1.`group` = '{$view['group']}' order by t1.vid desc   limit 0,{$view['number']}";
        } else {
            $sql = "select t1.*,t2.* from vote as t1 left join vote_content as t2 on t1.vid = t2.vid where t1.is_show = 1 and t2.content != '0' and t1.is_show =1 and t1.vote_starttime<={$time} and t1.vote_endtime>={$time} order by t1.vid desc   limit 0,4";
        }
        $vote = $db->getAll($sql);
        $vote = data_handling($vote);
        if ($_REQUEST['user_id']) {
            $uid = $_REQUEST['user_id'];
            $sql = "select nick_name from vote_member where uid = '{$uid}'";
            $user_name = $db->getOne($sql);
            $nickname = $user_name['nick_name'];
        } else {
            $uid = '0';
        }
        $vote = content($vote);
        foreach ($vote as $key => $value) {
            $vote_up[$key + 1] = $vote[$key];
        }
        exit;
    } else {
        if ($add['birthdatem'] == '0') {
            $birthdatem = '00';
        } else {
            if ($add['birthdatem'] < '10') {
                $birthdatem = '0' . $add['birthdatem'];
            } else {
                $birthdatem = $add['birthdatem'];
            }
        }
        if ($add['birthdated'] == '0') {
            $birthdated = '00';
        } else {
            if ($add['birthdated'] < '10') {
                $birthdated = '0' . $add['birthdated'];
            } else {
                $birthdated = $add['birthdated'];
            }
        }
        if ($add['birthdatey'] == '0') {
            $birthdatey = '1900';
        } else {
            $birthdatey = $add['birthdatey'];
        }
        $birthdate = $birthdatey . $birthdatem . $birthdated;
        $passwd = md5($add[passwd]);
        $sql = "insert into vote_member (nick_name,password,sex,region,region_city,birthdate,cellphone,phone,marriage,education,email) values ('{$add['nickname']}','{$passwd}','{$add['sex']}','{$add['region']}',{$add['region_city']},'{$birthdate}','{$add['cellphone']}','{$add['phone']}','{$add['marriage']}','{$add['education']}','{$add['email']}')";
        $db->query($sql);
        $sql = "select uid from vote_member where nick_name = '{$add['nickname']}'";
        $uid = $db->getOne($sql);
        $user_id = $uid['uid'];
        MooSetCookie('user_id', $user_id, time() + 3600 * 24);
        MooMessageAdmin('注册成功,欢迎参与投票', 'index.php?n=service&h=qixi&user_id=' . $user_id, 1);
    }
}