Esempio n. 1
0
function handle_form_submission()
{
    $messages = array();
    if (!password_confirmation_matches()) {
        $messages[] = 'Passwords does not match.';
    } else {
        $messages = create_new_user();
    }
    return $messages;
}
function process_rows_import_user_rural()
{
    msg('process_rows_import_user_rural');
    $result = db_query("SELECT * from import_user_rural");
    $i = 0;
    while ($row = db_fetch_object($result)) {
        /////////////////////////////////////////////////
        $i++;
        //if ($i % 10 == 0) {
        msg("Processing row {$i} rid " . $row->record_id);
        //}
        /////////////////////////////////////////////////
        //        show_phone_nums($row);
        //        show_phone_nums_valid($row);
        /////////////////////////////////////////////////
        $user = create_new_user($row);
        if ($user) {
            enroll_new_user($user, $row);
        }
        /////////////////////////////////////////////////
    }
    msg("Processed {$i} rows");
}
function create_new_user_failure()
{
    global $connection;
    session_unset();
    $_SESSION['firstname'] = "createnewusertest";
    $_SESSION['lastname'] = "createnewusertest";
    $_SESSION['email'] = "createnewusertestemail";
    $_SESSION['role'] = "non-numeric-input";
    $_SESSION['password'] = '******';
    $_POST['address'] = "address";
    $_POST['city'] = "city";
    $_POST['county'] = "county";
    $_POST['postcode'] = "postcode";
    $_POST['county'] = "county";
    $_POST['phonenumber'] = "non-numeric-input";
    assert(!create_new_user());
}
Esempio n. 4
0
$configname = $user . "/config.txt";
if (!is_array(stat($configname))) {
    die("\nCouldn't find users config in {$configname}\n");
}
$vcardfh = fopen($vcardname, "r");
$vcard = fread($vcardfh, filesize($vcardname));
fclose($vcardfh);
$configfh = fopen($configname, "r");
$config = fread($configfh, filesize($configname));
fclose($configfh);
include "ctdlsession.php";
include "ctdlprotocol.php";
include "ctdlelements.php";
//define(CITADEL_DEBUG_HTML, FALSE);
establish_citadel_session();
create_new_user($user, $password);
ctdl_goto("My Citadel Config");
list($num_msgs, $response, $msgs) = ctdl_msgs("", "");
$Webcit_Preferences = array();
$Webcit_PrefMsgid = 0;
if ($num_msgs > 0) {
    foreach ($msgs as $msgnum) {
        print_r($msgnum);
        // Fetch the message from the server
        list($ok, $response, $fields) = ctdl_fetch_message($msgnum);
        // Bail out gracefully if the message isn't there.
        if (!$ok) {
            echo "Error: " . $response . "\n";
            return false;
        }
        if (isset($fields['part'])) {
Esempio n. 5
0
                    $lastname = $user_profile->lastName;
                    $provider_user_id = $user_profile->identifier;
                    //create_new_hybridauth_user($link, $email, $firstname, $lastname, $provider, $provider_user_id);
                    $form_register = formRegister($provider, $nickname, $firstname, $lastname, $email, $provider_user_id);
                }
            } else {
                $form_login = formLogin();
            }
        }
        break;
    case "register":
        $form_register = formRegister($provider, $nickname, $firstname, $lastname, $email, $provider_user_id);
        break;
    case "save-register":
        $link = linkDatabase() or die("Connection error!");
        $ok = create_new_user($link, $nickname, $firstname, $lastname, $email, $password);
        if (!$ok) {
            $form_register = formRegister($provider, $nickname, $firstname, $lastname, $email, $provider_user_id);
        } else {
            header("Location: http://www.threescript.com");
        }
        break;
    default:
        $form_login = formLogin();
        break;
}
function linkDatabase_()
{
    $link = mysql_connect("localhost", "user_name", "user_password");
    mysql_select_db('db_name', $link);
    return $link;
Esempio n. 6
0
require_once '../includes/session.php';
require_once '../includes/navigation.php';
require_once '../includes/validation_functions.php';
require_once '../includes/form_processing.php';
require_once "../includes/output.php";
//  Process form from signup.php:
if (isset($_POST['submit'])) {
    //Processes form content and redirects with error feedback if needed
    process_first_form();
    //  Process form from address.php
} elseif (isset($_POST['second_submit']) && isset($_SESSION['user_details'])) {
    process_second_form();
    //  Double check for success of previous form submission before prcoeeding
    //  to send data to the database
    if (isset($_SESSION['user_details']) && isset($_SESSION['address_details'])) {
        if (create_new_user()) {
            //must attempt login in order to get the userId generated from the
            //database logic
            $user = attempt_login($_SESSION['email'], $_SESSION['password']);
            if ($user) {
                //login successful
                //restart the session
                clear_session();
                //$_SESSION['logged_in'] = 1;
                $_SESSION['role'] = $user['role'];
                $_SESSION['userId'] = $user['userId'];
                $_SESSION['email'] = $user['email'];
                $_SESSION['firstName'] = $user['firstName'];
                $_SESSION['lastName'] = $user['lastName'];
                //add address details
                $_SESSION['street'] = $user['street'];
Esempio n. 7
0
    $email = new Email();
    $email->setData(array('email' => $login, 'name' => $name), "Регистрация на сайте написания рефератов", $txt, array(), true, array(), array('email' => Filials::getEmail($add_to_filial), 'name' => Filials::getName($add_to_filial)));
    if (!$email->send()) {
        die;
    }
    return true;
}
$error = "";
$show_reg_form = true;
if (isset($_REQUEST["loginform"]) && is_array($_REQUEST["loginform"])) {
    // add user
    $login = $_REQUEST["loginform"]["login"];
    $client = Client::findOneBy(array('email' => $login));
    if (!$client) {
        // create user
        if (create_new_user($login, $error)) {
            $show_reg_form = false;
        }
    }
}
if ($show_reg_form) {
    $user_pwd_block_displ = "none";
    $user_reg_block_displ = "none";
    if (isset($_REQUEST["loginform"]) && isset($client) && empty($client)) {
        $user_reg_block_displ = "block";
        $user_pwd_block_displ = "none";
    }
}
?>

<?php 
Esempio n. 8
0
            // assign a seat, get from ajax
            /*
            $json_obj = $_POST['postData'];
            $sid = $json_obj['seatId'];
            error_log('I obtain sid as' + $sid);
            
            //$sid = json_decode($_POST['seatId']);
            error_log(print_r($_POST, true));
            
            echo json_encode(
                array("status" => $sid)
            );
            */
            $sid = $_GET['seatId'];
            error_log('sid  is -->' . $sid);
            create_new_user($provider_name, $user_profile->identifier, $user_profile->displayName, $user_profile->profileURL, $user_profile->photoURL, $sid);
            header("Location: index.php");
        }
        // logout
        echo "Logging out..";
        $adapter->logout();
    }
} catch (Exception $e) {
    // In case we have errors 6 or 7, then we have to use Hybrid_Provider_Adapter::logout() to
    // let hybridauth forget all about the user so we can try to authenticate again.
    // Display the recived error,
    // to know more please refer to Exceptions handling section on the userguide
    switch ($e->getCode()) {
        case 0:
            echo "Unspecified error.";
            break;
Esempio n. 9
0
function auth_routine($mode, $uniqid, $ident) {
  if(($uid = user_exists($mode, $uniqid)) === FALSE) {
    $uid = create_new_user($mode, $uniqid);
  }

  $hash = gen_hash();

  prune_hashes($uid);
  update_ident($uid, $ident);
  store_hash($uid, $hash);

  setcookie("user", $hash, time()+86400*365*5, '/');
  goToApp();
}
Esempio n. 10
0
     $error .= "Email Invalid <br />";
 }
 if ($_POST['password'] != $_POST['password_confirmation']) {
     $error .= "Passwords not matching <br />";
 }
 if (strlen($_POST['password']) < 8 || strlen($_POST['password']) > 32) {
     $error .= "Password length should be between 8 and 32 <br />";
 }
 if (!($_POST['terms'] == "on")) {
     $error .= "Terms and Conditions not accepted <br />";
 }
 if ($error != "") {
     $error .= "Thats why, you should have enabled javascript. I was checking there";
 } else {
     // Okay, now all the paramters are checked on the back end. Now, we can continue.
     $res = create_new_user($_POST['login'], $_POST['email'], $_POST['password']);
     if ($res) {
         set_info_message("Succesfully registered your account. Please login");
         header("Location: ./login.php");
     } else {
         if ($res == -1) {
             $error = "Login id already taken";
         } else {
             if ($res == -2) {
                 $error = "An account has already been registered with the given email id";
             } else {
                 if ($res == -3) {
                     $error = "Login already taken and email is already used register";
                 }
             }
         }
Esempio n. 11
0
<?php

// $Id$
//
// The login form displayed in login.php submits to this page.
//
// Copyright (c) 2003 by Art Cancro <*****@*****.**>
// This program is released under the terms of the GNU General Public License.
include "ctdlheader.php";
bbs_page_header();
if ($_REQUEST["action"] == "Login") {
    list($retval, $msg) = login_existing_user($_REQUEST["user"], $_REQUEST["pass"]);
} else {
    if ($_REQUEST["action"] == "New User") {
        list($retval, $msg) = create_new_user($_REQUEST["user"], $_REQUEST["pass"]);
    } else {
        echo "uuuuhhhhhhhhh....<BR>\n";
    }
}
if ($retval == FALSE) {
    echo "<DIV ALIGN=CENTER>", $msg, "<BR><BR>\n";
    echo "<a href=\"login.php\">Try again</A><BR>\n";
    echo "<a href=\"logout.php\">Log out</A><BR>\n";
} else {
    echo "<A HREF=\"welcome.php\">Logged in.  ";
    echo "Click to continue if your browser does not refresh.</a><BR>";
    echo "<meta http-equiv=\"refresh\" content=\"15;url=welcome.php\">\n";
}
bbs_page_footer();
?>