Files
2026-06-17 11:55:21 +02:00

108 lines
3.7 KiB
PHP

<?php
require('connect.php');
SESSION_START();
$login = $_SESSION['login'];
$name = $_POST['account'];
if($login==1 || ($login==2 && strlen($_POST['account'])>2) ){
$query = "SELECT voornaam, tussenvoegsel, achternaam, mail, confirm_mail FROM `adminnr_naam`, `pass_forgot` WHERE adminnr_naam.adminnr=pass_forgot.name AND adminnr='$name'";
$result_temp = mysql_query($query, $connection);
$result = mysql_fetch_assoc($result_temp);
$voornaam = $result['voornaam'];
$mail = $result['mail'];
if($result['confirm_mail']==null){ $change = true; } else { $change = false; }
if ($result['tussenvoegsel'] != NULL){
$tussenvoegsel = $result['tussenvoegsel'] . ' ';
}
$achternaam = $result['achternaam'];
$name =$voornaam . ' ' . $tussenvoegsel . $achternaam . ' (' . $_POST['account'] . ')';
}
if($login==2 && strlen($_POST['account'])==2){
$query = "SELECT mail, confirm_mail FROM `pass_forgot` WHERE name='$name'";
$result_temp = mysql_query($query, $connection);
$result = mysql_fetch_assoc($result_temp);
$mail = $result['mail'];
if($result['confirm_mail']==null){ $change = true; } else { $change = false; }
}
?>
<table width='400px'>
<tr>
<th align='left'><h2>Informatie</h2></th>
</tr><tr>
<td align='left'>Ingelogd als:</td><td align='left'><?php echo $name; ?></td>
</tr><tr>
<td align='left'>Email:</td><td align='left' id='mailholder'><?php echo $mail; ?></td>
</tr><tr>
<td align='left'>Bevoegdheid:</td><td align='left'><?php if(strlen($_POST['account'])>2){echo 'Leerling';} elseif(strlen($_POST['account'])==2){echo 'Docent';} ?></td>
</tr>
</table>
<hr size='1px' color='#999' width='600px' align='left'>
<?php if($_SESSION['name']==$_POST['account']){ ?>
<span id='mailcontainer'>
<?php if ($change){ ?>
<table width='400px' id='table_mail'>
<tr>
<th align='left' colspan='2'><h2>Email Adres wijzigen</h2></th>
</tr><tr>
<td align='left' width='200px'>Email Adres:</td><td><form id='mailform' style='display:inline;'><input type='email' name='mail'></form></td>
</tr><tr>
<th></th><td><button onclick='updateMail();'>Aanpassen</button></td>
</tr>
</table>
<?php } else { ?>
<table width='400px' id='table_mail'>
<tr>
<th align='left' colspan='2'><h2>Email Adres bevestigen</h2></th>
</tr><tr>
<td align='left' colspan='2'>Er is een mail gestuurd naar het opgegeven e-mail adres. <font color='#9E0000'>Let op: Deze mail bevind zich waarschijnlijk in uw junk folder!</font> Klink op de link in de mail of vul de code hier in.</td>
</tr><tr>
<td align='left' width='200px'>Code:</td><td><form id='confirmmailform' style='display:inline;'><input type='text' name='code' ></form></td>
</tr><tr>
<th></th><td><button onclick='confirmMail();'>Bevestigen</button></td>
</tr>
</table>
<?php } ?>
</span>
<hr size='1px' color='#999' width='600px' align='left'>
<span id='passcontainer'>
<table width='400px' id='table_pass'>
<tr>
<th align='left' colspan='2'><h2>Wachtwoord wijzigen</h2></th>
</tr><tr>
<td align='left' width='200px'>Oud Wachtwood:</td><td><form id='passform' style='display:inline;'><input type='password' name='oldpass' ></td>
</tr><tr>
<td align='left'>Nieuw Wachtwoord:</td><td><input type='password' name='pass1' ></td>
</tr><tr>
<td align='left'>Herhaal Wachtwood:</td><td><input type='password' name='pass2' ></form></td>
</tr><tr>
<th></th><td><button onclick='updatePass();'>Bevestigen</button></td>
</tr>
</table>
</span>
<?php } else { ?>
<span id='passcontainer'>
<table width='400px' id='table_pass'>
<tr>
<th align='left' colspan='2'><h2>Wachtwoord resetten</h2></th>
</tr><tr>
<th></th><td><button onclick="resetPass('<?php echo $_POST['account']; ?>')">Reset</button></td>
</tr>
</table>
</span>
<?php } ?>