Esempio n. 1
0
function add_user($fname, $lname, $gender, $dob, $emailAddress, $pwd)
{
    $uid = generateUID();
    $query = "INSERT INTO users (firstName,lastName,gender,dateOfBirth,emailAddress,password) VALUES (";
    $query .= "";
    $query .= ")";
    $result = mysqli_query($connection, $query);
    if (!$result) {
        die("Database query failed. " . mysqli_error($connection));
    }
}
     $rolle->new = true;
     if (!$rolle->save_rolle()) {
         $error = true;
         $errormsg = $rolle->errormsg;
     } else {
         $error = false;
     }
 }
 if (!$error) {
     //Matrikelnummer und UID generieren
     $matrikelnr = generateMatrikelnummer($studiengang_kz, $studiensemester_kurzbz);
     $jahr = mb_substr($matrikelnr, 0, 2);
     $stg = mb_substr($matrikelnr, 3, 4);
     $stg_obj = new studiengang();
     $stg_obj->load(ltrim($stg, '0'));
     $uid = generateUID($stg_obj->kurzbz, $jahr, $stg_obj->typ, $matrikelnr);
     //Benutzerdatensatz anlegen
     $benutzer = new benutzer();
     $benutzer->uid = $uid;
     $benutzer->person_id = $inc->person_id;
     $benutzer->aktiv = true;
     $benutzer->aktivierungscode = generateActivationKey();
     $nachname_clean = mb_strtolower(convertProblemChars($person->nachname));
     $vorname_clean = mb_strtolower(convertProblemChars($person->vorname));
     $nachname_clean = str_replace(' ', '_', $nachname_clean);
     $vorname_clean = str_replace(' ', '_', $vorname_clean);
     if (!defined('GENERATE_ALIAS_STUDENT') || GENERATE_ALIAS_STUDENT === true) {
         $qry_alias = "SELECT * FROM public.tbl_benutzer WHERE alias=LOWER(" . $db->db_add_param($vorname_clean . "." . $nachname_clean) . ")";
         $result_alias = $db->db_query($qry_alias);
         if ($db->db_num_rows($result_alias) == 0) {
             $benutzer->alias = $vorname_clean . '.' . $nachname_clean;
Esempio n. 3
0
<?php

include '../inc/globals.inc';
$us = $_POST['users'];
$out = array();
while ($item = current($us)) {
    $it = array('id' => generateUID(), 'username' => key($us), 'password' => ccrypt($item));
    array_push($out, $it);
    //echo key($us).'-'.$item;
    next($us);
}
if (!is_dir(CONFIG_PATH)) {
    mkdir(CONFIG_PATH, 0755);
}
if (is_file(CONFIG_FILE)) {
    unlink(CONFIG_FILE);
}
if (file_put_contents(CONFIG_FILE, json_encode($out))) {
    if (!is_dir(FILES_PATH)) {
        mkdir(FILES_PATH, 0755);
        recurse_copy('starter-site/', FILES_PATH);
    }
    echo 1;
} else {
    echo 0;
}
function generateUID()
{
    return '_' . uniqid();
}
function recurse_copy($src, $dst)