diff --git a/support/tool/CRAFT/admin_gebruikers/bewerken.php b/support/tool/CRAFT/admin_gebruikers/bewerken.php index cfa9a804b28bc07364defe8e5c5fc198590c3d0d..1fff97f1a0ddc58fb9f68ba902f2b22d47904cb9 100644 --- a/support/tool/CRAFT/admin_gebruikers/bewerken.php +++ b/support/tool/CRAFT/admin_gebruikers/bewerken.php @@ -4,6 +4,7 @@ $_SESSION['huidige_pagina'] = $_SESSION['pagina'] . 'admin.php?p='.$_SESSION['admin_deel'].'&s=2'; require_once($_SESSION['pagina'] . 'includes/login_funcs.php'); + include_once($_SESSION['pagina'] . 'includes/controle_functies.php'); //controleren of er iemand ingelogd is... if ($LOGGED_IN = user_isloggedin()) { @@ -25,7 +26,187 @@ <div id="rechterdeel"> <h2>Gebruikers bewerken</h2> - + + <?php + + function Valideer_Invoer() { + //Gebr_Naam + if (isset($_POST['Gebr_Naam'])) { + if ($_POST['Gebr_Naam'] == '') + return false; + } else return false; + + //Wachtwoord + if (isset($_POST['Wachtwoord'])) { + if ($_POST['Wachtwoord'] == '') + return false; + } else return false; + + //Gebr_Email + if (isset($_POST['Gebr_Email'])) { + if ($_POST['Gebr_Email'] != '' && !mail_check($_POST['Gebr_Email'])) + return false; + } else return false; + + return true; + } + + if(Valideer_Invoer()) { + $query = "UPDATE gebruiker SET inlognaam = '". $_POST['Gebr_Naam'] ."', Wachtwoord = '". md5($_POST['Wachtwoord']) ."', Start_Alg='". $_POST['Alg_Start'] ."'"; + $query = $query . ", Start_Comp='". $_POST['Comp_Start'] ."', Start_Melding = '". $_POST['Melding_Start'] ."', Start_Stats='". $_POST['Stats_Start'] ."'"; + $query = $query . ", Groep_ID = '". $_POST['Gebr_Groep'] ."', Gebruiker_Taal='". $_POST['Gebr_Taal'] ."', Emailadres = '". $_POST['Gebr_Email'] ."'"; + $query = $query . " WHERE Werknem_ID = '" . $_GET['c'] . "'"; + + if (mysql_query($query)) echo("De gewijzigde gebruiker \"". $_POST['Gebr_Naam'] ."\" is in het systeem bijgewerkt<br>"); + else("Er is iets mis gegaan met het opslaan van de gebruiker \"". $_POST['Gebr_Naam'] ."\"!! De gebruiker is niet bijgewerkt!"); + echo('<a href="'.$_SESSION['huidige_pagina'].'&c='.$_GET['c']. '">Klik hier om terug te keren naar de vorige gebruiker of selecteer links een gebruiker uit de treeview.</a>'); + + } + else { + if (isset($_GET['c']) && $_GET['c'] != 0 ) { + $query = 'SELECT * FROM gebruiker WHERE Werknem_ID = '. $_GET['c']; + $resultaat = mysql_query($query); + $row = mysql_fetch_array($resultaat); + ?> + <form name="theForm" method="post" action="<?php echo($_SESSION['huidige_pagina']);?>&c=<?php echo($_GET['c']); ?>"> + <table> + <tr> + <td>Gebruikersnaam:</td> + <td><input name="Gebr_Naam" type="text" value="<?php if(isset($_POST['opslaan']) && $_POST['opslaan'] == 1) echo($_POST['Gebr_Naam']); else echo($row['inlognaam']); ?>"> + <?php if(isset($_POST['Gebr_Naam']) && $_POST['Gebr_Naam'] == '') echo('<b>* Er is geen naam ingevoerd!</b>'); ?> + </td> + </tr> + <tr> + <td>Groep:</td> + <td><select name="Gebr_Groep"> + <?php + $query = 'SELECT Groep_ID, Groeps_Naam FROM gebruikers_groepen WHERE Groep_ID >1'; + $resultaat = mysql_query($query); + if (isset($_POST['Gebr_Groep'])) $selectie = $_POST['Gebr_Groep']; + else $selectie = $row['Groep_ID']; + + while ($data = mysql_fetch_array($resultaat)) { + echo("<option value=\"". $data['Groep_ID'] ."\" "); + if ($data['Groep_ID'] == $selectie) + echo ('SELECTED'); + echo(">". $data['Groeps_Naam'] ."</option>\r\n"); + } + ?></select></td> + </tr> + <tr> + <td>Wachtwoord:</td> + <td><input name="Wachtwoord" type="password"> + <?php if(isset($_POST['Wachtwoord']) && $_POST['Wachtwoord'] == '') echo('<b>* Er is geen wachtwoord ingevoerd!</b>'); ?> + </td> + </tr> + <tr> + <td>E-mailadres:</td> + <td><input name="Gebr_Email" type="text" value="<?php if(isset($_POST['opslaan']) && $_POST['opslaan'] == 1) echo($_POST['Gebr_Email']); else echo($row['Emailadres']); ?>"> + <?php + if (isset($_POST['Gebr_Email'])) + $mail = $_POST['Gebr_Email']; + else $mail = ''; + + if(isset($_POST['opslaan'])) { + if ($mail == '' || !mail_check($mail)) + echo('<b>* Er is geen (geldig) e-mailadres ingevoerd!</b>'); + } + ?> + </td> + </tr> + <tr> + <td>Gebruikerstaal:</td> + <td><select name="Gebr_Taal"> + <?php + if (isset($_POST['Gebr_Taal'])) + $selectie = $_POST['Gebr_Taal']; + else $selectie = $row['Gebruiker_Taal']; + ?> + + <option value="1" <?php if($selectie == 1) echo('SELECTED'); ?>>Nederlands</option> + <option value="2" <?php if($selectie == 2) echo('SELECTED'); ?>>Engels</option> + </select></td> + </tr> + <tr> + <td>Algemene startpagina:</td> + <td><select name="Alg_Start"> + <?php + if (isset($_POST['Alg_Start'])) + $selectie = $_POST['Alg_Start']; + else $selectie = $row['Start_Alg']; + ?> + + <option value="1" <?php if($selectie == 1) echo('SELECTED'); ?>>Intro scherm</option> + <option value="2" <?php if($selectie == 2) echo('SELECTED'); ?>>Componenten</option> + <option value="3" <?php if($selectie == 3) echo('SELECTED'); ?>>Meldingen</option> + <option value="4" <?php if($selectie == 4) echo('SELECTED'); ?>>Statistieken</option> + <option value="5" <?php if($selectie == 5) echo('SELECTED'); ?>>Instellingen</option> + </select></td> + </tr> + <tr> + <td>Componenten startpagina:</td> + <td><select name="Comp_Start"> + <?php + if (isset($_POST['Comp_Start'])) + $selectie = $_POST['Comp_Start']; + else $selectie = $row['Start_Comp']; + ?> + + <option value="1" <?php if($selectie == 1) echo('SELECTED'); ?>>Componenten overzicht</option> + <option value="2" <?php if($selectie == 2) echo('SELECTED'); ?>>Componenten toevoegen</option> + <option value="3" <?php if($selectie == 3) echo('SELECTED'); ?>>Componenten bewerken</option> + <option value="4" <?php if($selectie == 4) echo('SELECTED'); ?>>Componenten verwijderen</option> + </select></td> + </tr> + <tr> + <td>Meldingen startpagina:</td> + <td><select name="Melding_Start"> + <?php + if (isset($_POST['Melding_Start'])) + $selectie = $_POST['Melding_Start']; + else $selectie = $row['Start_Melding']; + ?> + + <option value="1" <?php if($selectie == 1) echo('SELECTED'); ?>>Meldingen overzicht</option> + <option value="2" <?php if($selectie == 2) echo('SELECTED'); ?>>Meldingen toevoegen</option> + <option value="3" <?php if($selectie == 3) echo('SELECTED'); ?>>Meldingen bewerken</option> + <option value="4" <?php if($selectie == 4) echo('SELECTED'); ?>>Meldingen verwijderen</option> + </select></td> + </tr> + <tr> + <td>Statistieken startpagina:</td> + <td><select name="Stats_Start"> + <?php + if (isset($_POST['Stats_Start'])) + $selectie = $_POST['Stats_Start']; + else $selectie = $row['Start_Stats']; + ?> + + <option value="1" <?php if($selectie == 1) echo('SELECTED'); ?>>Statistieken overzicht</option> + <option value="2" <?php if($selectie == 2) echo('SELECTED'); ?>>Statistieken toevoegen</option> + <option value="3" <?php if($selectie == 3) echo('SELECTED'); ?>>Statistieken bewerken</option> + <option value="4" <?php if($selectie == 4) echo('SELECTED'); ?>>Statistieken verwijderen</option> + </select></td> + </tr> + <tr> + <td><input name="opslaan" type="hidden" value="1"></td> + <td><a href="javascript:document.theForm.submit();">Opslaan</a></td> + </tr> + </table> + </form> + + + + + + <?php + } + else echo('Er is geen contact geselecteerd om te wijzigen.<br>Selecteer hiernaast een contact.'); + } + ?> + + + </div> <?php diff --git a/support/tool/CRAFT/admin_gebruikers/toevoegen.php b/support/tool/CRAFT/admin_gebruikers/toevoegen.php index 3e49479f29ae98cb7ad505fbb6d4886206cd2a7c..5913c1fda68a797cd2348a98768660331c20f80e 100644 --- a/support/tool/CRAFT/admin_gebruikers/toevoegen.php +++ b/support/tool/CRAFT/admin_gebruikers/toevoegen.php @@ -4,6 +4,7 @@ $_SESSION['huidige_pagina'] = $_SESSION['pagina'] . 'admin.php?p='.$_SESSION['admin_deel'].'&s=1'; require_once($_SESSION['pagina'] . 'includes/login_funcs.php'); + include_once($_SESSION['pagina'] . 'includes/controle_functies.php'); //controleren of er iemand ingelogd is... if ($LOGGED_IN = user_isloggedin()) { @@ -25,66 +26,171 @@ <div id="rechterdeel"> <h2>Gebruikers toevoegen</h2> - <form> + + <?php + function Valideer_Invoer() { + //Gebr_Naam + if (isset($_POST['Gebr_Naam'])) { + if ($_POST['Gebr_Naam'] == '') + return false; + } else return false; + + //Wachtwoord + if (isset($_POST['Wachtwoord'])) { + if ($_POST['Wachtwoord'] == '') + return false; + } else return false; + + //Gebr_Email + if (isset($_POST['Gebr_Email'])) { + if ($_POST['Gebr_Email'] != '' && !mail_check($_POST['Gebr_Email'])) + return false; + } else return false; + + return true; + } + + + if (Valideer_Invoer()) { + $query = "INSERT INTO gebruiker (inlognaam, Wachtwoord, Start_Alg, Start_Comp, Start_Melding, Start_Stats, Groep_ID, Gebruiker_Taal, Emailadres) "; + $query = $query . "VALUES ('". $_POST['Gebr_Naam'] ."', '". md5($_POST['Wachtwoord']) ."', '". $_POST['Alg_Start'] ."' ,'". $_POST['Comp_Start'] ."', "; + $query = $query . "'". $_POST['Melding_Start'] ."', '". $_POST['Stats_Start'] ."', '" . $_POST['Gebr_Groep'] ."', '". $_POST['Gebr_Taal'] ."', '". $_POST['Gebr_Email'] ."')"; + + if (mysql_query($query)) echo("De nieuwe gebruiker \"". $_POST['Gebr_Naam'] ."\" is aan het systeem toegevoegd<br>"); + else echo("De nieuwe gebruiker \"". $_POST['Gebr_Naam'] ."\" kon niet aan het systeem toegevoegd worden!."); + echo('<a href="'.$_SESSION['huidige_pagina'].'">Klik hier om nog een gebruiker toe te voegen.</a>'); + } + else { + + ?> + <form name="theForm" method="post" action="<?php echo($_SESSION['huidige_pagina']);?>"> <table> <tr> <td>Gebruikersnaam:</td> - <td><input name="Gebr_Naam" type="text"></td> + <td><input name="Gebr_Naam" type="text" value="<?php if(isset($_POST['Gebr_Naam'])) echo($_POST['Gebr_Naam']); ?>"> + <?php if(isset($_POST['Gebr_Naam']) && $_POST['Gebr_Naam'] == '') echo('<b>* Er is geen naam ingevoerd!</b>'); ?> + </td> </tr> <tr> <td>Groep:</td> - <td><select name="Gebr_Groep"></select></td> + <td><select name="Gebr_Groep"> + <?php + $query = 'SELECT Groep_ID, Groeps_Naam FROM gebruikers_groepen WHERE Groep_ID >1'; + $resultaat = mysql_query($query); + + while ($data = mysql_fetch_array($resultaat)) { + echo("<option value=\"". $data['Groep_ID'] ."\" "); + + if(isset($_POST['Gebr_Groep']) && $data['Groep_ID'] == $_POST['Gebr_Groep']) + echo('SELECTED'); + echo(">". $data['Groeps_Naam'] ."</option>\r\n"); + } + ?></select></td> </tr> <tr> <td>Wachtwoord:</td> - <td><input name="Wachtwoord" type="password"></td> + <td><input name="Wachtwoord" type="password"> + <?php if(isset($_POST['Wachtwoord']) && $_POST['Wachtwoord'] == '') echo('<b>* Er is geen wachtwoord ingevoerd!</b>'); ?> + </td> </tr> <tr> <td>E-mailadres:</td> - <td><input name="Gebr_Email" type="text"></td> + <td><input name="Gebr_Email" type="text" value="<?php if(isset($_POST['Gebr_Email'])) echo($_POST['Gebr_Email']); ?>"> + <?php + if (isset($_POST['Gebr_Email'])) + $mail = $_POST['Gebr_Email']; + else $mail = ''; + + if(isset($_POST['opslaan'])) { + if ($mail == '' || !mail_check($mail)) + echo('<b>* Er is geen (geldig) e-mailadres ingevoerd!</b>'); + } + ?> + </td> </tr> <tr> <td>Gebruikerstaal:</td> - <td><select name="Gebr_Taal"></select></td> + <td><select name="Gebr_Taal"> + <?php + if (isset($_POST['Gebr_Taal'])) + $selectie = $_POST['Gebr_Taal']; + else $selectie = 1; + ?> + + <option value="1" <?php if($selectie == 1) echo('SELECTED'); ?>>Nederlands</option> + <option value="2" <?php if($selectie == 2) echo('SELECTED'); ?>>Engels</option> + </select></td> </tr> <tr> <td>Algemene startpagina:</td> - <td><select name="Alg_Start"></select></td> + <td><select name="Alg_Start"> + <?php + if (isset($_POST['Alg_Start'])) + $selectie = $_POST['Alg_Start']; + else $selectie = 1; + ?> + + <option value="1" <?php if($selectie == 1) echo('SELECTED'); ?>>Intro scherm</option> + <option value="2" <?php if($selectie == 2) echo('SELECTED'); ?>>Componenten</option> + <option value="3" <?php if($selectie == 3) echo('SELECTED'); ?>>Meldingen</option> + <option value="4" <?php if($selectie == 4) echo('SELECTED'); ?>>Statistieken</option> + <option value="5" <?php if($selectie == 5) echo('SELECTED'); ?>>Instellingen</option> + </select></td> </tr> <tr> <td>Componenten startpagina:</td> - <td><select></select></td> + <td><select name="Comp_Start"> + <?php + if (isset($_POST['Comp_Start'])) + $selectie = $_POST['Comp_Start']; + else $selectie = 1; + ?> + + <option value="1" <?php if($selectie == 1) echo('SELECTED'); ?>>Componenten overzicht</option> + <option value="2" <?php if($selectie == 2) echo('SELECTED'); ?>>Componenten toevoegen</option> + <option value="3" <?php if($selectie == 3) echo('SELECTED'); ?>>Componenten bewerken</option> + <option value="4" <?php if($selectie == 4) echo('SELECTED'); ?>>Componenten verwijderen</option> + </select></td> </tr> <tr> <td>Meldingen startpagina:</td> - <td><select></select></td> + <td><select name="Melding_Start"> + <?php + if (isset($_POST['Melding_Start'])) + $selectie = $_POST['Melding_Start']; + else $selectie = 1; + ?> + + <option value="1" <?php if($selectie == 1) echo('SELECTED'); ?>>Meldingen overzicht</option> + <option value="2" <?php if($selectie == 2) echo('SELECTED'); ?>>Meldingen toevoegen</option> + <option value="3" <?php if($selectie == 3) echo('SELECTED'); ?>>Meldingen bewerken</option> + <option value="4" <?php if($selectie == 4) echo('SELECTED'); ?>>Meldingen verwijderen</option> + </select></td> </tr> <tr> <td>Statistieken startpagina:</td> - <td><select></select></td> - </tr> - <tr> - <td>Intro scherm zichtbaar:</td> - <td><input type="checkbox"></td> - </tr> - <tr> - <td>Componentenscherm zichtbaar:</td> - <td><input type="checkbox"></td> - </tr> - <tr> - <td>Meldingenscherm zichtbaar:</td> - <td><input type="checkbox"></td> - </tr> - <tr> - <td>Statistiekenscherm zichtbaar:</td> - <td><input type="checkbox"></td> + <td><select name="Stats_Start"> + <?php + if (isset($_POST['Stats_Start'])) + $selectie = $_POST['Stats_Start']; + else $selectie = 1; + ?> + + <option value="1" <?php if($selectie == 1) echo('SELECTED'); ?>>Statistieken overzicht</option> + <option value="2" <?php if($selectie == 2) echo('SELECTED'); ?>>Statistieken toevoegen</option> + <option value="3" <?php if($selectie == 3) echo('SELECTED'); ?>>Statistieken bewerken</option> + <option value="4" <?php if($selectie == 4) echo('SELECTED'); ?>>Statistieken verwijderen</option> + </select></td> </tr> <tr> - <td>Instellingenscherm zichtbaar:</td> - <td><input type="checkbox"></td> + <td><input name="opslaan" type="hidden" value="1"></td> + <td><a href="javascript:document.theForm.submit();">Toevoegen</a></td> </tr> </table> </form> + <?php + } + ?> </div> <?php diff --git a/support/tool/CRAFT/admin_gebruikers/verwijderen.php b/support/tool/CRAFT/admin_gebruikers/verwijderen.php index 3a39317510e2c5f8f10a870c1c8e9eff94b70862..d99b40083e7a6ad850494b7f7fe375f288248ce0 100644 --- a/support/tool/CRAFT/admin_gebruikers/verwijderen.php +++ b/support/tool/CRAFT/admin_gebruikers/verwijderen.php @@ -25,7 +25,39 @@ <div id="rechterdeel"> <h2>Gebruikers verwijderen</h2> - + <?php + if (isset($_POST['verwijderen']) && $_POST['verwijderen'] == 1 && isset($_POST['confirmatie']) && $_POST['confirmatie'] == 'on') { + $query = "DELETE FROM gebruiker WHERE Werknem_ID = " . $_POST['gebruiker']; + if (mysql_query($query)) echo("De door u geselecteerde gebruiker is uit het systeem verwijderd.<br>"); + else("Er is iets mis gegaan met het verwijderen van de gebruiker!! De gebruiker is niet verwijderd!"); + echo('<a href="'.$_SESSION['huidige_pagina'].'&s=3">Klik hier om terug te keren naar het verwijderen scherm of selecteer links een gebruiker uit de treeview.</a>'); + } + else { + if (isset($_GET['c']) && $_GET['c'] != 0 ) { + $query = "SELECT inlognaam FROM gebruiker WHERE Werknem_ID = '". $_GET['c'] ."'"; + $resultaat = mysql_query($query); + $row = mysql_fetch_row($resultaat); + + echo('U heeft "'. $row[0] .'" geselecteerd:<br>'); + + //kijken of de gebruiker niet de ingelogde persoon is + if ($_GET['c'] != $_SESSION['gebr_id']) { + //FORMPJE MAKEN!!!!!!!!!!!!!!!!!!!!! + ?> + <form name="theForm" method="post" action="<?php echo($_SESSION['huidige_pagina']); ?>&c=<?php echo($_GET['c']); ?>"> + <table> + <tr><td><input type="hidden" name="gebruiker" value="<?php echo($_GET['c']);?>">Weet u zeker dat u deze gebruiker verwijderen wilt?</td></tr> + <tr><td><input type="CheckBox" name="confirmatie"> Ja, ik wil deze gebruiker verwijderen</td></tr> + <tr><td><input type="hidden" name="verwijderen" value="1"><a href="javascript:document.theForm.submit();">Verwijderen</a></td></tr> + </table> + </form> + <?php + } + else echo("<br>Dit bent u zelf. U kunt uzelf niet verwijderen!"); + } + else echo("Er is geen gebruiker geselecteerd om te verwijderen<br>Selecteer hiernaast een gebruiker."); + } + ?> </div> <?php diff --git a/support/tool/CRAFT/documentatie/changes.doc b/support/tool/CRAFT/documentatie/changes.doc index 8dd86014e97aa62bbcfc63e20bcdc2e20b85e08a..f34e46d2c39a3266c8b3f6e56d2172318e5dcdc9 100644 Binary files a/support/tool/CRAFT/documentatie/changes.doc and b/support/tool/CRAFT/documentatie/changes.doc differ diff --git a/support/tool/CRAFT/includes/functies.js b/support/tool/CRAFT/includes/functies.js index 70184df1131a3eaa276426f619eda611d8c34b16..d7136595465aa0547fe9e274321b38dd0ad4cfb8 100644 --- a/support/tool/CRAFT/includes/functies.js +++ b/support/tool/CRAFT/includes/functies.js @@ -92,7 +92,7 @@ document.getElementById('suboptie1').innerHTML="Gebruikersgroep toevoegen" document.getElementById('suboptie2').innerHTML="Gebruikersgroep bewerken" document.getElementById('suboptie3').innerHTML="Gebruikersgroep verwijderen"; - document.getElementById('suboptie4').innerHTML="Groepsmail versturen"; + document.getElementById('suboptie4').innerHTML="Groepmail versturen"; } else if (optie ==6) { document.getElementById('suboptie1').innerHTML="Gebruikers toevoegen"