Example #1
0
function addTeamMember_submit($form, $form_state)
{
    $UID = dbSearchUserByEmail($form_state['values']['primaryEmail']);
    $teamName = dbGetTeamName($form_state['TID']);
    // if the user doesn't exist yet
    if ($UID == false) {
        // programmatically creates a Drupal user and sends an email to set-up account
        $UID = createNewUser($form_state);
    } else {
        $params['fullName'] = dbGetUserName($UID);
        $params['teamName'] = $teamName;
        drupal_mail('teams', 'approvedForTeam', $form_state['values']['primaryEmail'], NULL, $params, '*****@*****.**');
    }
    $notification = array('UID' => $UID, 'TID' => $form_state['TID'], 'dateCreated' => dbDatePHP2SQL(time()), 'dateTargeted' => dbDatePHP2SQL(time()));
    $notification['message'] = 'You have just been added to ' . $teamName . '!';
    $notification['bttnTitle'] = 'View Team';
    $notification['bttnLink'] = "?q=viewTeam&TID={$form_state['TID']}";
    dbAddNotification($notification);
    dbAssignUserToTeam($UID, $form_state['TID']);
    $userName = dbGetUserName($UID);
    drupal_set_message("{$userName} has been invited to your team!");
}
function validateRegOrEditCredInput($metaData, $con)
{
    foreach ($metaData as $inputData) {
        if (empty($_POST[$inputData['name']]) && $inputData['required'] == true) {
            $error[$inputData['name']] = $inputData['errors']['empty'];
        } else {
            if (!empty($_POST[$inputData['name']]) || empty($_POST[$inputData['name']]) && $inputData['required'] == false) {
                // If the inputdata is not empty OR is empty and not required...
                ${$inputData}['name'] = empty($_POST[$inputData['name']]) && $inputData['required'] == false ? "" : removeUnnecessaryChars($_POST[$inputData['name']]);
                // then create a variable of the input named after itself.
                if (!preg_match($inputData['match'], ${$inputData}['name'])) {
                    $error[$inputData['name']] = $inputData['errors']['match'];
                } else {
                    if (array_key_exists('matchOther', $inputData) && ${$inputData}['name'] != ${$inputData}['matchOther']) {
                        // If the key matchother exists in the $inputData and it doesn't match the inputfield it has to match, generate an error.
                        $error[$inputData['name']] = $inputData['errors']['matchOther'];
                    } else {
                        if (strpos($_SERVER['REQUEST_URI'], 'register.php') && $inputData['unique'] == true && checkIfExists($con, $inputData['name'], ${$inputData}['name']) == true) {
                            // If the your location is the register.php AND your inputData has to be unique AND the check if it exists returns true, generate an error.
                            $error[$inputData['name']] = $inputData['errors']['unique'];
                        }
                    }
                }
            }
        }
    }
    if (empty($error) && defineLocation() == true) {
        $error = [];
        createNewUser($passWord, $firstName, $insertion, $lastName, $emailAdress, $phoneNumber, $con);
        // Create a new user!
    } else {
        if (empty($error)) {
            $error = [];
            editExistingCreds($firstName, $insertion, $lastName, $emailAdress, $phoneNumber, $metaData, $con);
            // Edit the user!
        }
    }
    return $error;
}
Example #3
0
     $url = "https://www.google.com/recaptcha/api/siteverify";
     $fields = array('secret' => '6LcmTSATAAAAAFtJj2F9XlF6wl9gUmIX9Vu-4af7', 'response' => $recaptcha);
     //open connection
     $ch = curl_init($url);
     //set the url, number of POST vars, POST data
     curl_setopt($ch, CURLOPT_URL, $url);
     curl_setopt($ch, CURLOPT_POST, true);
     curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
     curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
     //execute post
     $captchaResponse = curl_exec($ch);
     curl_close($ch);
     $captchaResponse = json_decode($captchaResponse, true);
     $ret = new stdClass();
     if ($captchaResponse['success']) {
         $ret = createNewUser($data['email_id'], $data['password'], $data['first_name'], $data['middle_name'], $data['last_name'], $data['organization_id'], $data['authtype_id'], $data['securityquestion_id'], $data['securityquestion_ans'], $data['phone'], $data['country_name'], $data['country_code']);
         $ret = json_decode($ret);
         $ret->mail = false;
         if ($ret->response) {
             $ret->mail = Util::send_mail($data['email_id'], "Registration Confirmation", "Thank you for registering with the isUD website. Please login to visit the inclusive design solutions.");
         }
     } else {
         $ret->response = false;
         $ret->message = "Recaptcha verification failed.";
     }
     //$ret->m = $captchaResponse['challenge_ts']." ".$captchaResponse['success'];
     print json_encode($ret);
 }
 if ($columns === "LOGIN") {
     $username = $_POST['username'];
     $password = $_POST['password'];
Example #4
0
{
	//$errorMessage = "1";
	//$errorMessage = 'Existing user? . Please go to the login page';
	header('Location:/~mohit/Blog_App/index.php');
}
else if($usernameUsed != 0)
{
	//$errorMessage = "2";
	//$erorMessage = 'Please choose another user id. This userid is already used.';
	redirect('signup.php');
}
else if($thepass !== $confpass)
{
	redirect('signup.php');
}
else 
{
	createNewUser($_POST['newusername'], $_POST['newpassword']);
	$userRegistered = checkUsernameAndPassword($thename, $thepass);
	if($userRegistered == 0)
	{
		//$errorMessage = "3";
		redirect('signup.php');	
	}
	else
	{	
		//$errorMessage = "4";
		redirect('index.php');
	}
}
?>
Example #5
0
 * @Last Modified by:   Alexander
 * @Last Modified time: 2016-02-29 22:35:14
 */
// require_once('logincheck.php');
require_once 'functions.php';
if (isset($_COOKIE['CreateUserMessage'])) {
    setcookie('CreateUserMessage', '', time() - 3600, "/");
}
if (isset($_POST['submit'])) {
    $username = $_POST['username'];
    $password = $_POST['password'];
    $fname = $_POST['fname'];
    $mi = $_POST['mi'];
    $lname = $_POST['lname'];
    // Try creating a user...
    $user = createNewUser($username, $password, $fname, $mi, $lname);
    // Create a message for the newly created user.
    setcookie("CreateUserMessage", $user['message'], time() + 86400 * 30, "/");
    // Reload the page
    header("Location: createuser.php");
    exit;
}
require_once 'header.php';
?>
	
<div class="container">
	<div class="row">
		<div class="col s12">
			<div class="section">

			<!-- Content of the '<body>' Starts Here -->
<?php

if (isPostRequest()) {
    $signupemail = filter_input(INPUT_POST, 'signup_email');
    $signuppassword = filter_input(INPUT_POST, 'signup_pass');
    if (!inDatabase($signupemail, "email", "users")) {
        if (createNewUser($signupemail, $signuppassword)) {
            $results = '<h3>New user created</h3>';
        } else {
            $results = '<h3>Error creating user. Sorry, please try again.<br><br>Ensure email is valid and password includes only letters and numbers.</h3>';
        }
    } else {
        $results = 'User already exists. Sorry, please try again.';
    }
}
?>


<p><a href="?view=default" class="btn btn-primary">Return to Log In</a></p>
<hr>
<h1> Sign Up </h1>

<?php 
include '/includes/signupForm.php';
?>

Example #7
0
            //print_r($_SESSION);
        } else {
            return "Password is incorrect";
        }
    } else {
        return "Your email is not found. Try again or Sign Up";
    }
}
// Sign Up Submission
if ($_POST['submit']) {
    $error .= checkEmail('email');
    $error .= checkPassword('password');
    if ($error) {
        $error = "Errors:" . $error;
    } else {
        $error = createNewUser($link, 'email', 'password');
        // return id of most recently inserted user in DB
        if (!$error) {
            $_SESSION['id'] = mysqli_insert_id($link);
        }
        //print_r($_SESSION);
        // can no redirect, see reason below.
    }
    echo $error;
}
// Log In Submission
if ($_POST['login']) {
    $error .= checkEmail('login-email');
    if ($error) {
        $error = "Errors:" . $error;
    } else {
Example #8
0
function db_init()
{
    global $sqlfile, $db, $multitable, $step, $lockfile;
    if (!isset($_SESSION['dbinfo'])) {
        header("location: index.php?step=2");
    }
    $dbname = $_SESSION['dbinfo']['dbname'];
    $dbinfo = $_SESSION['dbinfo'];
    $adminpwd = $_SESSION['adminpwd'];
    $adminemail = $_SESSION['founderemail'];
    $multitable = $_SESSION['multitable'];
    $config = "<?php \r\ndefine('SSO_MODE', '{$_SESSION['sso_mode']}');\r\n";
    $config .= "define('MULTI_TABLE', '{$_SESSION['multitable']}');\r\n";
    $config .= '$GLOBALS ["gDataBase"] ["db"] = array (
  "dbname" => "' . $dbname . '",
  "type" => "mysql",
  "host" => "' . $dbinfo['dbhost'] . '",
  "port" => 3306,
  "user" => "' . $dbinfo['dbuser'] . '",
  "passwd" => "' . $dbinfo['dbpw'] . '",
  "charset"=> "utf8",
);
?>';
    $fp = fopen(CONFIG, 'w');
    fwrite($fp, $config);
    fclose($fp);
    $db = new dbstuff();
    $db->connect($dbinfo['dbhost'], $dbinfo['dbuser'], $dbinfo['dbpw'], $dbname, 'UTF8');
    $sql = file_get_contents($sqlfile);
    $sql = str_replace("\r\n", "\n", $sql);
    if (!VIEW_OFF) {
        show_install();
    }
    runquery($sql);
    $user['user'] = $adminemail;
    $user['user_email'] = $adminemail;
    $user['user_question'] = '';
    $user['user_answer'] = '';
    $user['user_password'] = md5(md5($adminpwd) . $user['user']);
    $user['user_nickname'] = 'administrator';
    $user['user_sex'] = 1;
    $user['user_reg_ip'] = '127.0.0.1';
    createNewUser($user);
    VIEW_OFF && show_msg('initdbresult_succ');
    $step++;
    if (!VIEW_OFF) {
        echo '<script type="text/javascript">document.getElementById("laststep").disabled=false;document.getElementById("laststep").value = \'' . lang('install_succeed') . '\';</script>' . "\r\n";
    }
}
<?php

$username = $_POST['username'];
$password = $_POST['password'];
$full_name = $_POST['full_name'];
include '../library/actions.php';
$res = createNewUser($username, $password, $full_name);
print $res;
Example #10
0
session_start();
require_once 'constants.php';
ini_set('display_errors', 1);
$primaryInvestigatorName = filter_input(INPUT_POST, "primaryInvestigator_name", FILTER_SANITIZE_STRING);
$primaryInvestigatorEmail = filter_input(INPUT_POST, "primaryInvestigator_email", FILTER_SANITIZE_STRING);
$researchInstitution = filter_input(INPUT_POST, "researchInstitution", FILTER_SANITIZE_STRING);
$secondaryName = filter_input(INPUT_POST, "secondary_name", FILTER_SANITIZE_STRING);
$secondaryEmail = filter_input(INPUT_POST, "secondary_email", FILTER_SANITIZE_STRING);
$userOrig = filter_input(INPUT_POST, "user", FILTER_SANITIZE_STRING);
$pwOrig = filter_input(INPUT_POST, "pwOrig", FILTER_SANITIZE_STRING);
$pwCopy = filter_input(INPUT_POST, "pwCopy", FILTER_SANITIZE_STRING);
$user = validateUser($userOrig);
$pw = validatePassword($pwOrig, $pwCopy);
// User and Password both validated as correct
if ($user && $pw) {
    createNewUser($user, $pw);
    createSecondaryInformationFile($user, $primaryInvestigatorName, $primaryInvestigatorEmail, $researchInstitution, $secondaryName, $secondaryEmail);
}
//=========================================================
// Functions used to generate user account.
//---------------------------------------------------------
function createNewUser($user, $pw)
{
    if (!doesUserDirectoryExist($user)) {
        $FTPdir = "FTP_drop/" . $user;
        mkdir($FTPdir);
        chmod($FTPdir, 0777);
        $dir = "users/" . $user;
        mkdir($dir);
        chmod($dir, 0777);
        mkdir($dir . "/projects/");
Example #11
0
 public function facebookAction()
 {
     $fb = new \Custom\Fb\Facebook(array('appId' => '365454110216217', 'secret' => '3bc33d7394eeb81d6d85f08faa429c5e', 'fileUpload' => false));
     if ($fb->getUser() === 0) {
         //
     } else {
         $user_data = $fb->api('/me', 'GET');
         if (userExist()) {
             login();
         } else {
             createNewUser();
             login();
         }
     }
     print_r($fb->api('/me', 'GET'));
     exit;
     exit;
 }
Example #12
0
    } catch (Exception $e) {
        echo "An error occured:<br>";
        echo $e->getMessage();
    } finally {
        echo "<button id='dismiss'>Dismiss</button>";
        echo "</form>";
        echo "</p>";
    }
}
// Checks if a booking has been deleted through POST
if (isset($_POST['deletebooking'])) {
    deleteBooking($_POST['deletebooking']);
}
// If new user has been entered
if (isset($_POST['newuser'])) {
    createNewUser($_POST['newusername'], $_POST['newuserfullname'], $_POST['newuserpwd']);
}
// If Delete button pressed on one of the users
if (isset($_POST['deleteuser'])) {
    deleteUser($_POST['deleteuser']);
}
// If Make Admin has been pressed
if (isset($_POST['makeadmin'])) {
    makeAdmin($_POST['makeadmin']);
}
// If allow book vehicles has been pressed
if (isset($_POST['bookvehicles'])) {
    makeBookVehicles($_POST['bookvehicles']);
}
// If make SLT has been pressed
if (isset($_POST['bookslt'])) {
$email = $_POST['tfEmail'];
$userID = $_POST['userID'];
$dogName = $_POST['dogName'];
$dogID = $_POST['dogID'];
$todaysDate = $_POST['todaysDate'];
$action = $_POST['action'];
$walkNotes = $_POST['walkNotes'];
switch ($executeThis) {
    case "logOn":
        logOn($user_name, $password);
        break;
    case "checkNewUserName":
        checkNewUserName($user_name);
        break;
    case "createNewUser":
        createNewUser($new_user_name, $firstname, $lastname, $email, $password, $language);
        break;
    case "numberOfDogs":
        numberOfDogs($userID);
        break;
    case "fetchDogNames":
        fetchDogNames($userID);
        break;
    case "fetchDogDetails":
        fetchDogDetails($userID, $dogName);
        break;
    case "numberOfRegistrees":
        numberOfRegistrees($userID, $dogName);
        break;
    case "logWalk":
        logWalk($dogID, $todaysDate, $action, $walkNotes, $userID);
Example #14
0
File: users.php Project: Abilis/SPD
<?php

//скрипт для создания, редактирования и удаления пользователей
require_once '../functions/database.php';
require_once '../functions/functions.php';
require_once '../functions/access.php';
// подключение к БД
$link = startup();
//Определение текущего пользователя
$user = getCurrentUser($link);
//Определяем, может ли пользователь управлять пользователями
$canDoUsersControl = canDo($link, $user, 'USERS_CONTROL');
if (!$canDoUsersControl) {
    header('Location: ../index.php');
    die('123');
}
//Обработка формы
if ($_POST['login'] != null && $_POST['password'] != null) {
    //если вбиты логин и пароль
    if (createNewUser($link, $user, $_POST['login'], $_POST['password'], $_POST['confirmPassword'], $_POST['username'], $_POST['access'])) {
        //если мы здесь, значит, пользователь успешно создался
        header('Location: ../admin.php');
    }
}
//если пустой - то делать тут нечего
header('Location: ../admin.php');
<?php

require_once 'recaptchalib.php';
$fileInfo = array('fileName' => 'includes/createAccountMethods.php');
$debug->newFile($fileInfo['fileName']);
$success = false;
if (MODE == 'createNewUser') {
    createNewUser();
} else {
    $debug->add('No matching mode in ' . $fileInfo['fileName'] . '.');
}
function buildCreateAccount()
{
    /*
    This function builds "create new account" form for new users. If an invitation code is detected it will lock in the email address.
    */
    global $debug, $message, $Dbc, $returnThis;
    $output = '';
    /*
    Build the create form. If an invitation code is present get the associated email from the record and lock in the email field so the user can't change it.
    */
    try {
        if (isset($_REQUEST['invitationCode']) && strlen($_REQUEST['invitationCode']) == 40) {
            $selectInviteQuery = $Dbc->prepare("SELECT\n\temail as 'email'\nFROM\n\tinvitations\nWHERE\n\tinvitationCode = ? AND\n\trespondDate IS NULL");
            $inviteParams = array($_REQUEST['invitationCode']);
            $selectInviteQuery->execute($inviteParams);
            $invited = $selectInviteQuery->fetch(PDO::FETCH_ASSOC);
            if ($invited['email'] === '' || $invited['email'] === NULL) {
                //The invitation code wasn't found.
                $invitedEmail = false;
                pdoError(__LINE__, $selectInviteQuery, $inviteParams, 1);
Example #16
0
<?php

require_once 'common/header.php';
if (!loggedIn()) {
    header('Location: login.php');
}
require_once 'common/sidebar.php';
?>

<?php 
$insertInfo = array('username' => '', 'password' => '', 'email' => '', 'description' => '');
if ($_POST['createUser']) {
    $insertInfo = array('username' => $_POST['username'], 'password' => sha1($_POST['password']), 'email' => $_POST['email'], 'description' => $_POST['description']);
    createNewUser($insertInfo);
}
?>
    <!-- start: Content -->
    <div id="content" class="span10">


        <ul class="breadcrumb">
            <li>
                <i class="icon-home"></i>
                <a href="index.php">Home</a>
                <i class="icon-angle-right"></i>
            </li>
            <li><a href="#">Dashboard</a></li>
        </ul>


        <form action="" method="post">
Example #17
0
 */
// Ganz wichtig, dass die Anweisung gleich zu Anfang in JEDER Datei steht, sonst funktionieren die Sessions nicht !!!
session_start();
$title = "User-Profil";
$stylesheet_file = "css/registerForm.css";
include "templates/checkLevel.php";
include "templates/header.php";
// DB-Verbindung herstellen
require_once 'configuration.php';
// Kein Button betätigt, Aufruf über Menü, Daten zu User holen und anzeigen
if (!isset($_POST['logout']) && !isset($_POST['speichern']) && !isset($_POST['register']) && isset($_SESSION['userid'])) {
    getUserData($dbmysql);
}
// Button registrieren gedrückt, User neu anlegen
if (isset($_POST['register']) && isset($_POST['f_username'])) {
    createNewUser($dbmysql);
}
// Benutzer hat Daten geändert und speichern geklickt, Daten speichern
if (isset($_POST['speichern']) && isset($_SESSION['username'])) {
    saveUserData($dbmysql);
}
include "templates/breadcrumbs.html";
include "templates/navAndLogin.php";
// Verbindung wird in Login, was hier included wird, geschlossen
// -------------------
// HTML-Teil der Seite
// -------------------
?>

	<main>
		<?php 
<?php

$results = "";
if (isPostRequest()) {
    $email = filter_input(INPUT_POST, 'email');
    $password = filter_input(INPUT_POST, 'password');
    if (!existingEmail($email, "email", "users")) {
        if (createNewUser($email, $password)) {
            $results = "User Registered";
        } else {
            $results = "Error, try again";
        }
    } else {
        $results = 'User already exists. Sorry, please try again.';
    }
}
?>



<h3>To register your account, please enter an email and password below</h3>

<br />

<?php 
echo $results;
?>

<div id="register">
    <form method="post" action="#">    
        <input name="email" type="text" value="" placeholder="Email" class="form-control"/>