<a href="index.php?c=medewerker&p=list" class="button">Lijstweergave</a>
<a href="index.php?c=medewerker&p=add" class="button">Medewerker aanmaken</a><br />
<?php 
if (!defined('isIncluded') || $_SESSION['GroepID'] != 2 || empty($_GET['id'])) {
    header('location: index.php');
}
$gebruiker = Gebruiker::get($_GET['id']);
if (isset($_POST['submit'])) {
    if (!empty($_POST['iptGebEmail']) && !empty($_POST['iptGebStraat']) && !empty($_POST['iptGebHuisnummer']) && !empty($_POST['iptGebPostcode']) && !empty($_POST['iptGebPersoneelsnummer']) && !Gebruiker::emailAlreadyExists($_POST['iptGebEmail'])) {
        $properties_values = array('Email' => $_POST['iptGebEmail'], 'Voornaam' => $_POST['iptGebVoornaam'], 'Tussenvoegsel' => $_POST['iptGebTussenvoegsel'], 'Achternaam' => $_POST['iptGebAchternaam'], 'Straat' => $_POST['iptGebStraat'], 'Huisnummer' => $_POST['iptGebHuisnummer'], 'HuisnummerToevoeging' => $_POST['iptGebHuisnummerToevoeging'], 'Postcode' => $_POST['iptGebPostcode'], 'Woonplaats' => $_POST['iptGebWoonplaats'], 'Telefoon' => $_POST['iptGebTelefoon'], 'Personeelsnummer' => $_POST['iptGebPersoneelsnummer'], 'Budget' => $_POST['iptBudget']);
        $gebruiker->update($properties_values);
        echo '<br /><div class="notification_ok">De medewerker is succesvol aangepast.</div>';
    } else {
        echo '<br /><div class="notification_error">De medewerker kon niet worden aangepast.</div>';
    }
} else {
    ?>
	<div id="form">
			<form name="medewerkerEdit" method="post">
				<fieldset class="info_fieldset">

					<div id="note">
						<div class="notification_warning">Alle velden zijn verplicht!</div>
					</div>

					<div id="fields">
						<label>Email</label><input class="textbox" type="text" name="iptGebEmail" value="<?php 
    echo $gebruiker->getProperty('Email');
    ?>
" /><br />
						<label>Voornaam</label><input class="textbox" type="text" name="iptGebVoornaam" value="<?php 
if (isset($_POST['submit'])) {
    if (!empty($_POST['iptGebEmail']) && !empty($_POST['iptGebStraat']) && !empty($_POST['iptGebHuisnummer']) && !empty($_POST['iptGebPostcode']) && !empty($_POST['iptGebWoonplaats']) && !empty($_POST['iptGebTelefoon']) && !empty($_POST['iptBedBedrijfsnaam']) && !empty($_POST['iptBedStraat']) && !empty($_POST['iptBedHuisnummer']) && !empty($_POST['iptBedPostcode']) && !empty($_POST['iptBedVestigingsplaats']) && !Gebruiker::emailAlreadyExists($_POST['iptGebEmail'])) {
        $properties_values = array('Bedrijfsnaam' => $_POST['iptBedBedrijfsnaam'], 'Straat' => $_POST['iptBedStraat'], 'Huisnummer' => $_POST['iptBedHuisnummer'], 'HuisnummerToevoeging' => $_POST['iptBedHuisnummerToevoeging'], 'Postcode' => $_POST['iptBedPostcode'], 'Vestigingsplaats' => $_POST['iptBedVestigingsplaats'], 'Email' => $_POST['iptBedEmail']);
        Bedrijf::create($properties_values);
        global $db;
        $stmt = $db->query("SELECT MAX(BedrijfID) FROM bedrijf");
        $stmt->execute();
        $res = $stmt->fetch(PDO::FETCH_ASSOC);
        $bedrijfId = $res['MAX(BedrijfID)'];
        $randPass = getUniqueCode(15);
        mailPassword($_POST['iptGebEmail'], $randPass);
        $properties_values = array('Email' => $_POST['iptGebEmail'], 'Wachtwoord' => encrypt($randPass), 'GroepID' => 3, 'BedrijfID' => $bedrijfId, 'Voornaam' => $_POST['iptGebVoornaam'], 'Tussenvoegsel' => $_POST['iptGebTussenvoegsel'], 'Achternaam' => $_POST['iptGebAchternaam'], 'Straat' => $_POST['iptGebStraat'], 'Huisnummer' => $_POST['iptGebHuisnummer'], 'HuisnummerToevoeging' => $_POST['iptGebHuisnummerToevoeging'], 'Postcode' => $_POST['iptGebPostcode'], 'Woonplaats' => $_POST['iptGebWoonplaats'], 'Telefoon' => $_POST['iptGebTelefoon'], 'Aanmaker' => $_SESSION['GebruikerID']);
        Gebruiker::create($properties_values);
        echo '<br /><div class="notification_ok">De groothandel is succesvol aangemaakt.</div>';
    } else {
        if (Gebruiker::emailAlreadyExists($_POST['iptGebEmail'])) {
            echo '<br /><div class="notification_error">Dit e-mailadres is al in gebruik.</div>';
        } else {
            echo '<br /><div class="notification_error">De groothandel kon niet worden aangemaakt.</div>';
        }
    }
} else {
    ?>
	<div id="form">
		<form name="groothandelAdd" method="post">
			<fieldset class="info_fieldset">
				<div id="fields">
					<label style="font-weight: bold; width: 415px;">Gebruiker informatie</label>
					<label>Email*</label><input class="textbox" type="text" name="iptGebEmail" value="" /><br />
					<label>Voornaam*</label><input class="textbox" type="text" name="iptGebVoornaam" value="" /><br />
					<label>Tussenvoegsel</label><input class="textbox" type="text" name="iptGebTussenvoegsel" value="" /><br />
Пример #3
0
<a href="index.php?c=bedrijf&p=list" class="button">Lijstweergave</a>
<a href="index.php?c=bedrijf&p=add" class="button">Bedrijf aanmaken</a><br />
<?php 
if (!defined('isIncluded') || $_SESSION['GroepID'] != 3 || empty($_GET['id'])) {
    header('location: index.php');
}
$gebruiker = Gebruiker::get($_GET['id']);
$bedrijf = Bedrijf::get($gebruiker->getProperty('BedrijfID'));
if (isset($_POST['submit'])) {
    if (!empty($_POST['iptGebEmail']) && !empty($_POST['iptGebStraat']) && !empty($_POST['iptGebHuisnummer']) && !empty($_POST['iptGebPostcode']) && !empty($_POST['iptGebWoonplaats']) && !empty($_POST['iptGebTelefoon']) && !empty($_POST['iptBedBedrijfsnaam']) && !empty($_POST['iptBedStraat']) && !empty($_POST['iptBedHuisnummer']) && !empty($_POST['iptBedPostcode']) && !empty($_POST['iptBedVestigingsplaats']) && !Gebruiker::emailAlreadyExists($_POST['iptGebEmail'])) {
        $properties_values = array('Bedrijfsnaam' => $_POST['iptBedBedrijfsnaam'], 'Straat' => $_POST['iptBedStraat'], 'Huisnummer' => $_POST['iptBedHuisnummer'], 'HuisnummerToevoeging' => $_POST['iptBedHuisnummerToevoeging'], 'Postcode' => $_POST['iptBedPostcode'], 'Vestigingsplaats' => $_POST['iptBedVestigingsplaats'], 'Email' => $_POST['iptBedEmail']);
        $bedrijf->update($properties_values);
        $properties_values = array('Email' => $_POST['iptGebEmail'], 'Voornaam' => $_POST['iptGebVoornaam'], 'Tussenvoegsel' => $_POST['iptGebTussenvoegsel'], 'Achternaam' => $_POST['iptGebAchternaam'], 'Straat' => $_POST['iptGebStraat'], 'Huisnummer' => $_POST['iptGebHuisnummer'], 'HuisnummerToevoeging' => $_POST['iptGebHuisnummerToevoeging'], 'Postcode' => $_POST['iptGebPostcode'], 'Woonplaats' => $_POST['iptGebWoonplaats'], 'Telefoon' => $_POST['iptGebTelefoon']);
        $gebruiker->update($properties_values);
        echo '<br /><div class="notification_ok">Het bedrijf is succesvol aangepast.</div>';
    } else {
        echo '<br /><div class="notification_error">Het bedrijf kon niet worden aangepast.</div>';
    }
} else {
    ?>
	<div id="form">
			<form name="bedrijfEdit" method="post">
				<fieldset class="info_fieldset">

					<div id="note">
						<div class="notification_warning">Alle velden zijn verplicht!</div>
					</div>

					<div id="fields">
						<label style="font-weight: bold; width: 415px;">Gebruiker informatie</label>
						<label>Email</label><input class="textbox" type="text" name="iptGebEmail" value="<?php