Exemplo n.º 1
0
function logging()
{
    echo "LOGGING </br>";
    $username = $_GET['username'];
    $password = $_GET['password'];
    echo "{$username} {$password}</br>";
    $check = checkIfExists($username, $password);
    return $check;
}
Exemplo n.º 2
0
function logging()
{
    echo "LOGGING </br>";
    $username = $_GET['username'];
    $password = $_GET['password'];
    echo $username . " " . $password . "</br>";
    $check = checkIfExists($username, $password);
    if ($check) {
        return "DOBRZE";
    } else {
        return "ZLE";
    }
}
Exemplo n.º 3
0
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;
}
Exemplo n.º 4
0
<?php

if (!defined("B_PROLOG_INCLUDED") || B_PROLOG_INCLUDED !== true) {
    die;
}
?>

<?php 
CModule::IncludeModule('iblock');
foreach ($arResult["ITEMS"] as $key => $arItem) {
    if (isset($_POST["WF_BLOG_DETAIL_ID"])) {
        if ($_POST["WF_BLOG_DETAIL_ID"] == $arItem["ID"] or !checkIfExists($arItem["PROPERTIES"]["CATEGORY"]["VALUE_ENUM_ID"], $_POST["WF_BLOG_CATEGORY_ENUM"])) {
            unset($arResult["ITEMS"][$key]);
            continue;
        }
    }
    $arResult["ITEMS"][$key]["SMALL_PIC"] = CFile::ResizeImageGet($arItem['PREVIEW_PICTURE'], array("width" => 55, "height" => 55), BX_RESIZE_IMAGE_EXACT, true, $arFilter);
}
$arResult["ITEMS"] = wfRefreshArray($arResult["ITEMS"]);
function checkIfExists($one, $two)
{
    $isIn = false;
    foreach ($one as $value) {
        if (in_array($value, $two)) {
            $isIn = true;
            break;
        }
    }
    if (!$isIn) {
        foreach ($two as $value) {
            if (in_array($value, $one)) {
Exemplo n.º 5
0
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . '/include/functions.php';
//config
$columnSetting = 'front';
//initialize page variables
$title = str_replace('_', ' ', ucfirst(basename(__FILE__, '.php')));
$header = 'Request Hardware Checkout';
$description_title = 'Item Description';
$id = $_GET['id'];
$type = $_GET['type'];
$status = $_GET['status'];
$model = $_GET['model'];
$notes = $_GET['notes'];
$location = $_GET['location'];
if (checkIfExists($_GET['id'], 'hardware') === 1) {
    $description = "<p>Hardware Id: {$id}</p>\n                    <p>Type: {$type}</p>\n                    <p>Status: {$status}</p>\n                    <p>Model: {$model}</p>\n                    <p>Notes: {$notes}</p>\n                    <p>Location: {$location}</p>";
} else {
    $description = '<h4>Item not found</h4>';
}
require_once $_SERVER['DOCUMENT_ROOT'] . '/include/request_template.php';
Exemplo n.º 6
0
function edit_hardware($id, $type, $model, $status, $description, $location)
{
    $link = open_database_connection();
    $hardware = checkIfExists($id, 'hardware');
    if ($hardware == 0) {
        echo $hardware;
    } else {
        if (!empty($type) && !empty($model) && !empty($status) && !empty($description) && !empty($location)) {
            $sql = "UPDATE hardware SET type = :type, model = :model,status = :status, notes = :description, location = :location WHERE hardware_id = :id";
            $edit = $link->prepare($sql);
            $edit->bindParam(':id', $id);
            $edit->bindParam(':type', $type);
            $edit->bindParam(':model', $model);
            $edit->bindParam(':status', $status);
            $edit->bindParam(':description', $description);
            $edit->bindParam(':location', $location);
            $edit->execute();
        } else {
            if (!empty($type) && !empty($model) && !empty($status) && !empty($description)) {
                $sql = "UPDATE hardware SET type = :type, model = :model,status = :status, notes = :description WHERE hardware_id = :id";
                $edit = $link->prepare($sql);
                $edit->bindParam(':id', $id);
                $edit->bindParam(':type', $type);
                $edit->bindParam(':model', $model);
                $edit->bindParam(':status', $status);
                $edit->bindParam(':description', $description);
                $edit->execute();
            } else {
                if (!empty($type) && !empty($model) && !empty($status)) {
                    $sql = "UPDATE hardware SET type = :type, model = :model,status = :status WHERE hardware_id = :id";
                    $edit = $link->prepare($sql);
                    $edit->bindParam(':id', $id);
                    $edit->bindParam(':type', $type);
                    $edit->bindParam(':model', $model);
                    $edit->bindParam(':status', $status);
                    $edit->execute();
                } else {
                    if (!empty($type) && !empty($model)) {
                        $sql = "UPDATE hardware SET type = :type, model = :model WHERE hardware_id = :id";
                        $edit = $link->prepare($sql);
                        $edit->bindParam(':id', $id);
                        $edit->bindParam(':type', $type);
                        $edit->bindParam(':model', $model);
                        $edit->execute();
                    } else {
                        if (!empty($type)) {
                            $sql = "UPDATE hardware SET type = :type WHERE hardware_id = :id";
                            $edit = $link->prepare($sql);
                            $edit->bindParam(':id', $id);
                            $edit->bindParam(':type', $type);
                            $edit->execute();
                        }
                    }
                }
            }
        }
        echo $hardware;
    }
}
Exemplo n.º 7
0
function registerUser($db)
{
    $username = filterString($_POST['username']);
    $mail = filterEmail($_POST['mail']);
    $cmail = filterEmail($_POST['cmail']);
    $pass = filterPassword($_POST['password']);
    $cpass = filterPassword($_POST['cpassword']);
    $agb = filterString($_POST['cagb']);
    if (!isset($username) || empty($username)) {
        $error['username'] = 1;
        $error['msg']['username'] = '******';
    }
    if (!isset($mail) || empty($mail)) {
        $error['mail'] = 1;
        $error['msg']['mail'] = 'Sie haben keine E-Mail angegeben';
    }
    if (!isset($cmail) || empty($cmail)) {
        $error['cmail'] = 1;
        $error['msg']['cmail'] = 'Bitte bestätigen Sie Ihre E-Mail';
    }
    if ($mail != $cmail) {
        $error['unequal_mail'] = 1;
        $error['msg']['unequal_mail'] = 'Die angegebenen Mails stimmen nicht überein';
    }
    if (!isset($pass) || empty($pass)) {
        $error['pass'] = 1;
        $error['msg']['pass'] = '******';
    }
    if (!isset($cpass) || empty($cpass)) {
        $error['cpass'] = 1;
        $error['msg']['cpass'] = '******';
    }
    if ($pass != $cpass) {
        $error['unequal_pass'] = 1;
        $error['msg']['unequal_pass'] = '******';
    }
    if (!isset($agb) || $agb != 'on') {
        $error['agb'] = 1;
        $error['msg']['agb'] = 'Bitte akzeptieren Sie unsere AGB';
    }
    if (empty($error)) {
        $proofedName = checkIfExists($username, "fr_users", "user_name", $db);
        if ($proofedName) {
            $proofedMail = checkIfExists($mail, "fr_users", "user_mail", $db);
            if ($proofedMail) {
                // User wird angelegt
                // random salt
                $randomSalt = hash('sha512', uniqid(mt_rand(1, mt_getrandmax()), true));
                // Create salted password
                //$hashedPassword = hash('sha512', $password . $randomSalt);
                $hashedPassword = hash('sha512', $pass . $randomSalt);
                // Create randomHash to salt mail for validation-process
                $randomHash = hash('sha512', uniqid(mt_rand(1, mt_getrandmax()), true));
                // Created salted mail for validation-process
                $validationHash = hash('sha512', $mail . $randomHash);
                try {
                    $db->beginTransaction();
                    $stmt = $db->prepare('INSERT INTO fr_users(user_name,' . 'user_mail, ' . 'user_hash, ' . 'user_salt, ' . 'user_validation, ' . 'user_regDate, ' . 'user_lastLogin, ' . 'user_role, ' . 'user_status, ' . 'user_base_lang, ' . 'user_newsletter) ' . 'VALUES (:name, :mail, :hash, :salt, :validation, NOW(), NOW(), :role, :status, :base_lang, :newsletter)');
                    $stmt->execute(array(':name' => $username, ':mail' => $mail, ':hash' => $hashedPassword, ':salt' => $randomSalt, ':validation' => $validationHash, ':role' => 0, ':status' => 'pending', ':base_lang' => 'de', ':newsletter' => 1));
                    $db->commit();
                } catch (PDOException $e) {
                    $e->getMessage();
                    $db->rollBack();
                }
                if (empty($e)) {
                    $mail = sendValidationMail($mail, $validationHash);
                    if ($mail) {
                        header('Location:' . createUrl(array("action" => "register", "do" => "success")));
                    } else {
                        $error['mail_error'] = 1;
                        return $error;
                    }
                } else {
                    $error['db_error'] = 1;
                    return $error;
                }
            } else {
                $error['mail_used'] = 1;
                $error['msg']['mail_used'] = 'Die eingegebe E-Mail wird bereits verwendet';
                return $error;
            }
        } else {
            $error['name_used'] = 1;
            $error['msg']['username_used'] = 'Der eingegeben Nutzername wird bereits verwendet';
            return $error;
        }
    } else {
        return $error;
    }
}
Exemplo n.º 8
0
<?php

$page_security = 'SA_SALESMAN';
$path_to_root = "../..";
include $path_to_root . "/includes/session.inc";
page(_($help_context = "Sales Persons"));
include $path_to_root . "/includes/ui.inc";
simple_page_mode(true);
//------------------------------------------------------------------------------------------------
if ($Mode == 'ADD_ITEM' || $Mode == 'UPDATE_ITEM') {
    //initialise no input errors assumed initially before we test
    $input_error = 0;
    /*========================MOODLEARNING======================*/
    if (checkIfExists($_POST['imc_code'])) {
        $input_error = 1;
        display_error("IMC code already exists. Try a new one.");
        set_focus('imc_code');
    }
    if (strlen($_POST['imc_code']) == 0) {
        $input_error = 1;
        display_error("IMC code cannot be empty");
        set_focus('imc_code');
    }
    /*=========================================================*/
    if (strlen($_POST['salesman_name']) == 0) {
        $input_error = 1;
        display_error(_("The sales person name cannot be empty."));
        set_focus('salesman_name');
    }
    $pr1 = check_num('provision', 0, 100);
    if (!$pr1 || !check_num('provision2', 0, 100)) {