} if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { $errors = "E-mail forması düzgün deyil"; } if (user_exists($username)) { $errors[] = $username . " artıq mövcuddur.Basqa istifadəçi adı yoxlayın<br>"; } if (email_exists($email)) { $errors[] = $email . " artiq mövcuddur.Basqa email yoxlayın<br>"; } // change it afterwards when the code for sending email is added $user_verified = true; if ($user_verified && empty($errors)) { register_user($user_data); //add to database signin($username, $password); //session-larin yaranmasi ucun bu function cagrilir $to = $email; // Send email to our user $subject = 'Signup | Verification'; // Give the email a subject $message = ' Thanks for signing up! Your account has been created, you can login with the following credentials after you have activated your account by pressing the url below. ------------------------ Username: '******' Password: '******' ------------------------
echo "Welcome to the Stack over flow.\n"; $db = new Dbhandler(); $stdin = fopen('php://stdin', 'r'); do { echo "\n****************\n"; echo "\npress 1 to signup\n"; echo "\npress 2 to login \n"; echo "\npress 0 to quit\n"; echo "\n*****************\n"; fscanf(STDIN, "%d\n", $val); switch ($val) { case 1: signup($db); break; case 2: signin($db); break; case 0: break; default: echo "\nPlease enter the above number\n"; break; } } while ($val != 0); function signup($db) { echo "\n*****signup form****\n"; echo "\nEnter username:\n"; $uname = trim(fgets(STDIN)); echo "\nEnter password:\n"; $pass = trim(fgets(STDIN));
<?php require __DIR__ . '/../includes/start.php'; signin(postvar("username"), postvar("password")); if (postvar("pay")) { $_SESSION['pay'] = 1; }
function set_anon_user() { $user = new AnonUser(); if (isset($_POST['nickname'])) $user->setNickname(trim($_POST['nickname'])); else $user->setNickname("Anon"); //$user->setFingerprint("12345"); $user->loadorsave(); $_SESSION['user'] = $user; return $user; } if (isset($_SESSION['user'])){ $user = $_SESSION['user']; $user->load(true); } else if (isset($_COOKIE['nickname']) && isset($_COOKIE['password'])) { $result = signin($_COOKIE['nickname'], $_COOKIE['password'], true, 'yes'); if (isset($_SESSION['user']) && $result['ok']==true) $user = $_SESSION['user']; else { kill_cookies(); $user = set_anon_user(); } } else $user = set_anon_user(); ?>
$tpl->assign('menu_links_admin', Path::menuAdmin('home')); $tpl->assign('token', getToken()); $tpl->draw('list'); exit; } // book asked if (!empty($_GET['book'])) { bookPage(); } // admin asked if (isset($_GET['admin'])) { administration(); } // login asked if (isset($_GET['signin'])) { signin(); } // logout asked if (isset($_GET['signout'])) { signout(); } // new book asked if (isset($_GET['add'])) { addBook(); } // edit book asked if (isset($_GET['edit']) && !empty($_GET['edit'])) { editBook(); } // delete book asked if (isset($_GET['delete']) && !empty($_GET['delete'])) {
<?php require_once "include.php"; if (!is_connected()) { $request = signin($_POST, $connect); } else { $request = 0; } echo $request;
/** * 处理会员登录 * @param $user_name_or_email 用户名或邮箱地址 * @param $user_pwd 密码 * */ function do_login_user($user_name_or_email, $user_pwd) { $user_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where (user_name='" . $user_name_or_email . "' or email = '" . $user_name_or_email . "' or mobile = '" . $user_name_or_email . "') and is_delete = 0"); //载入会员整合 $integrate_code = strim(app_conf("INTEGRATE_CODE")); if ($integrate_code != '' && $GLOBALS['request']['from'] != 'wap') { $integrate_file = APP_ROOT_PATH . "system/integrate/" . $integrate_code . "_integrate.php"; if (file_exists($integrate_file)) { require_once $integrate_file; $integrate_class = $integrate_code . "_integrate"; $integrate_obj = new $integrate_class(); } } if ($integrate_obj) { $result = $integrate_obj->login($user_name_or_email, $user_pwd); } $user_data = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user where (user_name='" . $user_name_or_email . "' or email = '" . $user_name_or_email . "' or mobile = '" . $user_name_or_email . "') and is_delete = 0"); if (!$user_data) { $result['status'] = 0; $result['data'] = ACCOUNT_NO_EXIST_ERROR; return $result; } else { $result['user'] = $user_data; if ($user_data['user_pwd'] != md5($user_pwd . $user_data['code']) && $user_data['user_pwd'] != $user_pwd) { $result['status'] = 0; $result['data'] = ACCOUNT_PASSWORD_ERROR; return $result; } elseif ($user_data['is_effect'] != 1) { $result['status'] = 0; $result['data'] = ACCOUNT_NO_VERIFY_ERROR; return $result; } else { if (intval($result['status']) == 0) { $result['status'] = 1; } //登录成功自动检测关于会员等级以及自动登录商家 $account_name = $user_data['merchant_name']; $account = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "supplier_account where account_name = '" . $account_name . "' and is_effect = 1 and is_delete = 0"); if ($account) { $account_locations = $GLOBALS['db']->getAll("select location_id from " . DB_PREFIX . "supplier_account_location_link where account_id = " . $account['id']); $account_location_ids = array(0); foreach ($account_locations as $row) { $account_location_ids[] = $row['location_id']; } $account['location_ids'] = $account_location_ids; es_session::set("account_info", $account); $GLOBALS['db']->query("update " . DB_PREFIX . "supplier_account set login_ip = '" . CLIENT_IP . "' where id=" . $account['id']); } $user_current_group = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_group where id = " . intval($user_data['group_id'])); $user_group = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_group where score <=" . intval($user_data['total_score']) . " order by score desc"); if ($user_current_group['score'] < $user_group['score']) { $user_data['group_id'] = intval($user_group['id']); $GLOBALS['db']->query("update " . DB_PREFIX . "user set group_id = " . $user_data['group_id'] . " where id = " . $user_data['id']); $pm_content = "恭喜您,您已经成为" . $user_group['name'] . "。"; if ($user_group['discount'] < 1) { $pm_content .= "您将享有" . $user_group['discount'] * 10 . "折的购物优惠"; } send_msg($user_data['id'], $pm_content, "notify", 0); } $user_current_level = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_level where id = " . intval($user_data['level_id'])); $user_level = $GLOBALS['db']->getRow("select * from " . DB_PREFIX . "user_level where point <=" . intval($user_data['point']) . " order by point desc"); if ($user_current_level['point'] < $user_level['point']) { $user_data['level_id'] = intval($user_level['id']); $GLOBALS['db']->query("update " . DB_PREFIX . "user set level_id = " . $user_data['level_id'] . " where id = " . $user_data['id']); $pm_content = "恭喜您,您已经成为" . $user_level['name'] . "。"; send_msg($user_data['id'], $pm_content, "notify", 0); } if ($user_current_level['point'] > $user_level['point']) { $user_data['level_id'] = intval($user_level['id']); $GLOBALS['db']->query("update " . DB_PREFIX . "user set level_id = " . $user_data['level_id'] . " where id = " . $user_data['id']); $pm_content = "很报歉,您已经降为" . $user_level['name'] . "。"; send_msg($user_data['id'], $pm_content, "notify", 0); } send_system_msg($user_data['id']); $user_data = load_user($user_data['id'], true); es_session::set("user_info", $user_data); $GLOBALS['user_info'] = $user_data; es_session::set("user_logined", true); $GLOBALS['user_logined'] = true; es_session::set("user_logined_time", NOW_TIME); $GLOBALS['db']->query("update " . DB_PREFIX . "deal_cart set user_id = " . $GLOBALS['user_info']['id'] . " where session_id = '" . es_session::id() . "'"); require_once APP_ROOT_PATH . "system/model/cart.php"; load_cart_list(true); //检测勋章 $medal_list = $GLOBALS['db']->getAll("select * from " . DB_PREFIX . "medal where is_effect = 1 and allow_check = 1"); foreach ($medal_list as $medal) { $file = APP_ROOT_PATH . "system/medal/" . $medal['class_name'] . "_medal.php"; $cls = $medal['class_name'] . "_medal"; if (file_exists($file)) { require_once $file; if (class_exists($cls)) { $o = new $cls(); $check_result = $o->check_medal(); if ($check_result['status'] == 0) { send_msg($user_data['id'], $check_result['info'], "notify", 0); } } } } //签到 $signin_result = signin($GLOBALS['user_info']['id']); if ($signin_result['status']) { es_session::set("signin_result", $signin_result); } $GLOBALS['db']->query("update " . DB_PREFIX . "user set login_ip = '" . CLIENT_IP . "',login_time= " . NOW_TIME . ",group_id=" . intval($user_data['group_id']) . " where id =" . $user_data['id']); $s_api_user_info = es_session::get("api_user_info"); if ($s_api_user_info) { $GLOBALS['db']->query("update " . DB_PREFIX . "user set " . $s_api_user_info['field'] . " = '" . $s_api_user_info['id'] . "' where id = " . $user_data['id'] . " and (" . $s_api_user_info['field'] . " = 0 or " . $s_api_user_info['field'] . "='')"); es_session::delete("api_user_info"); } $result['step'] = intval($user_data["step"]); return $result; } } }
<?php // Require the initialisation file require_once '../../init.php'; // Required files require_once MAD_PATH . '/www/cp/auth.php'; require_once MAD_PATH . '/functions/adminredirect.php'; require_once MAD_PATH . '/www/cp/admin_functions.php'; if (isset($_POST['md_user']) && isset($_POST['md_pass']) && signin($_POST['md_user'], $_POST['md_pass'])) { mf_prelogin_check(); MAD_Admin_Redirect::redirect('dashboard.php'); } else { MAD_Admin_Redirect::redirect('signin.php?failed=1'); }
<?php require_once './include/include.php'; if (!is_connected()) { if (signin($_POST, $connect)) { header('Location: ' . $_SESSION['current']); } } else { header('Location: ' . $_SESSION['current']); } require_once "./header.php"; ?> <div id="body"> <div id="title">Connexion</div> <div class="error"> <center><?php echo $_SESSION['error']; ?> </center> </div> <form action="signin.php" method="post"> <div class="text">Adresse email :</div> <input type="email" name="mail" /> <div class="text">Mot de passe :</div> <input type="password" name="password" /> <br /><br /> <input class="button" type="submit" name="submit" value="Connexion"> </form> </div> <?php include 'footer.php';
error_reporting(0); $servername = "localhost"; $username = "******"; $password = ""; $pdo = new PDO("mysql:host={$servername};dbname=assassins", $username, $password); $data = json_decode(file_get_contents('php://input'), true); $action = $data['action']; if ($action == NULL) { $action = $_POST['action']; } switch ($action) { case 'signup': signup($pdo); break; case 'signin': signin($data, $pdo); break; case 'signout': signout(); break; case 'getTargetData': getTargetData($pdo); break; case 'saveMessage': saveMessage($data, $pdo); break; } function signup($pdo) { $targetDir = $_SERVER['DOCUMENT_ROOT'] . "/images/"; $targetFile = $targetDir . basename($_FILES["image"]["name"]);
function engine_doit(){ global $CONF; $whats = explode(',', $_GET['what']); $result = null; if (isset($_GET['SYSTEM_redirect'])){ unset($_GET['SYSTEM_redirect']); switch($_GET['what']){ case 'topic': include('basichtml/viewtopic.php'); break; case 'datetopics': include('basichtml/topic_list.php'); break; case 'confirm_user': include('controller/confirm_user.php'); break; case 'user_stopmail': include('controller/user_stopmail.php'); break; case 'add_email': include('controller/add_email.php'); break; case 'remove_email': include('controller/remove_email.php'); break; case 'restore_password': include('controller/restore_password.php'); break; case 'followchannel_acceptreject': include('controller/followchannel_acceptreject.php'); break; case 'autoopenchannel': include('controller/autoopenchannel.php'); break; case 'autoopentopic': include('controller/autoopentopic.php'); break; /* case 'ETUEngine': include('tool/ETUEngine.php'); $etu=new ETUEngine(); $etu->start(1); break; */ } return; } foreach ($whats as $what) { switch($what) { case 'fromname': require_once("controller/fromname.php"); $result['fromname'] = fromname($_GET['id_fromname']); break; case 'setuserfrom': require_once("class/User.php"); $tuser = new RegUser(); $tuser->setNickname($_GET['nick_setuserfrom']); $valid = $tuser->validatePassword($_GET['pass_setuserfrom']); if ($valid) { $tuser->load(); $tuser->setCameFrom($_GET['fromid_setuserfrom']); $tuser->save(); } break; case 'message': require_once('template/TMessage.php'); require_once('class/Message.php'); $message = new Message(); if (isset($_GET['id_message']) && !empty($_GET['id_message'])) $message->setId($_GET['id_message']); else { $result['message']=array(); break; } $tmessage = new TMessage(); $tmessage->setMessage($message); $result['message']=$tmessage->getJsonTags(); break; case 'mymessages': require_once('template/TListMessage.php'); $tlist = new TListMessage(); $tlist->setListType("cloneMy"); $tlist->setOnlySubsumed(true); if (isset($_GET['sorting_mymessages'])) $tlist->setSorting($_GET['sorting_mymessages']); if (isset($_GET['lastid_mymessages'])) $tlist->setLastId($_GET['lastid_mymessages']); $result['mymessages']=$tlist->getJsonTags(); break; case 'regchannel': require_once("template/TChannel.php"); require_once("class/Channel.php"); $t = new TChannel(); $o=new Channel(); $prettyUrl=''; if (isset($_GET['id_regchannel'])) { $o->setId($_GET['id_regchannel']); } elseif (isset($_GET['name_regchannel'])) { if (substr($_GET['name_regchannel'],-1,1)=='-'){ $result['regchannel']=array("ok"=>false,"error"=>"invalid name","exist"=>true,'prettyUrl'=>''); break; } else { $o->setName($_GET['name_regchannel']); $prettyUrl=Channel::prettyUrlAvailable($_GET['name_regchannel']); } } elseif (isset($_GET['urlname_regchannel'])) { if ($_GET['urlname_regchannel'] != Channel::prettyUrl($_GET['urlname_regchannel'])){ $result['regchannel']=array("ok"=>false,"error"=>"invalid url","exist"=>true, 'prettyUrl'=>''); break; } $o->setUrlname($_GET['urlname_regchannel']); $prettyUrl=$_GET['urlname_regchannel']; } else { $result['regchannel']=array("ok"=>false,"error"=>"no param", "exist"=>true, 'prettyUrl'=>''); break; } $t->setChannel($o); $r=$t->getJsonTags(); if ($r['id']==null || $r['name']==null || $r['lang']==null) $result['regchannel']=array("ok"=>true,"error"=>"","exist"=>false,'prettyUrl'=>$prettyUrl); else $result['regchannel']=array("ok"=>true,"error"=>"","exist"=>true,'prettyUrl'=>$r['urlname']); break; case 'channels': require_once('template/TListChannel.php'); $tlist = new TListChannel(); $tlist->setListType("cloneAll"); $tlist->setOnlySubsumed(true); if (isset($_GET['sorting_channels'])) $tlist->setSorting($_GET['sorting_channels']); $result['channels']=$tlist->getJsonTags(); break; case 'followedchannels': require_once('template/TListChannel.php'); $tlist = new TListChannel(); if ($_SESSION['user']->isAnon()) $tlist->setListType("cloneAll"); else $tlist->setListType("cloneFollowed"); $tlist->setOnlySubsumed(true); if (isset($_GET['sorting_followedchannels'])) $tlist->setSorting($_GET['sorting_followedchannels']); $result['followedchannels']=$tlist->getJsonTags(); break; case 'mychannels': require_once('template/TListChannel.php'); $tlist = new TListChannel(); $tlist->setListType("cloneMy"); $tlist->setOnlySubsumed(false); if (isset($_GET['sorting_mychannels'])) $tlist->setSorting($_GET['sorting_mychannels']); $result['mychannels']=$tlist->getJsonTags(); break; case 'mostvisitedchannels': require_once('template/TListChannel.php'); $tlist = new TListChannel(); $tlist->setListType("cloneMostVisited"); $tlist->setOnlySubsumed(false); if (isset($_GET['qtd_mostvisitedchannels'])) $tlist->setQtd($_GET['qtd_mostvisitedchannels']); if (isset($_GET['signed_mostvisitedchannels'])) $tlist->setSigned($_GET['signed_mostvisitedchannels']); $result['mostvisitedchannels']=$tlist->getJsonTags(); break; case 'recommendedchannels': require_once('template/TListChannel.php'); $tlist = new TListChannel(); $tlist->setListType("cloneRecommended"); $tlist->setOnlySubsumed(false); if (isset($_GET['qtd_recommendedchannels'])) $tlist->setQtd($_GET['qtd_recommendedchannels']); $result['recommendedchannels']=$tlist->getJsonTags(); break; case 'channel': require_once('template/TChannel.php'); require_once('class/Channel.php'); $channel = new Channel(); if (isset($_GET['id_channel']) && !empty($_GET['id_channel'])) $channel->setId($_GET['id_channel']); elseif (isset($_GET['name_channel']) && !empty($_GET['name_channel'])) $channel->setName($_GET['name_channel']); else { $result['channel']=array(); break; } $tchannel = new TChannel(); $tchannel->setChannel($channel); $result['channel']=(array('channel'=>$tchannel->getJsonTags(), "topics"=>array() )); break; case 'followedchanneltopics': require_once('template/TListTopic.php'); $tlisttopic = new TListTopic(); $tlisttopic->setListType("cloneChannelFollowed"); $tlisttopic->setOnlySubsumed(true); if (isset($_GET['orderid_followedchanneltopics'])) $tlisttopic->setOrderId($_GET['orderid_followedchanneltopics']); if (isset($_GET['lastorderid_followedchanneltopics'])) $tlisttopic->setLastOrderId($_GET['lastorderid_followedchanneltopics']); if (isset($_GET['sorting_followedchanneltopics'])) $tlisttopic->setSorting($_GET['sorting_followedchanneltopics']); if (isset($_GET['qtd_followedchanneltopics'])) $tlisttopic->setQtd($_GET['qtd_followedchanneltopics']); $result['followedchanneltopics']=$tlisttopic->getJsonTags(); break; case 'recenttopics': require_once('getter/recenttopics.php'); $result['recenttopics']=recenttopics(); break; case 'datetopics': require_once('template/TListTopic.php'); if (!isset($_GET['year_datetopics'])) { $result['datetopics']=array(); break; } $tlisttopic = new TListTopic(); $tlisttopic->setListType("cloneByDate"); $tlisttopic->setOnlySubsumed(true); $tlisttopic->setYear($_GET['year_datetopics']); if (isset($_GET['month_datetopics'])) $tlisttopic->setMonth($_GET['month_datetopics']); if (isset($_GET['day_datetopics'])) $tlisttopic->setDay($_GET['day_datetopics']); $result['datetopics']=$tlisttopic->getJsonTags(); break; case 'searchtopics': require_once('template/TListTopic.php'); require_once('tool/SearchTopic.php'); if (isset($_GET['words_searchtopics'])){ $tlisttopic = new TListTopic(); $tlisttopic->setListType("cloneSearch"); $tlisttopic->setOnlySubsumed(true); $tlisttopic->setSearch(SearchTopic::getQuery($_GET['words_searchtopics'])); if (isset($_GET['orderid_searchtopics'])) $tlisttopic->setOrderId($_GET['orderid_searchtopics']); $result['searchtopics']=$tlisttopic->getJsonTags(); } else $result['searchtopics']=array("ok"=>false,"error"=>"no words"); break; case 'searchmain': require_once('template/TListChannel.php'); require_once('tool/SearchEngine.php'); if (isset($_GET['words_searchmain'])){ $tlisttopic = new TListChannel(); $tlisttopic->setListType("cloneSearch"); $tlisttopic->setOnlySubsumed(true); $tlisttopic->setSearch(SearchEngine::getQueryChannels(unescape_ampersand($_GET['words_searchmain']))); //if (isset($_GET['orderid_searchtopics'])) $tlisttopic->setOrderId($_GET['orderid_searchtopics']); $result['searchmain']['channels']=$tlisttopic->getJsonTags(); } else $result['searchmain']=array("ok"=>false,"error"=>"no words"); break; case 'usertopics': require_once('template/TListTopic.php'); require_once('class/User.php'); if (isset($_GET['nickname_usertopics'])){ $tlisttopic = new TListTopic(); $tlisttopic->setListType("cloneByUser"); $tlisttopic->setOnlySubsumed(true); if (isset($_GET['sorting_usertopics'])) $tlisttopic->setSorting($_GET['sorting_usertopics']); $u=new RegUser(); $u->setNickname($_GET['nickname_usertopics']); $u->load(); $tlisttopic->setUser($u); if (isset($_GET['orderid_usertopics'])) $tlisttopic->setOrderId($_GET['orderid_usertopics']); if (isset($_GET['idchannel_usertopics'])) $tlisttopic->setIdChannel($_GET['idchannel_usertopics']); $result['usertopics']=$tlisttopic->getJsonTags(); } else $result['usertopics']=array(); break; case 'userposttopics': require_once('template/TListTopic.php'); require_once('class/User.php'); if (isset($_GET['nickname_userposttopics'])){ $tlisttopic = new TListTopic(); $tlisttopic->setListType("cloneByUserPost"); $tlisttopic->setOnlySubsumed(true); if (isset($_GET['sorting_userposttopics'])) $tlisttopic->setSorting($_GET['sorting_userposttopics']); $u=new RegUser(); $u->setNickname($_GET['nickname_userposttopics']); $u->load(); $tlisttopic->setUser($u); if (isset($_GET['orderid_userposttopics'])) $tlisttopic->setOrderId($_GET['orderid_userposttopics']); if (isset($_GET['idchannel_userposttopics'])) $tlisttopic->setIdChannel($_GET['idchannel_userposttopics']); $result['userposttopics']=$tlisttopic->getJsonTags(); } else $result['userposttopics']=array(); break; case 'uft': require_once('getter/uft.php'); $result['uft']=uft(); break; case 'followedtopics': require_once('conf/session.php'); require_once('template/TListTopic.php'); $tlisttopic = new TListTopic(); $tlisttopic->setListType("cloneFollowed"); $tlisttopic->setOnlySubsumed(true); if (isset($_GET['orderid_followedtopics'])) $tlisttopic->setOrderId($_GET['orderid_followedtopics']); if (isset($_GET['idchannel_followedtopics'])) $tlisttopic->setIdChannel($_GET['idchannel_followedtopics']); $result['followedtopics']=$tlisttopic->getJsonTags() ; break; case 'topic': if (!isset($_GET['id_topic']) || empty($_GET['id_topic'])) { $result['topic']=array(); break; } require_once('template/TTopic.php'); require_once('template/TListPost.php'); require_once('class/Topic.php'); require_once('class/Channel.php'); $topic = new Topic(); $topic->setId($_GET['id_topic']); if (!$topic->getChannel()->canIRead()){ $result['topic']=array("error"=>'you cant see this topic'); break; } $ttopic = new TTopic(); $ttopic->setTopic($topic); $tlistpost = new TListPost(); $tlistpost->setTopic($topic); $tlistpostbest = new TListPost(); $tlistpostbest->setTopic($topic); $tlistpostbest->setQtd($CONF['post_best_qt']); $tlistpostbest->setSorting("likes desc,date desc"); $result['topic']=(array('topic'=>$ttopic->getJsonTags(), "posts"=>$tlistpost->getJsonTags(), "bestposts"=>$tlistpostbest->getJsonTags()) ); break; case 'refresh_topic_previews': if (!isset($_GET['ids_refresh_topic_previews']) || empty($_GET['ids_refresh_topic_previews'])) { $result['refresh_topic_previews']=array(); break;} if (!isset($_GET['versions_refresh_topic_previews']) || empty($_GET['versions_refresh_topic_previews'])) { $result['refresh_topic_previews']=array(); break;} require_once("template/TListTopic.php"); $tlisttopic = new TListTopic(); $tlisttopic->setListType("cloneUpdated"); $tlisttopic->setOnlySubsumed(true); $tlisttopic->setIds(explode(",",$_GET['ids_refresh_topic_previews'])); $tlisttopic->setCounters(explode(",",$_GET['versions_refresh_topic_previews'])); $result['refresh_topic_previews']=$tlisttopic->getJsonTags(); break; case 'refresh_topics': if (!isset($_GET['ids_refresh_topics']) || empty($_GET['ids_refresh_topics'])) { $result['refresh_topics']=array(); break;} if (!isset($_GET['versions_refresh_topics']) || empty($_GET['versions_refresh_topics'])){ $result['refresh_topics']=array(); break;} require_once("template/TListTopic.php"); $tlisttopic = new TListTopic(); $tlisttopic->setListType("cloneUpdated"); $tlisttopic->setWithPosts(true); if (isset($_GET['idchannel_refresh_topics'])) $tlisttopic->setIdChannel($_GET['idchannel_refresh_topics']); $tlisttopic->setIds(explode(",",$_GET['ids_refresh_topics'])); $tlisttopic->setCounters(explode(",",$_GET['versions_refresh_topics'])); $result['refresh_topics']=$tlisttopic->getJsonTags(); break; case 'new_topic_previews': require_once("getter/new_topic_previews.php"); $result['new_topic_previews']=new_topic_previews(); break; case 'reguser': require_once("template/TUser.php"); require_once("class/User.php"); $tuser = new TUser(); $u=new RegUser(); if (isset($_GET['id_reguser'])) $u->setId($_GET['id_reguser']); elseif (isset($_GET['email_reguser'])) $u->setEmail($_GET['email_reguser']); elseif (isset($_GET['nickname_reguser'])) { if (substr($_GET['nickname_reguser'],-1,1)=='-'){ $result['reguser']=array("ok"=>true,"error"=>"","exist"=>true); break; } else { $u->setNickname($_GET['nickname_reguser']); } } else { $result['reguser']=array("ok"=>false,"error"=>"no param"); break; } $tuser->setUser($u); $r=$tuser->getJsonTags(); if ($r['id']==null || $r['nickname']==null || $r['lang']==null) $result['reguser']=array("ok"=>true,"error"=>"","exist"=>false); else $result['reguser']=array("ok"=>true,"error"=>"","exist"=>true); break; case 'userscamefrom': require_once('template/TListUser.php'); $tlist = new TListUser(); $tlist->setListType("cloneLastCameFrom"); if (isset($_GET['camefrom_userscamefrom'])) $tlist->setCameFrom($_GET['camefrom_userscamefrom']); if (isset($_GET['qtd_userscamefrom'])) $tlist->setQtd($_GET['qtd_userscamefrom']); $result['userscamefrom']=$tlist->getJsonTags(); break; case 'user': require_once("template/TUser.php"); require_once("class/User.php"); global $user; $tuser = new TUser(); if (!isset($_GET['id_user']) || !isset($_GET['anon_user'])){ $tuser->setUser($user); $tuser->setWithEmail(true); } else{ if ($_GET['anon_user']){ $u = new AnonUser(); $u->setId($_GET['id_user']); } else { $u = new RegUser(); $u->setId($_GET['id_user']); } $tuser->setUser($u); } $result['user']=$tuser->getJsonTags(); break; case 'add_topic': require_once('controller/add_topic.php'); $result['add_topic']=add_topic(); break; case 'add_message': require_once('controller/add_message.php'); $result['add_message']=add_message(); break; case 'read_message': require_once('controller/read_message.php'); $result['read_message']=read_message(); break; case 'add_channel': require_once('controller/add_channel.php'); $result['add_channel']=add_channel(); break; case 'add_post': require_once('controller/add_post.php'); $result['add_post']=add_post(); break; case 'update_channel': require_once('controller/update_channel.php'); $result['update_channel']=update_channel(); break; case 'update_topic': require_once('controller/update_topic.php'); $result['update_topic']=update_topic(); break; case 'update_post': require_once('controller/update_post.php'); $result['update_post']=update_post(); break; case 'followtopic': require_once('controller/followtopic.php'); $result['followtopic']=followtopic(); break; case 'unfollowtopic': require_once('controller/unfollowtopic.php'); $result['unfollowtopic']=unfollowtopic(); break; case 'followchannel': require_once('controller/followchannel.php'); $result['followchannel']=followchannel($_GET['channelid_followchannel']); break; case 'followchannels': require_once('controller/followchannel.php'); $chids=explode(",",$_GET['channelids_followchannels']); for ($i=0;$i<count($chids);$i++) $result['followchannels'][$i]=followchannel($chids[$i]); break; case 'unfollowchannel': require_once('controller/unfollowchannel.php'); $result['unfollowchannel']=unfollowchannel(); break; case 'create_account': require_once('controller/create_account.php'); $result['create_account']=create_account(); break; case 'update_user_avatar': require_once('controller/update_user_avatar.php'); $result['update_user_avatar'] = update_user_avatar($_GET['file'],$_GET['x1'],$_GET['y1'],$_GET['x2'],$_GET['y2']); break; case 'upload_temp_avatar': require_once('controller/upload_temp_avatar.php'); $result['upload_temp_avatar'] = upload_temp_avatar(); break; case 'update_channel_logo': require_once('controller/update_channel_logo.php'); $result['update_channel_logo'] = update_channel_logo($_GET['file'],$_GET['x1'],$_GET['y1'],$_GET['x2'],$_GET['y2']); break; case 'upload_temp_logo': require_once('controller/upload_temp_logo.php'); $result['upload_temp_logo'] = upload_temp_logo(); break; case 'update_user': require_once('controller/update_user.php'); $result['update_user'] = update_user(); break; case 'change_user_lang': require_once('controller/change_user_lang.php'); $result['change_user_lang']=change_user_lang(); break; case 'like_dislike_this': require_once("controller/like_dislike_this.php"); $result['like_dislike_this'] = like_dislike_this(); break; case 'signin': $result['signin'] = signin($_POST['nickname_signin'], $_POST['password_signin'], false, $_POST['staysignedin_signin']); break; case 'signout': require_once("controller/signout.php"); $result['signout'] = signout(); break; case 'request_restore_password': require_once('controller/request_restore_password.php'); $result['request_restore_password']=request_restore_password(); break; case 'visittopic': require_once('class/Topic.php'); if (!isset($_GET['topicid_visittopic'])) $result['visittopic']=array("ok"=>false,"error"=>"error no id"); else { $topic = new Topic(); $topic->setId($_GET['topicid_visittopic']); if ($topic->visit()) $result['visittopic']=array("ok"=>true,"error"=>""); else $result['visittopic']=array("ok"=>false,"error"=>"error db"); } break; case 'deletetopic': require_once('controller/deletetopic.php'); $result['deletetopic']=deletetopic(); break; case 'lang': require_once('conf/location.php'); global $LANG; $result['lang']=$LANG['JSON']; break; default: break; } } return $result; }
require_once "./class/class_output_html.php"; require_once './class/class_db.php'; $usernum = $_POST['usernum']; $userpasswd1 = $_POST['password']; $userpasswd2 = $_POST['password_check']; outPutHeader(); function filled_out($form_vars) { foreach ($form_vars as $key => $value) { if (!isset($key) || $value == '') { return false; } } return true; } try { if (!filled_out($_POST)) { throw new Exception("You have not filled the form out correctly - please go back and try again."); } if ($userpasswd1 != $userpasswd2) { throw new Exception('两次密码输入不一致,请重新输入'); } if (strlen($userpasswd1) >= 17 || strlen($userpasswd1) <= 11) { throw new Exception('密码长度不正确,请重新输入'); } signin($usernum, $userpasswd1); echo outPutMiddleResult("<h3>注册成功<h3>"); } catch (Exception $e) { echo outPutMiddleResult($e->getMessage()); } outPutFooter();