public function register($member_group_id = 2, $username = null, $password = null, $email = null, $mobile = null) { if (IS_POST) { $data = array('member_group_id' => $member_group_id, 'username' => $username, 'password' => $password, 'email' => $email, 'mobile' => $mobile, 'account' => create_account(), 'create_time' => NOW_TIME, 'update_time' => NOW_TIME); //验证手机 //if(empty($data['mobile'])) unset($data['mobile']); $user = D('Member'); /* 添加用户 */ if ($user->create($data)) { $user->password = ainiku_ucenter_md5($user->password); $user->member_group_id = $member_group_id; $result = $user->add(); //return $this->$uid ? '注册成功' : '注册失败'; //0-未知错误,大于0-注册成功 if (0 < $result) { $this->success('注册成功', U('login')); } else { $this->error('注册失败'); } } else { return $this->error($user->getError()); } } else { if (IS_AJAX) { $this->display('ajaxregister'); } else { $this->display(); } } }
function ldapauth_hook_authenticate($a, &$b) { $mail = ''; if (ldapauth_authenticate($b['username'], $b['password'], $mail)) { $results = q("SELECT * FROM account where account_email = '%s' OR account_email = '%s' AND account_flags in (0,1) limit 1", dbesc($b['username']), dbesc($mail)); if (!$results && $mail && intval(get_config('ldapauth', 'create_account')) == 1) { require_once 'include/account.php'; $acct = create_account(array('email' => $mail, 'password' => random_string())); if ($acct['success']) { logger('ldapauth: Created account for ' . $b['username'] . ' using ' . $mail); info(t('An account has been created for you.')); $b['user_record'] = $acct['account']; $b['authenticated'] = 1; } } elseif (intval(get_config('ldapauth', 'create_account')) != 1 && !$results) { logger('ldapauth: User ' . $b['username'] . ' authenticated but no db-record and. Rejecting auth.'); notice(t('Authentication successful but rejected: account creation is disabled.')); return; } if ($results) { logger('ldapauth: Login success for ' . $b['username']); $b['user_record'] = $results[0]; $b['authenticated'] = 1; } } return; }
public function QQregister($openid) { $qqinfo = session('qqinfo'); $data['openid'] = $openid; $data['member_group_id'] = 2; //$data['account'] = create_account(); $data['nickname'] = $qqinfo['nickname']; $mem = M('Member'); $re = $mem->where("openid='{$openid}'")->find(); if (!empty($re)) { $data['member_id'] = $re['member_id']; if ($mem->create($data)) { //保存或更新qq的信息到数据库 $mem->save(); } //已经是登陆用户 return $re['member_id']; } else { /* 添加用户 */ $data['last_login_ip'] = get_client_ip(); $data['account'] = create_account(); $data['username'] = $data['account']; //生成用户名 $uid = $mem->add($data); return $uid ? $uid : 0; //0-未知错误,大于0-注册成功 } }
public function add($member_group_id = '', $username = '', $password = '', $repassword = '', $email = '') { if (IS_POST) { /* 检测密码 */ if ($password != $repassword) { $this->error('密码和重复密码不一致!'); } $data = array('member_group_id' => $member_group_id, 'username' => $username, 'password' => $password, 'email' => $email, 'mobile' => $mobile, 'create_time' => NOW_TIME, 'update_time' => NOW_TIME, 'account' => create_account()); //自动判断用户名是哪个字段 $data[get_account_type($username)] = $username; $mem = D('Member'); /* 添加用户 */ if ($mem->create($data)) { $mem->password = ainiku_ucenter_md5($mem->password); $uid = $mem->add(); return $uid > 0 ? $this->success('添加成功') : $this->error('添加失败'); //0-未知错误,大于0-注册成功 } else { return $this->error($mem->getError()); //错误详情见自动验证注释 } } else { $field = get_model_attr('member'); $this->assign('fieldarr', $field); $this->meta_title = '新增用户'; $this->display('edit'); } }
/** /** * 注册一个新用户 * @param string $username 用户名 * @param string $password 用户密码 * @param string $email 用户邮箱 * @param string $mobile 用户手机号码 * @return integer 注册成功-用户信息,注册失败-错误编号 */ public function register($member_group_id, $username, $password, $email, $mobile) { $data = array('member_group_id' => $member_group_id, 'username' => $username, 'password' => $password, 'email' => $email, 'mobile' => $mobile, 'create_time' => NOW_TIME, 'update_time' => NOW_TIME, 'account' => create_account()); //验证手机 if (empty($data['mobile'])) { unset($data['mobile']); } /* 添加用户 */ if ($this->create($data)) { $this->data['password'] = ainiku_ucenter_md5($this->data['password']); $uid = $this->add(); return $uid ? $uid : 0; //0-未知错误,大于0-注册成功 } else { return $this->getError(); //错误详情见自动验证注释 } }
function main() { if (!empty($_POST["type"]) && !empty($_POST["email"]) && !empty($_POST["password"])) { $email = $_POST["email"]; $password = $_POST["password"]; $type = $_POST["type"]; if ($type == "create" && !empty($_POST["username"])) { $username = $_POST["username"]; create_account($email, $password, $username); } else { if ($type == "login") { login($email, $password); } else { redirect("index", "Oops! Post information wasn't passed."); } } } }
function check_account_exists() { $username = strtolower(trim($_POST['username'])); $command = "show account {$username}\r\n"; $sock = fsockopen("127.0.0.1", 9996, $errornumber, $errorstring, 30); if (!$sock) { die("Error {$errornumber}: {$errorstring}"); } fputs($sock, $command); sleep(1); $result = fread($sock, 1000); fclose($sock); if (strpos($result, "Cannot find account")) { create_account(); } else { echo "<B><font color=red>That account name is taken, please try again.</font></B><BR>"; display_form(); } }
* success or error page if the form has been submitted. */ require_once 'panel-config.php'; require_once 'lib/utility.php'; // Render the account form if all required fields were not filled out if (!was_submitted('create_account') || !isset($_POST['netid']) || !isset($_POST['password']) || !isset($_POST['aup']) || $_POST['aup'] != 'yes') { $errors = array(); // Give error messages if the form was submitted if (was_submitted('create_account')) { if (!isset($_POST['netid']) || trim($_POST['netid']) == '') { $errors[] = "Please enter your NetID."; } if (!isset($_POST['password']) || trim($_POST['password']) == '') { $errors[] = "Please enter your NetID password."; } if (!isset($_POST['aup']) || $_POST['aup'] != 'yes') { $errors[] = "You need to read and accept our Acceptable Use Policy."; } } echo $twig->render('join.html', array('form_fields' => array('netid' => isset($_POST['netid']) ? $_POST['netid'] : '', 'lcc' => isset($_POST['lcc']) ? $_POST['lcc'] : '', 'aup' => isset($_POST['aup']) && $_POST['aup'] == 'yes'), 'error_messages' => $errors, 'show_subfooter' => false)); } else { require_once 'lib/create-account.php'; $result = create_account($_POST['netid'], $_POST['password'], $_POST['lcc']); if ($result['status'] == STATUS_AUTH_ERROR) { // Password or NetID were incorrect, render the creation form again echo $twig->render('join.html', array('form_fields' => array('netid' => $_POST['netid'], 'lcc' => $_POST['lcc'], 'aup' => true), 'error_messages' => array($result['message']), 'show_subfooter' => false)); } else { // Render the account creation result echo $twig->render('account-created.html', array('status' => $result['status'], 'message' => $result['message'], 'info' => isset($result['info']) ? $result['info'] : null, 'show_subfooter' => $result['status'] == STATUS_OK)); } }
} // == Check DB connections first! == // $connect = get_database_connections(false); $DB = $connect['plexis']; $Realm = $connect['realm']; // == Include emulator file == // include ROOT . DS . 'emulators' . DS . $_POST['emulator'] . '.php'; // Fetch posted account name $account = fetch_account($_POST['account']); if ($account != FALSE) { $array = array('id' => $account['id'], 'username' => $account['username'], 'email' => $account['email'], 'registration_ip' => $_SERVER['REMOTE_ADDR'], 'activated' => 1, 'group_id' => 4); $mode = 1; $success = $DB->insert('pcms_accounts', $array, true) != false ? true : false; } else { // No such account, creating one, in this case pwd is needed, so checking whether it's provided... $result = create_account($_POST['account'], $_POST['pass']); if ($result != FALSE) { // Get the account ID $accountid = $Realm->last_insert_id(); // Connect to the Plexis DB $ac = array('id' => $accountid, 'username' => $_POST['account'], 'activated' => 1, 'registration_ip' => $_SERVER['REMOTE_ADDR'], 'group_id' => 4); $success = $DB->insert('pcms_accounts', $ac, true) != false ? true : false; $mode = 2; } else { $success = false; $mode = 0; } } // Lock the installer on success if ($success == true || $mode > 0) { $file = fopen("install.lock", "w+");
function register_post(&$a) { $max_dailies = intval(get_config('system', 'max_daily_registrations')); if ($max_dailies) { $r = q("select count(account_id) as total from account where account_created > UTC_TIMESTAMP() - INTERVAL 1 day"); if ($r && $r[0]['total'] >= $max_dailies) { notice(t('Maximum daily site registrations exceeded. Please try again tomorrow.') . EOL); return; } } if (!x($_POST, 'tos')) { notice(t('Please indicate acceptance of the Terms of Service. Registration failed.') . EOL); return; } $policy = get_config('system', 'register_policy'); $email_verify = get_config('system', 'verify_email'); switch ($policy) { case REGISTER_OPEN: $flags = ACCOUNT_OK; break; case REGISTER_APPROVE: $flags = ACCOUNT_BLOCKED | ACCOUNT_PENDING; break; default: case REGISTER_CLOSED: if (!is_site_admin()) { notice(t('Permission denied.') . EOL); return; } $flags = ACCOUNT_BLOCKED; break; } if ($email_verify && $policy == REGISTER_OPEN) { $flags = $flags | ACCOUNT_UNVERIFIED; } if (!$_POST['password'] || $_POST['password'] !== $_POST['password2']) { notice(t('Passwords do not match.') . EOL); return; } $arr = $_POST; $arr['account_flags'] = $flags; $result = create_account($arr); if (!$result['success']) { notice($result['message']); return; } require_once 'include/security.php'; $using_invites = intval(get_config('system', 'invitation_only')); $num_invites = intval(get_config('system', 'number_invites')); $invite_code = x($_POST, 'invite_code') ? notags(trim($_POST['invite_code'])) : ''; if ($using_invites && $invite_code) { q("delete * from register where hash = '%s' limit 1", dbesc($invite_code)); set_pconfig($result['account']['account_id'], 'system', 'invites_remaining', $num_invites); } if ($policy == REGISTER_OPEN) { if ($email_verify) { $res = verify_email_address($result); } else { $res = send_verification_email($result['email'], $result['password']); } if ($res) { info(t('Registration successful. Please check your email for validation instructions.') . EOL); } } elseif ($policy == REGISTER_APPROVE) { $res = send_reg_approval_email($result); if ($res) { info(t('Your registration is pending approval by the site owner.') . EOL); } else { notice(t('Your registration can not be processed.') . EOL); } goaway(z_root()); } if ($email_verify) { goaway(z_root()); } authenticate_success($result['account'], true, false, true); if (!strlen($next_page = get_config('system', 'workflow_register_next'))) { $next_page = 'new_channel'; } $_SESSION['workflow'] = true; goaway(z_root() . '/' . $next_page); }
function createCustomerAccount() { global $currencies, $customer_id, $onepage, $customer_default_address_id, $customer_first_name, $customer_country_id, $customer_zone_id, $languages_id, $sendto, $billto, $user, $auth, $cart, $customer_id, $_SERVER, $messageStack; $this->checkCartValidity(); if ($onepage['createAccount'] === true && $this->checkEmailAddress($onepage['customer']['email_address'])) { require_once 'includes/functions/account.php'; $data = array('firstname' => $onepage['billing']['firstname'], 'lastname' => $onepage['billing']['lastname'], 'email_address' => $onepage['customer']['email_address'], 'telephone' => $onepage['customer']['telephone'], 'fax' => $onepage['customer']['fax'], 'password' => $onepage['customer']['password'], 'confirmation' => $onepage['customer']['password'], 'street_address' => $onepage['billing']['street_address'], 'postcode' => $onepage['billing']['postcode'], 'city' => $onepage['billing']['city'], 'country' => $onepage['billing']['country_id'], 'forum_username' => '', 'TermsAgree' => '1'); if (ACCOUNT_GENDER == 'true') { $data['gender'] = $onepage['billing']['gender']; } if (ACCOUNT_DOB == 'true') { $data['dob'] = tep_date_raw($onepage['customer']['dob']); } if (ACCOUNT_COMPANY == 'true') { $data['company'] = $onepage['billing']['company']; } if (ACCOUNT_COMPANY == 'true') { $data['btwnr'] = $onepage['billing']['btwnr']; } if (ACCOUNT_SUBURB == 'true') { $data['entry_suburb'] = $onepage['billing']['suburb']; } if (ACCOUNT_STATE == 'true') { $state = $onepage['billing']['state']; $zone_name = ''; $zone_id = 0; $check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . (int) $onepage['billing']['country_id'] . "'"); $check = tep_db_fetch_array($check_query); $entry_state_has_zones = $check['total'] > 0; if ($entry_state_has_zones == true) { $zone_query = tep_db_query("select distinct zone_id, zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int) $onepage['billing']['country_id'] . "' and (zone_name = '" . tep_db_input($state) . "' or zone_code = '" . tep_db_input($state) . "')"); if (tep_db_num_rows($zone_query) == 1) { $zone = tep_db_fetch_array($zone_query); $zone_id = $zone['zone_id']; $zone_name = $zone['zone_name']; } } if ($zone_id > 0) { $data['zone_id'] = $zone_id; $data['state'] = ''; } else { $data['zone_id'] = '0'; $data['state'] = $state; } } if (count($onepage['customer']['newsletters']) > 0) { foreach ($onepage['customer']['newsletters'] as $newsletter) { $data['newsletters_' . $newsletter] = '1'; } } create_account($data); if (isset($_POST['diffShipping'])) { $sql_data_array = array('customers_id' => $customer_id, 'entry_firstname' => $onepage['delivery']['firstname'], 'entry_lastname' => $onepage['delivery']['lastname'], 'entry_street_address' => $onepage['delivery']['street_address'], 'entry_postcode' => $onepage['delivery']['postcode'], 'entry_city' => $onepage['delivery']['city'], 'entry_country_id' => $onepage['delivery']['country_id']); if (ACCOUNT_GENDER == 'true') { $sql_data_array['entry_gender'] = $onepage['delivery']['gender']; } if (ACCOUNT_COMPANY == 'true') { $sql_data_array['entry_company'] = $onepage['delivery']['company']; } if (ACCOUNT_SUBURB == 'true') { $sql_data_array['entry_suburb'] = $onepage['delivery']['suburb']; } if (ACCOUNT_STATE == 'true') { $state = $onepage['delivery']['state']; $zone_name = ''; $zone_id = 0; $check_query = tep_db_query("select count(*) as total from " . TABLE_ZONES . " where zone_country_id = '" . (int) $onepage['delivery']['country_id'] . "'"); $check = tep_db_fetch_array($check_query); $entry_state_has_zones = $check['total'] > 0; if ($entry_state_has_zones == true) { $zone_query = tep_db_query("select distinct zone_id, zone_name from " . TABLE_ZONES . " where zone_country_id = '" . (int) $onepage['delivery']['country_id'] . "' and (zone_name = '" . tep_db_input($state) . "' or zone_code = '" . tep_db_input($state) . "')"); if (tep_db_num_rows($zone_query) == 1) { $zone = tep_db_fetch_array($zone_query); $zone_id = $zone['zone_id']; $zone_name = $zone['zone_name']; } } if ($zone_id > 0) { $sql_data_array['entry_zone_id'] = $zone_id; $sql_data_array['entry_state'] = ''; } else { $sql_data_array['entry_zone_id'] = '0'; $sql_data_array['entry_state'] = $state; } } tep_db_perform(TABLE_ADDRESS_BOOK, $sql_data_array); } if (isset($onepage['info']['order_id'])) { tep_db_query('update ' . TABLE_ORDERS . ' set customers_id = "' . $customer_id . '" where orders_id = "' . $onepage['info']['order_id'] . '"'); unset($onepage['info']['order_id']); } if (!tep_session_is_registered('customer_id')) { tep_session_register('customer_id'); } if (!tep_session_is_registered('sendto')) { tep_session_register('sendto'); } if (!tep_session_is_registered('billto')) { tep_session_register('billto'); } } else { $onepage['createAccount'] = false; //tep_redirect(tep_href_link(FILENAME_CHECKOUT,'error='.url_encode('Your email address already exists in our records'))); } }
<?php $title = 'Create new account'; require 'inc_header.php'; ?> <?php $attempted_account_creation = false; if ($_SERVER['REQUEST_METHOD'] === 'POST') { $attempted_account_creation = true; $account_creation_error = create_account(); } ?> <?php if ($attempted_account_creation) { ?> <div class="span8 offset2"> <?php if (isset($account_creation_error)) { ?> <h2>Account creation error</h2> <p><?php echo $account_creation_error; ?> </p> <p><a href="<?php echo BASE_URL; ?> create-account.php">Return to account creation page</a></p>
function create_account_and_ninja($send_name, $params = array()) { $send_email = $params['send_email']; $send_pass = $params['send_pass']; $class_identity = $params['send_class']; $confirm = (int) $params['confirm']; $error = false; $data['ip'] = isset($params['ip']) ? $params['ip'] : null; $ninja_id = create_ninja($send_name, $params); $account_id = create_account($ninja_id, $send_email, $send_pass, $confirm, $type = 0, $active = 1, $data); if ($account_id) { $sent = send_signup_email($account_id, $send_email, $send_name, $confirm, $class_identity); if (!$sent && !DEBUG) { $error = 'There was a problem sending your signup to that email address.'; } } return $error; }
function start_order_transaction($mid, $amount) { // Ensure 'order' account if (get_balance("ORD", $mid, null) == 'NO_ACCOUNT') { if (!create_account("ORD", $mid, null, $mid, ip2long(getRealIpAddr()), null, null, '')) { return FALSE; } } $date = time(); $temp = mt_rand() + 1; $res = create_temp_transaction($temp, array(k_transaction_party("ORD", $mid, 1, $amount, $temp, $date, null), k_transaction_party("USR", $mid, 1, -$amount, $temp, $date, null)), ip2long(getRealIpAddr()), $date, ''); if ($res < 1) { return FALSE; } $res = lock_transaction($temp); return $res == "2" ? $temp : FALSE; }
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>REST/OAuth Example</title> </head> <body> <tt> <?php $access_token = $_SESSION['access_token']; $instance_url = $_SESSION['instance_url']; if (!isset($access_token) || $access_token == "") { die("Error - access token missing from session!"); } if (!isset($instance_url) || $instance_url == "") { die("Error - instance URL missing from session!"); } show_accounts($instance_url, $access_token); $id = create_account("My New Org", $instance_url, $access_token); show_account($id, $instance_url, $access_token); show_accounts($instance_url, $access_token); update_account($id, "My New Org, Inc", "San Francisco", $instance_url, $access_token); show_account($id, $instance_url, $access_token); show_accounts($instance_url, $access_token); delete_account($id, $instance_url, $access_token); show_accounts($instance_url, $access_token); ?> </tt> </body> </html>
function signup($dirty_email) { create_account($dirty_email); }
login($email, $password); return true; } } function is_password_match($password, $repeat) { return strcmp($password, $repeat) == 0 ? true : false; } if (isset($_POST['create_account'])) { $name = $_POST['name']; $email = $_POST['email']; $password = $_POST['password']; $repeat_password = $_POST['repeat_password']; $is_valid_password = is_password_match($password, $repeat_password); if ($is_valid_password) { $result = create_account($email, $password, $name); if ($result) { $success = "New account created successfully! Welcome" . $name; } else { $error = "A user with that email already exists. Have you forgotten your password?"; } } else { $error = "Please check that your passwords match!"; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8">
*/ include "lib/LibMooege.php"; $email = ''; $password = ''; // See if request contains email & password. if (array_key_exists('email', $_REQUEST)) { $email = $_REQUEST['email']; } if (array_key_exists('password', $_REQUEST)) { $password = $_REQUEST['password']; } if (empty($email) || empty($password)) { // if email or password is empty. print_account_form(); } else { create_account($email, $password); } // try loging using given credentals. function create_account($email, $password) { $mooege = new LibMooege("http://localhost", 9000); // change this line to match your configuration. if (!$mooege->connected) { // check if we have a succesfull connection there. die("Can not connect to mooege!"); } $exists = $mooege->AccountExists($email); if ($exists) { die("An account already exists for email address: {$email}!"); } $created = $mooege->CreateAccount($email, $password);
function post() { $max_dailies = intval(get_config('system', 'max_daily_registrations')); if ($max_dailies) { $r = q("select count(account_id) as total from account where account_created > %s - INTERVAL %s", db_utcnow(), db_quoteinterval('1 day')); if ($r && $r[0]['total'] >= $max_dailies) { notice(t('Maximum daily site registrations exceeded. Please try again tomorrow.') . EOL); return; } } if (!x($_POST, 'tos')) { notice(t('Please indicate acceptance of the Terms of Service. Registration failed.') . EOL); return; } $policy = get_config('system', 'register_policy'); $email_verify = get_config('system', 'verify_email'); switch ($policy) { case REGISTER_OPEN: $flags = ACCOUNT_OK; break; case REGISTER_APPROVE: $flags = ACCOUNT_BLOCKED | ACCOUNT_PENDING; break; default: case REGISTER_CLOSED: if (!is_site_admin()) { notice(t('Permission denied.') . EOL); return; } $flags = ACCOUNT_BLOCKED; break; } if ($email_verify && $policy == REGISTER_OPEN) { $flags = $flags | ACCOUNT_UNVERIFIED; } if (!$_POST['password'] || $_POST['password'] !== $_POST['password2']) { notice(t('Passwords do not match.') . EOL); return; } $arr = $_POST; $arr['account_flags'] = $flags; $result = create_account($arr); if (!$result['success']) { notice($result['message']); return; } require_once 'include/security.php'; if ($_REQUEST['name']) { set_aconfig($result['account']['account_id'], 'register', 'channel_name', $_REQUEST['name']); } if ($_REQUEST['nickname']) { set_aconfig($result['account']['account_id'], 'register', 'channel_address', $_REQUEST['nickname']); } if ($_REQUEST['permissions_role']) { set_aconfig($result['account']['account_id'], 'register', 'permissions_role', $_REQUEST['permissions_role']); } $using_invites = intval(get_config('system', 'invitation_only')); $num_invites = intval(get_config('system', 'number_invites')); $invite_code = x($_POST, 'invite_code') ? notags(trim($_POST['invite_code'])) : ''; if ($using_invites && $invite_code) { q("delete * from register where hash = '%s'", dbesc($invite_code)); // @FIXME - this also needs to be considered when using 'invites_remaining' in mod/invite.php set_aconfig($result['account']['account_id'], 'system', 'invites_remaining', $num_invites); } if ($policy == REGISTER_OPEN) { if ($email_verify) { $res = verify_email_address($result); } else { $res = send_register_success_email($result['email'], $result['password']); } if ($res) { info(t('Registration successful. Please check your email for validation instructions.') . EOL); } } elseif ($policy == REGISTER_APPROVE) { $res = send_reg_approval_email($result); if ($res) { info(t('Your registration is pending approval by the site owner.') . EOL); } else { notice(t('Your registration can not be processed.') . EOL); } goaway(z_root()); } if ($email_verify) { goaway(z_root()); } authenticate_success($result['account'], null, true, false, true); $new_channel = false; $next_page = 'new_channel'; if (get_config('system', 'auto_channel_create') || UNO) { $new_channel = auto_channel_create($result['account']['account_id']); if ($new_channel['success']) { $channel_id = $new_channel['channel']['channel_id']; change_channel($channel_id); $next_page = '~'; } else { $new_channel = false; } } $x = get_config('system', 'workflow_register_next'); if ($x) { $next_page = $x; $_SESSION['workflow'] = true; } goaway(z_root() . '/' . $next_page); }
$_POST = ""; } // $_SESSION['panier'] = ""; if (in_array($_POST['nom'], $_SESSION['panier'], TRUE)) { $_SESSION['message_panier'] = "Déja dans ton panier tricheur !"; } else { array_push($_SESSION['panier'], $_POST['nom']); } $_SESSION['message'] = ""; if ($_POST['aff'] != 0) { $_SESSION['aff'] = $_POST['aff']; } else { $_SESSION['aff'] = 0; } $_SESSION['message'] = $_SESSION['aff']; if (create_account($_POST['login_reg'], $_POST['passwd_reg'], $_POST['submit_reg']) === TRUE) { $_POST['inscription'] = ""; $_POST['login_reg'] = ""; $_POST['passwd_reg'] = ""; $_POST['submit_reg'] = ""; $_SESSION['message'] = "Votre compte a été crée avec succès !"; } if ($_POST['delete'] === 'Supprimer mon compte' && $_SESSION['login'] != "") { del_account($_SESSION['login']); $_POST['delete'] = ""; $_POST['submit'] = 'Déconnexion'; } if ($_POST['submit'] === 'Déconnexion') { $_SESSION['login'] = ""; $_SESSION['admin'] = ""; $_POST['login'] = "";
<?php require_once "config.php"; require_once "lib/k_money.php"; $MC_Money = new Memcache(); $MC_Money->connect(MC_MONEY_HOST, MC_MONEY_PORT); if (create_account("DEP", 1, DEP_TYPE_CREATE_SECRET, 1, 0x7f000001, k_code(DEP_ACCESS_SECRET), k_code(DEP_WITHDRAW_SECRET), '1-deposit')) { echo "DEP account created\n"; } else { echo "Error creating DEP account\n"; } if (create_account("MAS", 1, null, 1, 0x7f000001, null, null, '')) { echo "MAS account created\n"; } else { echo "Error creating MAS account\n"; }
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; }
$email = $_REQUEST['email']; } if (array_key_exists('password', $_REQUEST)) { $password = $_REQUEST['password']; } if (array_key_exists('battleTag', $_REQUEST)) { $battleTag = $_REQUEST['battleTag']; } if (empty($email) || empty($password)) { // if email or password is empty. print_account_form(); } else { if (empty($battleTag)) { print_account_form(); } else { create_account($email, $password, $battleTag); } } // try loging using given credentals. function create_account($email, $password, $battleTag) { $mooege = new LibMooege("http://localhost", 9000); // change this line to match your configuration. if (!$mooege->connected) { // check if we have a succesfull connection there. die("Can not connect to mooege!"); } $exists = $mooege->AccountExists($email); if ($exists) { die("An account already exists for email address: {$email}!"); }
// Appel de la fonction associée à la demande switch ($ccar_to_treat) { case "go_home": about_ppr(); break; case "display_nouvelingenieur": about_nouvelingenieur(); break; case "login": log_in(); break; case "logout": log_out(); break; case "create_account": create_account(); break; case "confirm_subscribe": validate_account(); break; case "change_pass": change_password(false); break; case "lost_ids": change_password(true); break; case "delete_account": if (isset($_SESSION["delete_account_state"]) && $_SESSION["delete_account_state"] == "display") { $_SESSION["delete_account_state"] = "execute"; // Une fois réaffiché, on repasse en mode "exécution" if (isset($_SESSION["delete_account_display"])) {
} } // IF NO ERROR if (count($error) <= 0) { // CHECK WHETHER THE SAME EMAIL EXISTS $connected = already_email($email, $link); if ($connected != 0) { if ($connected['is_activated'] == 0) { array_push($error, 'The email is waiting to be activated.'); } else { array_push($error, 'The email is already subscribing.'); } $_SESSION['error'] = $error; header('Location:/php/mailinglist/pages/index.php'); //header('Location:/pages/'); } else { $created = create_account($email, $link); // send confirmation mail send_confirm_mail($email, $link); array_push($notification, "An email has been sent to confirm your subscription."); $_SESSION['notification'] = $notification; header('Location:/php/mailinglist/pages/index.php'); //header('Location:/pages/'); } } else { $_SESSION['email'] = $_POST['email']; $_SESSION['error'] = $error; header('Location:/php/mailinglist/pages/index.php'); //header('Location:/pages/'); } }