overzicht.php
Gesponsorde koppelingen
PHP script bestanden
<div id="navigation">
<ul>
<li> <a href="index.php"> Home </a></li>
<li> <a href="admin.php"> Admin Page </a></li>
<li> <a href="overzicht.php?nr=0-10&sorteer_asc=1"> Overzicht </a></li>
<li> <a href="logout.php"> Logout </a></li>
</ul>
</div>
Code (php)
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
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
<?php
//functies
function get_db ($value1, $value2, $sorteer_asc_var){
if($sorteer_asc_var == 1){ $sorteer_asc_var = "id"; }
if($sorteer_asc_var == 2){ $sorteer_asc_var = "veld1"; }
if($sorteer_asc_var == 3){ $sorteer_asc_var = "veld2"; }
if($sorteer_asc_var == 4){ $sorteer_asc_var = "veld3"; }
$query = "SELECT * FROM tabel ORDER BY {$sorteer_asc_var} ASC LIMIT {$value1}, {$value2}";
$result = mysql_query($query);
if (!$result) {
die("Database query failed1: " . mysql_error());
}
return $result;
}
function get_db_by_sorteren ($value1, $value2, $sorteer_desc_var){
if($sorteer_desc_var == 1){ $sorteer_desc_var = "id"; }
if($sorteer_desc_var == 2){ $sorteer_desc_var = "veld1"; }
if($sorteer_desc_var == 3){ $sorteer_desc_var = "veld2"; }
if($sorteer_desc_var == 4){ $sorteer_desc_var = "veld3"; }
$query = "SELECT * FROM tabel ORDER BY {$sorteer_desc_var} DESC LIMIT {$value1}, {$value2}";
$result = mysql_query($query);
if (!$result) {
die("Database query failed2: " . mysql_error());
}
return $result;
}
?>
//functies
function get_db ($value1, $value2, $sorteer_asc_var){
if($sorteer_asc_var == 1){ $sorteer_asc_var = "id"; }
if($sorteer_asc_var == 2){ $sorteer_asc_var = "veld1"; }
if($sorteer_asc_var == 3){ $sorteer_asc_var = "veld2"; }
if($sorteer_asc_var == 4){ $sorteer_asc_var = "veld3"; }
$query = "SELECT * FROM tabel ORDER BY {$sorteer_asc_var} ASC LIMIT {$value1}, {$value2}";
$result = mysql_query($query);
if (!$result) {
die("Database query failed1: " . mysql_error());
}
return $result;
}
function get_db_by_sorteren ($value1, $value2, $sorteer_desc_var){
if($sorteer_desc_var == 1){ $sorteer_desc_var = "id"; }
if($sorteer_desc_var == 2){ $sorteer_desc_var = "veld1"; }
if($sorteer_desc_var == 3){ $sorteer_desc_var = "veld2"; }
if($sorteer_desc_var == 4){ $sorteer_desc_var = "veld3"; }
$query = "SELECT * FROM tabel ORDER BY {$sorteer_desc_var} DESC LIMIT {$value1}, {$value2}";
$result = mysql_query($query);
if (!$result) {
die("Database query failed2: " . mysql_error());
}
return $result;
}
?>
Code (php)
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
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
<?php
if (isset($_GET['nr'])) {
$get_nr = $_GET['nr'];
if (preg_match("/^([0-9])*-([0-9])/", $get_nr)) {
$get_nr_array = explode("-",$get_nr,2);
$value1 = $get_nr_array[0];
$value2 = $get_nr_array[1];
} else {
echo"error";
}
} else {
header("Location: index.php");
}
$query_select = "SELECT * FROM tabel ";
$result_select = mysql_query($query_select);
if (!$result_select) {
die("Database query failed: " . mysql_error());
}
$nummer_select = mysql_num_rows($result_select);
$nummer_select_mintien = $nummer_select -10;
if (isset($_GET['sorteer_asc'])) {
$sorteer_asc_var = $_GET['sorteer_asc'];
}
if (isset($_GET['sorteer_desc'])) {
$sorteer_desc_var = $_GET['sorteer_desc'];
}
if(isset($value1)){
$huidig_value1 = $value1;
} $huidig_value2 = 10;
if(isset($value1)){
$terug_value1 = $value1 - 10;
if ($terug_value1 < 0) {
$terug_value1 = 0;
}
}
if(isset($value1)){
$terug_value1_10 = $value1 - 100;
if ($terug_value1_10 < 0) {
$terug_value1_10 = 0;
}
}
$terug_value2 = 10;
if(isset($value1)){
$verder_value1 = round($value1, -1) +10;
if ($verder_value1 >= $nummer_select_mintien) {
$verder_value1 = round($nummer_select_mintien, -1);
}
}
if(isset($value1)){
$verder_value1_10 = round($value1, -1) +100;
if ($verder_value1_10 >= $nummer_select_mintien) {
$verder_value1_10 = round($nummer_select_mintien, -1);
}
}
$verder_value2 = 10;
?>
if (isset($_GET['nr'])) {
$get_nr = $_GET['nr'];
if (preg_match("/^([0-9])*-([0-9])/", $get_nr)) {
$get_nr_array = explode("-",$get_nr,2);
$value1 = $get_nr_array[0];
$value2 = $get_nr_array[1];
} else {
echo"error";
}
} else {
header("Location: index.php");
}
$query_select = "SELECT * FROM tabel ";
$result_select = mysql_query($query_select);
if (!$result_select) {
die("Database query failed: " . mysql_error());
}
$nummer_select = mysql_num_rows($result_select);
$nummer_select_mintien = $nummer_select -10;
if (isset($_GET['sorteer_asc'])) {
$sorteer_asc_var = $_GET['sorteer_asc'];
}
if (isset($_GET['sorteer_desc'])) {
$sorteer_desc_var = $_GET['sorteer_desc'];
}
if(isset($value1)){
$huidig_value1 = $value1;
} $huidig_value2 = 10;
if(isset($value1)){
$terug_value1 = $value1 - 10;
if ($terug_value1 < 0) {
$terug_value1 = 0;
}
}
if(isset($value1)){
$terug_value1_10 = $value1 - 100;
if ($terug_value1_10 < 0) {
$terug_value1_10 = 0;
}
}
$terug_value2 = 10;
if(isset($value1)){
$verder_value1 = round($value1, -1) +10;
if ($verder_value1 >= $nummer_select_mintien) {
$verder_value1 = round($nummer_select_mintien, -1);
}
}
if(isset($value1)){
$verder_value1_10 = round($value1, -1) +100;
if ($verder_value1_10 >= $nummer_select_mintien) {
$verder_value1_10 = round($nummer_select_mintien, -1);
}
}
$verder_value2 = 10;
?>
<div id="content">
<br />
<table id="tabel1" width="90%">
<tr> <!-- colspan aanpassen -->
<td id="nav" colspan="6" align="left">
Code (php)
<a href="invoeg.php">Rij toevoegen</a> |
<form action="delete.php" method="post">
Delete | Range van id:
<input type="text" name="1" maxlength="6" size="4"/>
<input type="text" name="2" maxlength="6" size="4"/>
<input type="submit" name="submit" value="delete" onClick="return confirmDelete();"/> |
<a href="delete.php?del=truncate" onClick="return confirmDelete();">Leeg tabel</a>
</form>
</td>
</tr>
<tr> <!-- colspan aanpassen -->
<td colspan="6" align="center">
<table id="table1">
<tr>
<td>
<a href="overzicht.php?nr=0-10
"> <-< </a>
</td>
<td>
<a href="overzicht.php?nr=-
"> <10 </a>
</td>
<td>
<a href="overzicht.php?nr=-
"> < </a>
</td>
<td width="300px">
Code (php)
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
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
<?php
$weergaven1 = $value1;
$weergaven1 ++;
$weergaven2 = $value1 + 10 ;
//$weergaven2 ++;
if ($weergaven2 >= $nummer_select) {
$weergaven2 = $nummer_select;
}
echo $weergaven1 . "/"; echo $weergaven2; echo " van de :" . $nummer_select;
if (isset($sorteer_desc_var)) {
if($sorteer_desc_var == 1){ $sorteer_desc_var_display = "id"; }
if($sorteer_desc_var == 2){ $sorteer_desc_var_display = "veld1"; }
if($sorteer_desc_var == 3){ $sorteer_desc_var_display = "veld2"; }
if($sorteer_desc_var == 4){ $sorteer_desc_var_display = "veld3"; }
echo"<br />Geselecteerd op Z-A: " . $sorteer_desc_var_display . "";
}
if (isset($sorteer_asc_var)) {
if($sorteer_asc_var == 1){ $sorteer_asc_var_display = "id"; }
if($sorteer_asc_var == 2){ $sorteer_asc_var_display = "veld1"; }
if($sorteer_asc_var == 3){ $sorteer_asc_var_display = "veld2"; }
if($sorteer_asc_var == 4){ $sorteer_asc_var_display = "veld3"; }
echo"<br />Geselecteerd op A-Z: " . $sorteer_asc_var_display . "";
}
?>
$weergaven1 = $value1;
$weergaven1 ++;
$weergaven2 = $value1 + 10 ;
//$weergaven2 ++;
if ($weergaven2 >= $nummer_select) {
$weergaven2 = $nummer_select;
}
echo $weergaven1 . "/"; echo $weergaven2; echo " van de :" . $nummer_select;
if (isset($sorteer_desc_var)) {
if($sorteer_desc_var == 1){ $sorteer_desc_var_display = "id"; }
if($sorteer_desc_var == 2){ $sorteer_desc_var_display = "veld1"; }
if($sorteer_desc_var == 3){ $sorteer_desc_var_display = "veld2"; }
if($sorteer_desc_var == 4){ $sorteer_desc_var_display = "veld3"; }
echo"<br />Geselecteerd op Z-A: " . $sorteer_desc_var_display . "";
}
if (isset($sorteer_asc_var)) {
if($sorteer_asc_var == 1){ $sorteer_asc_var_display = "id"; }
if($sorteer_asc_var == 2){ $sorteer_asc_var_display = "veld1"; }
if($sorteer_asc_var == 3){ $sorteer_asc_var_display = "veld2"; }
if($sorteer_asc_var == 4){ $sorteer_asc_var_display = "veld3"; }
echo"<br />Geselecteerd op A-Z: " . $sorteer_asc_var_display . "";
}
?>
</td>
<td>
<a href="overzicht.php?nr=-
"> > </a>
</td>
<td>
<a href="overzicht.php?nr=-
"> 10> </a>
</td>
<td>
<a href="overzicht.php?nr=-10
"> >-> </a>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td id="header" width="10%" align="center"><b>id</b></td>
<td id="header" width="20%" align="center"><b>veld1</b></td>
<td id="header" width="20%" align="center"><b>veld2</b></td>
<td id="header" width="20%" align="center"><b>veld3</b></td>
<td id="header" width="10%" align="center"><b>wijzig</b></td>
<td id="header" width="10%" align="center"><b>delete</b></td>
</tr>
<tr>
<td id="header">
<a href="overzicht.php?nr=-&sorteer_desc=1 ">˅</a>
<a href="overzicht.php?nr=-&sorteer_asc=1">˄</a>
</td>
<td id="header">
<a href="overzicht.php?nr=-&sorteer_desc=2 ">˅</a>
<a href="overzicht.php?nr=-&sorteer_asc=2">˄</a>
</td>
<td id="header">
<a href="overzicht.php?nr=-&sorteer_desc=3 ">˅</a>
<a href="overzicht.php?nr=-&sorteer_asc=3">˄</a>
</td>
<td id="header">
<a href="overzicht.php?nr=-&sorteer_desc=4 ">˅</a>
<a href="overzicht.php?nr=-&sorteer_asc=4">˄</a>
</td>
<td>
</td>
<td>
</td>
</tr>
Code (php)
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
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
<?php
if (isset($_GET['txt']) && ($_GET['txt']) == 1) {
if (isset($_GET['sorteer_desc'])){
$result = get_db_by_sorteren ($value1, $value2, $sorteer_desc_var);
$nummer = mysql_num_rows($result);
while ($verleng = mysql_fetch_array($result)) {
echo "<tr>"; //colspan aanpassen
echo "<td colspan=\"4\">" . $verleng['id'] . "; ";
echo "" . $verleng['veld1'] . "; ";
echo "" . $verleng['veld2'] . "; ";
echo "" . $verleng['veld3'] . "; </td>";
echo "<td> <a href=\"wijzigen.php?wijzigid={$verleng['id']}\"> wijzig </a></td>";
echo "<td> <a href=\"delete.php?deleteid={$verleng['id']}\" onClick=\"return confirmDelete();\"> delete </a></td>";
echo "</tr>";
}
}
if(isset($_GET['sorteer_asc'])) {
$result = get_db ($value1, $value2, $sorteer_asc_var);
$nummer = mysql_num_rows($result);
while ($verleng = mysql_fetch_array($result)) {
echo "<tr>"; //colspan aanpassen
echo "<td colspan=\"4\">" . $verleng['id'] . "; ";
echo "" . $verleng['veld1'] . "; ";
echo "" . $verleng['veld2'] . "; ";
echo "" . $verleng['veld3'] . "; </td>";
echo "<td> <a href=\"wijzigen.php?wijzigid={$verleng['id']}\"> wijzig </a></td>";
echo "<td> <a href=\"delete.php?deleteid={$verleng['id']}\" onClick=\"return confirmDelete();\"> delete </a></td>";
echo "</tr>";
}
}
} else {
if (isset($_GET['sorteer_desc'])) {
$result = get_db_by_sorteren ($value1, $value2, $sorteer_desc_var);
$nummer = mysql_num_rows($result);
$count1 = $value1;
$count1 ++;
while ($verleng = mysql_fetch_array($result)) {
echo"<tr>";
echo "<td>" . $verleng['id'] . "</td>";
echo "<td>" . $verleng['veld1'] . "</td>";
echo "<td>" . $verleng['veld2'] . "</td>";
echo "<td>" . $verleng['veld3'] . "</td>";
echo "<td> <a href=\"wijzigen.php?wijzigid={$verleng['id']}\"> wijzig </a></td>";
echo "<td> <a href=\"delete.php?deleteid={$verleng['id']}\" onClick=\"return confirmDelete();\"> delete </a></td>";
echo "</tr>";
}
}
if(isset($_GET['sorteer_asc'])) {
$result = get_db ($value1, $value2, $sorteer_asc_var);
$nummer = mysql_num_rows($result);
$count1 = $value1;
$count1 ++;
while ($verleng = mysql_fetch_array($result)) {
echo"<tr>";
echo "<td>" . $verleng['id'] . "</td>";
echo "<td>" . $verleng['veld1'] . "</td>";
echo "<td>" . $verleng['veld2'] . "</td>";
echo "<td>" . $verleng['veld3'] . "</td>";
echo "<td> <a href=\"wijzigen.php?wijzigid={$verleng['id']}\"> wijzig </a></td>";
echo "<td> <a href=\"delete.php?deleteid={$verleng['id']}\" onClick=\"return confirmDelete();\"> delete </a></td>";
echo "</tr>";
}
}
}
?>
if (isset($_GET['txt']) && ($_GET['txt']) == 1) {
if (isset($_GET['sorteer_desc'])){
$result = get_db_by_sorteren ($value1, $value2, $sorteer_desc_var);
$nummer = mysql_num_rows($result);
while ($verleng = mysql_fetch_array($result)) {
echo "<tr>"; //colspan aanpassen
echo "<td colspan=\"4\">" . $verleng['id'] . "; ";
echo "" . $verleng['veld1'] . "; ";
echo "" . $verleng['veld2'] . "; ";
echo "" . $verleng['veld3'] . "; </td>";
echo "<td> <a href=\"wijzigen.php?wijzigid={$verleng['id']}\"> wijzig </a></td>";
echo "<td> <a href=\"delete.php?deleteid={$verleng['id']}\" onClick=\"return confirmDelete();\"> delete </a></td>";
echo "</tr>";
}
}
if(isset($_GET['sorteer_asc'])) {
$result = get_db ($value1, $value2, $sorteer_asc_var);
$nummer = mysql_num_rows($result);
while ($verleng = mysql_fetch_array($result)) {
echo "<tr>"; //colspan aanpassen
echo "<td colspan=\"4\">" . $verleng['id'] . "; ";
echo "" . $verleng['veld1'] . "; ";
echo "" . $verleng['veld2'] . "; ";
echo "" . $verleng['veld3'] . "; </td>";
echo "<td> <a href=\"wijzigen.php?wijzigid={$verleng['id']}\"> wijzig </a></td>";
echo "<td> <a href=\"delete.php?deleteid={$verleng['id']}\" onClick=\"return confirmDelete();\"> delete </a></td>";
echo "</tr>";
}
}
} else {
if (isset($_GET['sorteer_desc'])) {
$result = get_db_by_sorteren ($value1, $value2, $sorteer_desc_var);
$nummer = mysql_num_rows($result);
$count1 = $value1;
$count1 ++;
while ($verleng = mysql_fetch_array($result)) {
echo"<tr>";
echo "<td>" . $verleng['id'] . "</td>";
echo "<td>" . $verleng['veld1'] . "</td>";
echo "<td>" . $verleng['veld2'] . "</td>";
echo "<td>" . $verleng['veld3'] . "</td>";
echo "<td> <a href=\"wijzigen.php?wijzigid={$verleng['id']}\"> wijzig </a></td>";
echo "<td> <a href=\"delete.php?deleteid={$verleng['id']}\" onClick=\"return confirmDelete();\"> delete </a></td>";
echo "</tr>";
}
}
if(isset($_GET['sorteer_asc'])) {
$result = get_db ($value1, $value2, $sorteer_asc_var);
$nummer = mysql_num_rows($result);
$count1 = $value1;
$count1 ++;
while ($verleng = mysql_fetch_array($result)) {
echo"<tr>";
echo "<td>" . $verleng['id'] . "</td>";
echo "<td>" . $verleng['veld1'] . "</td>";
echo "<td>" . $verleng['veld2'] . "</td>";
echo "<td>" . $verleng['veld3'] . "</td>";
echo "<td> <a href=\"wijzigen.php?wijzigid={$verleng['id']}\"> wijzig </a></td>";
echo "<td> <a href=\"delete.php?deleteid={$verleng['id']}\" onClick=\"return confirmDelete();\"> delete </a></td>";
echo "</tr>";
}
}
}
?>
</table>
</div>