示例#1
0
function need_be_user()
{
    $role = user_role_switch($_SESSION['role'], true);
    if (1 != $role) {
        $msg = "对不起,您不是普通用户,只有普通用户能做任务";
        $to_name = '首页';
        global $siteRoot;
        $to_url = $siteRoot;
        delay_jump(2, $msg, $to_url, $to_name);
    }
}
示例#2
0
        $sql = "insert into user (email, nick_name, pass, role, reg_time) values('{$e}', '{$n}', sha1('{$ency_p}'), '{$role_type}', now())";
        $num = $dbo->exeUpdate($sql);
        if (1 != $num) {
            // 写注册信息失败
            if (DEBUG) {
                echo "debug, reg.php, 用户注册数据插入失败, sql=[{$sql}]";
            } else {
                die('<script language="javascript">alert("对不起,出现了一些错误,请稍候");</script>');
            }
        } else {
            // 注册成功 跳向登录页面
            $msg = '注册成功...请使用您刚刚注册成功的登录邮箱和密码登录';
            $to_url = 'index.php';
            $to_name = '主页';
            $sec = 3;
            delay_jump($sec, $msg, $to_url, $to_name);
        }
    }
}
// 页面尚未提交,现在给出注册页面
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html xmls="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="content-type" content="text/html; charset=utf-8" />
	<title>注册微动力帐号</title>
	<link rel="stylesheet" href="style/main.css" type="text/css" />
</head>

<body>
示例#3
0
session_start();
include_once "../config.php";
// init $authURL
include_once $webRoot . "foundation/status.php";
if (!is_login()) {
    header('Location:' . $siteRoot . 'index.php');
}
require_once $webRoot . 'foundation/debug.php';
require_once $webRoot . 'foundation/page.php';
require_once $webRoot . 'foundation/price.php';
require_once $webRoot . 'lib/saetv2.ex.class.php';
/*
    从当前用户的当前原创微博中选择一条作为转发任务
*/
if (!is_bound_sina()) {
    delay_jump(3, "对不起,您尚未绑定新浪微博,绑定后才能发布任务。", "主页");
}
$stoken = $_SESSION['stoken'];
$c = new SaeTClientV2(WB_AKEY, WB_SKEY, $stoken);
$api_res = $c->user_timeline_by_id(NULL, 1, 50, 0, 0, 1, 1, 0);
if_weiboapi_fail($api_res);
$weibos = $api_res['statuses'];
$i = 0;
$count = count($weibos);
?>
<form action="index.php">
    <input type="radio" name="hello" value="hello" id="hello" />hello<br />
    <input type="radio" name="there" value="there" id="there" />there<br />
</form>
<?php 
echo '<form action="config_task.php" method="post"><fieldset><legend>请从下列微博中选取一条作为任务</legend>';
示例#4
0
        $location = $dbo->real_escape_string($person['location']);
        $description = $dbo->real_escape_string($person['description']);
        $sql = "insert into task_info_sina_follow values(NULL, '{$last_task_id}', '{$pid}', '{$screen_name}', '{$person['friends_count']}', '{$person['followers_count']}', '{$person['statuses_count']}', '{$person['profile_image_url']}', '{$person['avatar_large']}', '{$location}', '{$description}')";
        $num = $dbo->exeUpdate($sql);
        if (1 != $num) {
            $msg = '数据库插入数据出错。SQL:' . $sql;
            debug($msg, __FILE__, __LINE__);
            // 回滚金钱数据和task表数据
            $sql1 = "delete from task where task_id = '{$last_task_id}' limit 1";
            $num1 = $dbo->exeUpdate($sql1);
            $sql2 = "update user set realtime_money = realtime_money + {$db_total_price} where user_id = '{$_SESSION['uid']}' limit 1";
            $num2 = $dbo->exeUpdate($sql2);
            if (1 != $num1) {
                $msg = "回滚金钱数据失败,这个比较糟糕。SQL:" . $sql1;
                debug($msg, __FILE__, __LINE__);
            }
            if (1 != $num2) {
                $msg = "回滚task数据失败,SQL:" . $sql2;
                debug($msg, __FILE__, __LINE__);
            }
        }
        // 任务插入完毕
        $_SESSION['user_realtime_money'] -= price_db_to_user($db_total_price);
        $msg = "恭喜,任务创建成功";
        $to_url = $siteRoot . 'task.php';
        // 如何跳到指定的任务?设立‘我的任务页面’?
        delay_jump(3, $msg, $to_url, '任务列表');
        break;
    default:
        $msg = '暂不支持该类型';
}
示例#5
0
    }
    // 做成功了,写数据库,写SESSION    对应do_task status 11 正常完成
    // 写do_task表
    $db_level_money = price_base_to_level($base_price, $_SESSION['slevel']);
    $sql = "insert do_task (task_id, user_id, status, task_type, owner_name, income, repost_mid, time)values({$task_id}, {$_SESSION['uid']}, 11, 2, '{$task_owner_name}', '{$db_level_money}', NULL, now())";
    $sql_num = $dbo->exeUpdate($sql);
    if (1 != $sql_num) {
        $dbo->close();
        $debug_msg = '写数据库失败。SQL statement: ' . $sql;
        debug($debug_msg, __FILE__, __LINE__, TRUE, 'error');
        exit;
    }
    // 写user表
    $sql = "update user set task_taken=task_taken+1, task_finished=task_finished+1," . " total_money=total_money+{$db_level_money}, realtime_money=realtime_money+{$db_level_money}" . " where user_id = {$_SESSION['uid']} limit 1";
    $sql_num = $dbo->exeUpdate($sql);
    if (1 != $sql_num) {
        $dbo->close();
        $debug_msg = '写数据库失败。SQL statement: ' . $sql;
        debug($debug_msg, __FILE__, __LINE__, TRUE, 'error');
        exit;
    }
    // 写数据成功,释放数据库连接
    $dbo->close();
    // 写SESSION
    $_SESSION['user_realtime_money'] = $_SESSION['user_realtime_money'] + price_db_to_user($db_level_money);
    $_SESSION['followed_id'][] = $sina_uid;
    $msg = '恭喜!您成功完成了XX任务,获利XX元。';
    $to_url = $_SERVER['HTTP_REFERER'];
    $to_name = '任务列表';
    delay_jump(3, $msg, $to_url, $to_name);
}