mysql_query DELETE werkt niet meer?
Heeft altijd gewerkt, isp heeft wel php4 geupdate naar php5.
En mysql is nu versie 5.
Iemand idee of dit van invloed kan zijn op mijn code?
Ik kan inloggen maar als ik op verwijder of edit klik zie ik niets.
De record wordt ook niet verwijder, id nummer klopt wel.
Met phpmyadmin online bij isp lukt het wel.
IE opent wel een nieuwe pagina maar ik zie geen data uit mijn database.
Geprobeerd op xp en vista beide internet explorer versie 7.
thanks en gr..
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
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
94
95
96
97
<?php session_start();
include "connect.php";
include "ubb.php";
include "functies.php";
?>
<html>
<head>
<title>Gastenboek</title>
<link rel="stylesheet" type="text/css" href="layout.css">
</head>
<body bgcolor=#0087af>
<body>
<center>
<table bgcolor="#006ba1"><tr>
<td align=center ><b><font color="#000000">Admin Gastenboek-Creasoft</font></b></td>
</tr></table><br>
<?php
$admin = "******";
$wachtwoord = "******";
//uitloggen
if (isset($uitloggen)) { session_destroy();
echo "<script>location.href='index.php'</script>"; }
//logincheck
if ($_POST['login']) {
if ($_POST['naam'] == $admin AND $_POST['wachtwoord'] == $wachtwoord){
session_register(gastenboekadmin);
} else { echo "<table><tr><td align=center><b>Ongeldig Login of Wachtwoord!</b></td></tr></table><br>";}}
//ff kijken of sessie is aangemaakt
if(session_is_registered("gastenboekadmin")){
//bericht edit-form
if (isset($editid)) {
$sql = "SELECT * FROM gastenboek WHERE id='$editid'";
$resultaat = mysql_query($sql) or die ("query mislukt");
$rij = mysql_fetch_object($resultaat);
$naam = htmlspecialchars($rij->naam);
$email = htmlspecialchars($rij->email);
$homepage = htmlspecialchars($rij->homepage);
$bericht = htmlspecialchars($rij->bericht);
$naam = breaktxt($naam,10,15);
//$bericht = shorttxt($bericht,50);
$bericht = cut_words($bericht,20);
?>
<table><form method="post" action="<? echo "$PHP_SELF"; ?>" name="gastenboek"><input type="hidden" name="editid" value="<? echo "$editid"; ?>">
<tr><td><b><font color="#000000">Bewerken</font></b></td></tr>
<tr><td width="70">Naam:</td><td width="250"><input type="text" name="naam" size="50" value="<? echo "$naam"; ?>"></td></tr>
<tr><td width="70">Email:</td><td width="250"><input type="text" name="email" size="50" value="<? echo "$email"; ?>"></td></tr>
<tr><td width="70">Homepage:</td><td width="250"><input type="text" name="homepage" size="50" value="<? echo "$homepage"; ?>"></td></tr>
<tr><td valign="top">Reactie:</td><td><textarea name="bericht" cols="49" rows="5"><? echo "$bericht"; ?></textarea><br></td></tr>
<tr><td></td><td><input type="submit" name="submit" value="wijzigen"></td></tr></form></table><br>
<? }
//bericht deleten
if (isset($deleteid)) {
mysql_query ("DELETE FROM gastenboek WHERE id='$deleteid'"); }
//bericht editen
if ($_POST['submit']) {
mysql_query("UPDATE gastenboek SET naam='".$_POST[naam]."',email='".$_POST[email]."',homepage='".$_POST[homepage]."',bericht='".$_POST[bericht]."' WHERE id = '".$editid."'") or die(mysql_error());
echo "<script>location.href='$PHP_SELF'</script>";}
//alle berichten weergeven ?>
<? $sql = "SELECT * FROM gastenboek ORDER BY datum DESC";
$resultaat = mysql_query($sql) or die ("query mislukt");?>
<?php while ($rij = mysql_fetch_object($resultaat)){
$naam = htmlspecialchars($rij->naam);
$email = htmlspecialchars($rij->email);
$homepage = htmlspecialchars($rij->homepage);
$bericht = htmlspecialchars($rij->bericht);
//set_smilies($bericht);
$naam = breaktxt($naam,10,15);
//$bericht = shorttxt($bericht,50);
$bericht = cut_words($bericht,20);
echo "<table><tr><td width=30><a href=$PHP_SELF?editid=".$rij->id."><img src=\"smilies/edit.png\" border=\"0\"></a><a href=$PHP_SELF?deleteid=".$rij->id."> <br>
<img src=\"smilies/del.png\" border=\"0\"></a></td><td width=100><a href=mailto:".$email."><b>".$naam."</b></a><br><font size=1>";
if ($homepage=="" OR $homepage=="http://") {} else {
echo "<a href=\"".$homepage."\" target=\"_blan\">website</a>"; }
echo"</font></td><td width=220>".$bericht."</td></tr></table><br>"; }
echo "<a href=$PHP_SELF?uitloggen=0>Log uit</a>";
} else
{ //login-form ?>
<table width="400"><form method="post" action="admin.php">
<tr>
<td width="100"><b><font color="#000000">Inloggen</font></b></td>
<td width="250"></td></tr>
<tr><td>Naam:</td><td><input type="text" name="naam" size="35"></td></tr>
<tr><td>Wachtwoord:</td><td><input type="password" name="wachtwoord" size="35"></td></tr>
<tr><td></td><td><input type="submit" name="login" value="login"></td></tr>
</form></table>
<?php } ?>
</center></body>
</html>
include "connect.php";
include "ubb.php";
include "functies.php";
?>
<html>
<head>
<title>Gastenboek</title>
<link rel="stylesheet" type="text/css" href="layout.css">
</head>
<body bgcolor=#0087af>
<body>
<center>
<table bgcolor="#006ba1"><tr>
<td align=center ><b><font color="#000000">Admin Gastenboek-Creasoft</font></b></td>
</tr></table><br>
<?php
$admin = "******";
$wachtwoord = "******";
//uitloggen
if (isset($uitloggen)) { session_destroy();
echo "<script>location.href='index.php'</script>"; }
//logincheck
if ($_POST['login']) {
if ($_POST['naam'] == $admin AND $_POST['wachtwoord'] == $wachtwoord){
session_register(gastenboekadmin);
} else { echo "<table><tr><td align=center><b>Ongeldig Login of Wachtwoord!</b></td></tr></table><br>";}}
//ff kijken of sessie is aangemaakt
if(session_is_registered("gastenboekadmin")){
//bericht edit-form
if (isset($editid)) {
$sql = "SELECT * FROM gastenboek WHERE id='$editid'";
$resultaat = mysql_query($sql) or die ("query mislukt");
$rij = mysql_fetch_object($resultaat);
$naam = htmlspecialchars($rij->naam);
$email = htmlspecialchars($rij->email);
$homepage = htmlspecialchars($rij->homepage);
$bericht = htmlspecialchars($rij->bericht);
$naam = breaktxt($naam,10,15);
//$bericht = shorttxt($bericht,50);
$bericht = cut_words($bericht,20);
?>
<table><form method="post" action="<? echo "$PHP_SELF"; ?>" name="gastenboek"><input type="hidden" name="editid" value="<? echo "$editid"; ?>">
<tr><td><b><font color="#000000">Bewerken</font></b></td></tr>
<tr><td width="70">Naam:</td><td width="250"><input type="text" name="naam" size="50" value="<? echo "$naam"; ?>"></td></tr>
<tr><td width="70">Email:</td><td width="250"><input type="text" name="email" size="50" value="<? echo "$email"; ?>"></td></tr>
<tr><td width="70">Homepage:</td><td width="250"><input type="text" name="homepage" size="50" value="<? echo "$homepage"; ?>"></td></tr>
<tr><td valign="top">Reactie:</td><td><textarea name="bericht" cols="49" rows="5"><? echo "$bericht"; ?></textarea><br></td></tr>
<tr><td></td><td><input type="submit" name="submit" value="wijzigen"></td></tr></form></table><br>
<? }
//bericht deleten
if (isset($deleteid)) {
mysql_query ("DELETE FROM gastenboek WHERE id='$deleteid'"); }
//bericht editen
if ($_POST['submit']) {
mysql_query("UPDATE gastenboek SET naam='".$_POST[naam]."',email='".$_POST[email]."',homepage='".$_POST[homepage]."',bericht='".$_POST[bericht]."' WHERE id = '".$editid."'") or die(mysql_error());
echo "<script>location.href='$PHP_SELF'</script>";}
//alle berichten weergeven ?>
<? $sql = "SELECT * FROM gastenboek ORDER BY datum DESC";
$resultaat = mysql_query($sql) or die ("query mislukt");?>
<?php while ($rij = mysql_fetch_object($resultaat)){
$naam = htmlspecialchars($rij->naam);
$email = htmlspecialchars($rij->email);
$homepage = htmlspecialchars($rij->homepage);
$bericht = htmlspecialchars($rij->bericht);
//set_smilies($bericht);
$naam = breaktxt($naam,10,15);
//$bericht = shorttxt($bericht,50);
$bericht = cut_words($bericht,20);
echo "<table><tr><td width=30><a href=$PHP_SELF?editid=".$rij->id."><img src=\"smilies/edit.png\" border=\"0\"></a><a href=$PHP_SELF?deleteid=".$rij->id."> <br>
<img src=\"smilies/del.png\" border=\"0\"></a></td><td width=100><a href=mailto:".$email."><b>".$naam."</b></a><br><font size=1>";
if ($homepage=="" OR $homepage=="http://") {} else {
echo "<a href=\"".$homepage."\" target=\"_blan\">website</a>"; }
echo"</font></td><td width=220>".$bericht."</td></tr></table><br>"; }
echo "<a href=$PHP_SELF?uitloggen=0>Log uit</a>";
} else
{ //login-form ?>
<table width="400"><form method="post" action="admin.php">
<tr>
<td width="100"><b><font color="#000000">Inloggen</font></b></td>
<td width="250"></td></tr>
<tr><td>Naam:</td><td><input type="text" name="naam" size="35"></td></tr>
<tr><td>Wachtwoord:</td><td><input type="password" name="wachtwoord" size="35"></td></tr>
<tr><td></td><td><input type="submit" name="login" value="login"></td></tr>
</form></table>
<?php } ?>
</center></body>
</html>
Gewijzigd op 01/01/1970 01:00:00 door Henk
Waar loopt hij vast? Wat doet het niet meer? Welke errors geeft hij (of zij)?
Edit: En zet je error reporting een aan.
Code (php)
1
2
3
4
5
6
2
3
4
5
6
<?php
ini_set('display_errors', 1); // 0 = uit, 1 = aan
error_reporting(E_ALL);
// rest
?>
ini_set('display_errors', 1); // 0 = uit, 1 = aan
error_reporting(E_ALL);
// rest
?>
Gewijzigd op 01/01/1970 01:00:00 door - SanThe -
Notice: Undefined index: login in /home/creasoft.nl/www/guestbook/admin.php on line 28
bedankt beide, kijken of ik kan oplossen.
gr Henk..
Edit:
en deze als ik na het inloggen de admin pagina open.
btw toevoegen aan de database lukt wel..
de errors bij admin
Notice: Use of undefined constant gastenboekadmin - assumed 'gastenboekadmin' in /home/creasoft.nl/www/guestbook/admin.php on line 30
Notice: Undefined index: submit in /home/creasoft.nl/www/guestbook/admin.php on line 63
Notice: Undefined variable: PHP_SELF in /home/creasoft.nl/www/guestbook/admin.php on line 82
Notice: Undefined variable: PHP_SELF in /home/creasoft.nl/www/guestbook/admin.php on line 82
en deze als ik na het inloggen de admin pagina open.
btw toevoegen aan de database lukt wel..
de errors bij admin
Notice: Use of undefined constant gastenboekadmin - assumed 'gastenboekadmin' in /home/creasoft.nl/www/guestbook/admin.php on line 30
Notice: Undefined index: submit in /home/creasoft.nl/www/guestbook/admin.php on line 63
Notice: Undefined variable: PHP_SELF in /home/creasoft.nl/www/guestbook/admin.php on line 82
Notice: Undefined variable: PHP_SELF in /home/creasoft.nl/www/guestbook/admin.php on line 82
Gewijzigd op 01/01/1970 01:00:00 door Henk
session_register is trouwens antiek.
dat zeg je altijd :p maar 't is wel zo :p
bool session_register ( mixed $name [, mixed $...] )
session_register() accepts a variable number of arguments, any of which can be either a string holding the name of a variable or an array consisting of variable names or other arrays. For each name, session_register() registers the global variable with that name in the current session.
Let op
If you want your script to work regardless of register_globals, you need to instead use the $_SESSION array as $_SESSION entries are automatically registered. If your script uses session_register(), it will not work in environments where the PHP directive register_globals is disabled.
register_globals: important note: Since PHP 4.2.0, the default value for the PHP directive register_globals is off, and it is completely removed as of PHP 6.0.0. The PHP community encourages all to not rely on this directive but instead use other means, such as the superglobals.
Let op
This registers a global variable. If you want to register a session variable from within a function, you need to make sure to make it global using the global keyword or the $GLOBALS[] array, or use the special session arrays as noted below.
Let op
If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use session_register(), session_is_registered(), and session_unregister().
This function returns TRUE when all of the variables are successfully registered with the session.
SanThe schreef op 18.05.2007 19:23:
Description
bool session_register ( mixed $name [, mixed $...] )
session_register() accepts a variable number of arguments, any of which can be either a string holding the name of a variable or an array consisting of variable names or other arrays. For each name, session_register() registers the global variable with that name in the current session.
Let op
If you want your script to work regardless of register_globals, you need to instead use the $_SESSION array as $_SESSION entries are automatically registered. If your script uses session_register(), it will not work in environments where the PHP directive register_globals is disabled.
register_globals: important note: Since PHP 4.2.0, the default value for the PHP directive register_globals is off, and it is completely removed as of PHP 6.0.0. The PHP community encourages all to not rely on this directive but instead use other means, such as the superglobals.
Let op
This registers a global variable. If you want to register a session variable from within a function, you need to make sure to make it global using the global keyword or the $GLOBALS[] array, or use the special session arrays as noted below.
Let op
If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use session_register(), session_is_registered(), and session_unregister().
This function returns TRUE when all of the variables are successfully registered with the session.
bool session_register ( mixed $name [, mixed $...] )
session_register() accepts a variable number of arguments, any of which can be either a string holding the name of a variable or an array consisting of variable names or other arrays. For each name, session_register() registers the global variable with that name in the current session.
Let op
If you want your script to work regardless of register_globals, you need to instead use the $_SESSION array as $_SESSION entries are automatically registered. If your script uses session_register(), it will not work in environments where the PHP directive register_globals is disabled.
register_globals: important note: Since PHP 4.2.0, the default value for the PHP directive register_globals is off, and it is completely removed as of PHP 6.0.0. The PHP community encourages all to not rely on this directive but instead use other means, such as the superglobals.
Let op
This registers a global variable. If you want to register a session variable from within a function, you need to make sure to make it global using the global keyword or the $GLOBALS[] array, or use the special session arrays as noted below.
Let op
If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use session_register(), session_is_registered(), and session_unregister().
This function returns TRUE when all of the variables are successfully registered with the session.
ok dat zal het dus zijn, ga ik aanpassen...
thanks...
Code (php)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
$admin = "******";
$wachtwoord = "******";
//uitloggen
if (isset($uitloggen)) { session_destroy();
echo "<script>location.href='index.php'</script>"; }
//logincheck
if ($_POST['login']) {
if ($_POST['naam'] == $admin AND $_POST['wachtwoord'] == $wachtwoord){
session_register(gastenboekadmin);
} else { echo "<table><tr><td align=center><b>Ongeldig Login of Wachtwoord!</b></td></tr></table><br>";}}
//ff kijken of sessie is aangemaakt
if(session_is_registered("gastenboekadmin")){
$wachtwoord = "******";
//uitloggen
if (isset($uitloggen)) { session_destroy();
echo "<script>location.href='index.php'</script>"; }
//logincheck
if ($_POST['login']) {
if ($_POST['naam'] == $admin AND $_POST['wachtwoord'] == $wachtwoord){
session_register(gastenboekadmin);
} else { echo "<table><tr><td align=center><b>Ongeldig Login of Wachtwoord!</b></td></tr></table><br>";}}
//ff kijken of sessie is aangemaakt
if(session_is_registered("gastenboekadmin")){
Ik zal verder opzoek moeten, maar als iemand een idee heeft, dan houd ik mij aanbevolen.
thanks en gr.
Gewijzigd op 01/01/1970 01:00:00 door Henk
Waar komt $uitloggen vandaan?
session_register(gastenboekadmin);
=> $_SESSION['gastenboekadmin'] = '.........';
SanThe schreef op 19.05.2007 14:11:
Superglobals?
Waar komt $uitloggen vandaan?
session_register(gastenboekadmin);
=> $_SESSION['gastenboekadmin'] = '.........';
Waar komt $uitloggen vandaan?
session_register(gastenboekadmin);
=> $_SESSION['gastenboekadmin'] = '.........';
onder bij de volledige code
echo "<a href=$PHP_SELF?uitloggen=0>Log uit</a>";
$_SESSION ga ik doen, thanks
$uitloggen moet dan zijn: $_GET['uitloggen']
Lees eens wat over superglobals.
SanThe schreef op 19.05.2007 14:47:
$PHP_SELF moet zijn: $_SERVER['PHP_SELF']
$uitloggen moet dan zijn: $_GET['uitloggen']
Lees eens wat over superglobals.
$uitloggen moet dan zijn: $_GET['uitloggen']
Lees eens wat over superglobals.
Ben ik aan het doen, ik zal het werkend krijgen(;>)
Krijg nog wel wat foutjes:
zie: http://www.creasoft.nl/guestbook/index.php
kan niets verwijdere of bewerken?
naam test
wachtwoord test
thanks
Edit:
na aanpassing $PHP_SELF moet zijn: $_SERVER['PHP_SELF']
$uitloggen moet dan zijn: $_GET['uitloggen']
krijg ik wit scherm, niets meer dus?
na aanpassing $PHP_SELF moet zijn: $_SERVER['PHP_SELF']
$uitloggen moet dan zijn: $_GET['uitloggen']
krijg ik wit scherm, niets meer dus?
gek mijn boek zegt ook dat het zo moet..
Aangepaste code met wit scherm, geen inlog meer..??
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
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
94
95
96
97
98
99
100
<?php session_start();
include "connect.php";
include "ubb.php";
include "functies.php";
?>
<html>
<head>
<title>Gastenboek</title>
<link rel="stylesheet" type="text/css" href="layout.css">
</head>
<body bgcolor=#0087af>
<body>
<center>
<table bgcolor="#006ba1"><tr>
<td align=center ><b><font color="#000000">Admin Gastenboek-Creasoft</font></b></td>
</tr></table><br>
<?php
ini_set('display_errors', 1); // 0 = uit, 1 = aan
error_reporting(E_ALL);
$admin = "test";
$wachtwoord = "test";
//uitloggen
if ($_GET['uitloggen']) { session_destroy();
echo "<script>location.href='index.php'</script>"; }
//logincheck
if ($_POST['login']) {
if ($_POST['naam'] == $admin AND $_POST['wachtwoord'] == $wachtwoord){
$_SESSION['gastenboekadmin'] = '.........';
} else { echo "<table><tr><td align=center><b>Ongeldig Login of Wachtwoord!</b></td></tr></table><br>";}}
//ff kijken of sessie is aangemaakt
if(session_is_registered("gastenboekadmin")){
//bericht edit-form
if (isset($editid)) {
$sql = "SELECT * FROM gastenboek WHERE id='$editid'";
$resultaat = mysql_query($sql) or die ("query mislukt");
$rij = mysql_fetch_object($resultaat);
$naam = htmlspecialchars($rij->naam);
$email = htmlspecialchars($rij->email);
$homepage = htmlspecialchars($rij->homepage);
$bericht = htmlspecialchars($rij->bericht);
$naam = breaktxt($naam,10,15);
//$bericht = shorttxt($bericht,50);
$bericht = cut_words($bericht,20);
?>
<table><form method="post" action="<? echo "$PHP_SELF"; ?>" name="gastenboek"><input type="hidden" name="editid" value="<? echo "$editid"; ?>">
<tr><td><b><font color="#000000">Bewerken</font></b></td></tr>
<tr><td width="70">Naam:</td><td width="250"><input type="text" name="naam" size="50" value="<? echo "$naam"; ?>"></td></tr>
<tr><td width="70">Email:</td><td width="250"><input type="text" name="email" size="50" value="<? echo "$email"; ?>"></td></tr>
<tr><td width="70">Homepage:</td><td width="250"><input type="text" name="homepage" size="50" value="<? echo "$homepage"; ?>"></td></tr>
<tr><td valign="top">Reactie:</td><td><textarea name="bericht" cols="49" rows="5"><? echo "$bericht"; ?></textarea><br></td></tr>
<tr><td></td><td><input type="submit" name="submit" value="wijzigen"></td></tr></form></table><br>
<? }
//bericht deleten
if (isset($deleteid)) {
mysql_query ("DELETE FROM gastenboek WHERE id='$deleteid'"); }
//bericht editen
if ($_POST['submit']) {
mysql_query("UPDATE gastenboek SET naam='".$_POST[naam]."',email='".$_POST[email]."',homepage='".$_POST[homepage]."',bericht='".$_POST[bericht]."' WHERE id = '".$editid."'") or die(mysql_error());
echo "<script>location.href='$PHP_SELF'</script>";}
//alle berichten weergeven ?>
<? $sql = "SELECT * FROM gastenboek ORDER BY datum DESC";
$resultaat = mysql_query($sql) or die ("query mislukt");?>
<?php while ($rij = mysql_fetch_object($resultaat)){
$naam = htmlspecialchars($rij->naam);
$email = htmlspecialchars($rij->email);
$homepage = htmlspecialchars($rij->homepage);
$bericht = htmlspecialchars($rij->bericht);
//set_smilies($bericht);
$naam = breaktxt($naam,10,15);
//$bericht = shorttxt($bericht,50);
$bericht = cut_words($bericht,20);
echo "<table><tr><td width=30><a href=$PHP_SELF?editid=".$rij->id."><img src=\"smilies/edit.png\" border=\"0\"></a><a href=$PHP_SELF?deleteid=".$rij->id."> <br>
<img src=\"smilies/del.png\" border=\"0\"></a></td><td width=100><a href=mailto:".$email."><b>".$naam."</b></a><br><font size=1>";
if ($homepage=="" OR $homepage=="http://") {} else {
echo "<a href=\"".$homepage."\" target=\"_blan\">website</a>"; }
echo"</font></td><td width=220>".$bericht."</td></tr></table><br>"; }
echo "<a href=$_SERVER['PHP_SELF']?uitloggen=0>Log uit</a>";
} else
{ //login-form ?>
<table width="400"><form method="post" action="admin.php">
<tr>
<td width="100"><b><font color="#000000">Inloggen</font></b></td>
<td width="250"></td></tr>
<tr><td>Naam:</td><td><input type="text" name="naam" size="35"></td></tr>
<tr><td>Wachtwoord:</td><td><input type="password" name="wachtwoord" size="35"></td></tr>
<tr><td></td><td><input type="submit" name="login" value="login"></td></tr>
</form></table>
<?php } ?>
</center></body>
</html>
include "connect.php";
include "ubb.php";
include "functies.php";
?>
<html>
<head>
<title>Gastenboek</title>
<link rel="stylesheet" type="text/css" href="layout.css">
</head>
<body bgcolor=#0087af>
<body>
<center>
<table bgcolor="#006ba1"><tr>
<td align=center ><b><font color="#000000">Admin Gastenboek-Creasoft</font></b></td>
</tr></table><br>
<?php
ini_set('display_errors', 1); // 0 = uit, 1 = aan
error_reporting(E_ALL);
$admin = "test";
$wachtwoord = "test";
//uitloggen
if ($_GET['uitloggen']) { session_destroy();
echo "<script>location.href='index.php'</script>"; }
//logincheck
if ($_POST['login']) {
if ($_POST['naam'] == $admin AND $_POST['wachtwoord'] == $wachtwoord){
$_SESSION['gastenboekadmin'] = '.........';
} else { echo "<table><tr><td align=center><b>Ongeldig Login of Wachtwoord!</b></td></tr></table><br>";}}
//ff kijken of sessie is aangemaakt
if(session_is_registered("gastenboekadmin")){
//bericht edit-form
if (isset($editid)) {
$sql = "SELECT * FROM gastenboek WHERE id='$editid'";
$resultaat = mysql_query($sql) or die ("query mislukt");
$rij = mysql_fetch_object($resultaat);
$naam = htmlspecialchars($rij->naam);
$email = htmlspecialchars($rij->email);
$homepage = htmlspecialchars($rij->homepage);
$bericht = htmlspecialchars($rij->bericht);
$naam = breaktxt($naam,10,15);
//$bericht = shorttxt($bericht,50);
$bericht = cut_words($bericht,20);
?>
<table><form method="post" action="<? echo "$PHP_SELF"; ?>" name="gastenboek"><input type="hidden" name="editid" value="<? echo "$editid"; ?>">
<tr><td><b><font color="#000000">Bewerken</font></b></td></tr>
<tr><td width="70">Naam:</td><td width="250"><input type="text" name="naam" size="50" value="<? echo "$naam"; ?>"></td></tr>
<tr><td width="70">Email:</td><td width="250"><input type="text" name="email" size="50" value="<? echo "$email"; ?>"></td></tr>
<tr><td width="70">Homepage:</td><td width="250"><input type="text" name="homepage" size="50" value="<? echo "$homepage"; ?>"></td></tr>
<tr><td valign="top">Reactie:</td><td><textarea name="bericht" cols="49" rows="5"><? echo "$bericht"; ?></textarea><br></td></tr>
<tr><td></td><td><input type="submit" name="submit" value="wijzigen"></td></tr></form></table><br>
<? }
//bericht deleten
if (isset($deleteid)) {
mysql_query ("DELETE FROM gastenboek WHERE id='$deleteid'"); }
//bericht editen
if ($_POST['submit']) {
mysql_query("UPDATE gastenboek SET naam='".$_POST[naam]."',email='".$_POST[email]."',homepage='".$_POST[homepage]."',bericht='".$_POST[bericht]."' WHERE id = '".$editid."'") or die(mysql_error());
echo "<script>location.href='$PHP_SELF'</script>";}
//alle berichten weergeven ?>
<? $sql = "SELECT * FROM gastenboek ORDER BY datum DESC";
$resultaat = mysql_query($sql) or die ("query mislukt");?>
<?php while ($rij = mysql_fetch_object($resultaat)){
$naam = htmlspecialchars($rij->naam);
$email = htmlspecialchars($rij->email);
$homepage = htmlspecialchars($rij->homepage);
$bericht = htmlspecialchars($rij->bericht);
//set_smilies($bericht);
$naam = breaktxt($naam,10,15);
//$bericht = shorttxt($bericht,50);
$bericht = cut_words($bericht,20);
echo "<table><tr><td width=30><a href=$PHP_SELF?editid=".$rij->id."><img src=\"smilies/edit.png\" border=\"0\"></a><a href=$PHP_SELF?deleteid=".$rij->id."> <br>
<img src=\"smilies/del.png\" border=\"0\"></a></td><td width=100><a href=mailto:".$email."><b>".$naam."</b></a><br><font size=1>";
if ($homepage=="" OR $homepage=="http://") {} else {
echo "<a href=\"".$homepage."\" target=\"_blan\">website</a>"; }
echo"</font></td><td width=220>".$bericht."</td></tr></table><br>"; }
echo "<a href=$_SERVER['PHP_SELF']?uitloggen=0>Log uit</a>";
} else
{ //login-form ?>
<table width="400"><form method="post" action="admin.php">
<tr>
<td width="100"><b><font color="#000000">Inloggen</font></b></td>
<td width="250"></td></tr>
<tr><td>Naam:</td><td><input type="text" name="naam" size="35"></td></tr>
<tr><td>Wachtwoord:</td><td><input type="password" name="wachtwoord" size="35"></td></tr>
<tr><td></td><td><input type="submit" name="login" value="login"></td></tr>
</form></table>
<?php } ?>
</center></body>
</html>
Gewijzigd op 01/01/1970 01:00:00 door Henk
moet zijn
if(isset($_SESSION['gastenboekadmin']) and ($_SESSION['gastenboekadmin'] == '.........')){
if (isset($editid)) {
waar komt $editid vandaan?
SanThe schreef op 19.05.2007 18:43:
if(session_is_registered("gastenboekadmin")){
moet zijn
if(isset($_SESSION['gastenboekadmin']) and ($_SESSION['gastenboekadmin'] == '.........')){
if (isset($editid)) {
waar komt $editid vandaan?
moet zijn
if(isset($_SESSION['gastenboekadmin']) and ($_SESSION['gastenboekadmin'] == '.........')){
if (isset($editid)) {
waar komt $editid vandaan?
Ok, nogmaals dank..
ps: ik probeer het ook zelf hoor(;>)
Maar 2 manieren lopen nu door elkaar, uitvogelen dus..geeft niks, leuk werk.
$editid staat hier, bepaald welke record(nr) bewerkt moet worden.
echo "<table><tr><td width=30><a href=$PHP_SELF?editid=".$rij->id."><img src=\"smilies/edit.png\" border=\"0\"></a><a href=$PHP_SELF?deleteid=".$rij->id."> <br>
Onder in source. gr
Gewijzigd op 01/01/1970 01:00:00 door Henk
En $PHP_SELF moet $_SERVER['PHP_SELF'] zijn.