Hoi ik ben (nog steeds) bezig met een admin script!
Krijg een parse error op regel 2?
Enne alle verbeteringen welkom!
Want ik kom er heel moeizaam uit allemaal...
Krijg een parse error op regel 2?
Enne alle verbeteringen welkom!
Want ik kom er heel moeizaam uit allemaal...
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
| <? if (isset($HTTP_POST_VARS["CheckboxName"])) { // Isset erbij if ( $checkboxName != '' ) { //conect to mySQL include ("function.php"); connect(); //ban if ( $HTTP_POST_VARS['ban'] ){ $banned = 1; $sql = "UPDATE members set banned='$banned' WHERE username='$username'"; echo "You banned $username"; echo "<a href=\"javascript:history.go(-1)\">Back</a>"; } //delete if ( $HTTP_POST_VARS['delete'] ){ $sql = "DELETE FROM members WHERE username='$username'"; echo "Deleted $username"; echo "<a href=\"javascript:history.go(-1)\">Back</a>"; } } else { echo 'Nothing selected.'; } } else { //Html header ?> <html><head><title>Admin page</title></head><body><form> <table border='0' cellpadding='0' cellspacing='0' width='100%'><tr> <td width='3%'></td> <td width='12%'>Username</td> <td width='10%'>Password</td> <td width='18%'>Name</td> <td width='19%'>E-mail</td> <td width='30%'>Ip-adres</td> <td width='5%'>Banned</td> </tr></table> <? //querie $sql = "SELECT * FROM members ORDER BY id DESC"; $sql2 = mysql_query($sql); while ($record = mysql_fetch_object($sql2)) { //data from database $username = "$record->username"; $password = "$record->password"; $name = "$record->name"; $email = "$record->email"; $ip = "$record->ip"; $banned = "$record->banned"; //Template for output print"<!--table for users-->"; print"<table border='0' cellpadding='0' cellspacing='0' width='100%'><tr>"; print"<td width='3%'>"; print"<p align='center'><font size='1' face='Verdana'>"; print"<input type='checkbox' name='select' value='select'></font></p></td>"; print"<td width='12%'>$username</td>"; print"<td width='10%'>$password</td>"; print"<td width='18%'>$name</td>"; print"<td width='19%'>$email</td>"; print"<td width='30%'>$ip</td>"; print"<td width='5%'>$banned</td>"; print"</tr>"; print"</table>"; print"<!--end of table-->"; }//Everything before this is foreach record in db! //html einde en buttons 'ban','delete' ?><table border='0' cellpadding='0' cellspacing='0' width='100%'><tr> <td width='5%'></td><td width='95%'> <form action="admin.php" method="post"> <input type="submit" value="ban" name="ban"> <input type="submit" value="delete" name="delete"> </td></tr></table> </form></body></html> <?}//Else ?> |