-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprofiel.php
More file actions
94 lines (87 loc) · 2.78 KB
/
profiel.php
File metadata and controls
94 lines (87 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
session_start();
if(!isset($_SESSION['name'])){
header('location: /login.php');
}
include 'config.php';
include 'functions.php';
include 'header.php';
include 'nav.php';
?>
<link rel="stylesheet" href="/style.css">
<!-- Naam, email adres type -->
<!-- Profiel -->
<div class="container">
<div class="row">
<div class="col-md-offset-2 col-md-8">
<div class="panel panel-default">
<!-- Default panel contents -->
<div class="panel-heading">
Profiel
</div>
<div class="table-responsive">
<table class="table table-striped table-hover table-responsive">
<thead>
</thead>
<tbody>
<tr><th>Naam:</th><th><?php echo $_SESSION['name'];?></th><th></th></tr>
<tr><th>Email:</th><th><?php echo $_SESSION['email'];?></th><th></th></tr>
<tr><th>Type:</th><th><?php echo $_SESSION['type'];?></th><th></th></tr>
<tr><th>Wachtwoord:</th><th>********</th><th><a href='?edit=<?php echo $_SESSION['id']; ?>'>Bewerken </a></th></tr>
<tr><th>Plekken:</th><th><?php echo $_SESSION['spots'];?></th><th></th></tr>
</tbody>
</table>
</div>
</div>
<?php
if(isset($_GET['edit']))
{
$id = $_GET['edit'];
$row = mysql_query("SELECT * FROM login WHERE id='$id'");
$st_row = mysql_fetch_array($row);
?>
<div class="panel panel-default">
<div class="panel-body">
<form method="post">
<div class="form-group">
<div class="col-md-0">
<input type='hidden' class='form-control' name='id' value="<?php echo $st_row['id'] ?>"/>
</div>
<div class="col-md-4">
<input type='password' class='form-control' name='password' placeholder="nieuw wachtwoord"/>
</div>
<div class="col-md-4">
<input type='password' class='form-control' name='password2' placeholder="nogmaals"/>
</div>
</div>
<div class="form-group col-md-4">
<input type='submit' value='Update' class='btn btn-primary addy'/>
</div>
</form>
</div>
</div>
<?php }
if(isset($_POST['id']) && isset($_POST['password']) && isset($_POST['password2'])){
if($_POST['password'] == $_POST['password2']) {
$id = $_POST['id'];
$password = $_POST['password'];
$sql = "UPDATE login SET password='$password' WHERE id='$id' ";
if(mysql_query($sql)) {
echo '<meta http-equiv="refresh" content="0; url=profiel.php ">';
}
else {
echo "Something went wrong!";
}
}
else
{ ?>
<div class="alert alert-danger alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<strong>Wachtwoorden komen niet overeen!</strong>
</div> <?php
}
}
?>
</div>
</div>
</div>