Sessies veranderen??
id | username | mail
------------------------------
1 | big-smoke |[email protected]
2 | dekimme | [email protected]
Nu als ik ingelogd ben met big-smoke en dus een sessie heb met big-smoke als uername en id1. Maar als ik nu pm naar user 2 dus dekimme veranderd mijn sessie om de een of andere rede en ben ik ingelogd met id1 maar met username dekimme en email [email protected]. Ik weet niet of het hier aan ligt maar dit is m'n pm scriptje:
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
<?php
session_start();
include ('connect.inc.php');
$tijd = date("H:i");
//nederlandse datum opstellen
if ($_SESSION['login'] != true){
die("Unable to open the page you need to login first.");
}
$dagvanweek = date("l");
$arraydag = array("Sunday", "Monday", "Tuesday",
"Wednesday", "Thursday",
"Friday", "Saturday");
$dagvanweek = $arraydag[date("w")];
$arraymaand = array("January", "February", "March", "April", "May",
"June", "July", "August", "September",
"Octobre", "November", "December");
$datum = date("j ") . $arraymaand[date("n") - 1] . date(" Y");
if(isset($_POST['Submit'])) { //als er op submit is gedrukt
//checken of alles ingevuld is
if ($_POST['titel'] == "")
$error ="Jou need to fill in a title!";
elseif ($_POST['bericht'] == "")
$error = "Fill in a message!";
if ($error)
{ //als er iets niet is ingevuld...
?><div align="center"><table width="50%"
cellspacing="0" cellpadding="2">
<tr>
<td height="36">
<div align="center"><font color="#000000" face="Verdana,
Arial, Helvetica, sans-serif" size="1"><div align=center>
<font color=black size=-1 face=verdana><b><? echo $error; ?></b>
<br></font></div></font></div>
<form method="post" action="javascript:history.go(-1)">
<div align=center><input type="submit" name="Terug"
value="Back"></div>
</form></td></tr></table></div>
<?php
}
elseif (!$error) //als alles is ingevuld ...
{
$titel = addslashes($_POST['titel']);
$bericht = $_POST['bericht'];
$bericht = htmlspecialchars($_POST['bericht'],ENT_QUOTES);
$bericht = addslashes($bericht);
$bericht = nl2br($bericht);
$bericht = str_replace("<br />", "", $bericht);
$jenickname =stripslashes($_SESSION['username']);
$jeid = $_SESSION['id'];
$nummer = $_POST['nummer'];
$que = "SELECT * FROM members WHERE id='$nummer'";
$rec = mysql_query($que) or die(mysql_error());
while ($obj = mysql_fetch_object($rec)) {
$wie = $obj->username;
$wie = strtolower($wie);
}
$query = "INSERT INTO berichten (titel, wie, bericht, datum,
tijd, van, vanid) VALUES ('$titel', '$wie', '$bericht', '$datum',
'$tijd', '$jenickname', '$jeid')";
mysql_query($query) or die (mysql_error());
echo "<font face=verdana size=1>The message has been send.";
}
}
else
{
?>
<form name="formulier" method="post" action="">
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td>
<font face="Verdana, Arial, Helvetica, sans-serif" size="1">To id
:</font></div>
</td>
</tr>
<tr>
<td>
<font face="Verdana, Arial, Helvetica, sans-serif" size="1">
<? if(is_numeric($_GET['id'])){
$postid = $_GET['id'];
}else{
sleep(2);
echo "That is not a valid id.";
$postid = "";
}?>
<input type="text" name="nummer" value="<? echo $postid; ?>"> [<a href=memberlist.php target=_blank>find id</a>]
</font></div>
</td>
</tr>
<tr>
<td>
<font face="Verdana, Arial, Helvetica, sans-serif" size="1">Title:</font></div>
</td>
</tr>
<tr>
<td>
<font face="Verdana, Arial, Helvetica, sans-serif" size="1">
<input type="text" name="titel" size="50" maxlength="50">
</font></div>
</td>
</tr>
<tr>
<td>
<font face="Verdana, Arial, Helvetica, sans-serif" size="1">Message:</font></div>
</td>
</tr>
<tr>
<td>
<a href="#" onclick="document.add.bericht.value+=' [url=http://][/url]'" title="[link=http://]Description[/link]">[URL]</a>
<a href="#" onclick="document.add.bericht.value+='[img]http://[/img]'" title="[img]http://[/img]">[IMAGE]</a>
<a href="#" onclick="document.add.bericht.value+='[b][/b]'" title="[b]Text[/b]">[<b>BOLD TEXT</b>]</a>
<a href="#" onclick="document.add.bericht.value+='[i][/i]'" title="[i]Text[/i]">[<i>ITALIC TEXT</i>]</a>
<a href="#" onclick="document.add.bericht.value+='[u][/u]'" title="[u]Text[/u]">[<u>UNDERLINED TEXT</u>]</a><br>
<textarea name="bericht" cols="60" rows="20" class="input"></textarea><br>
<a href="#" onclick="document.add.bericht.value+=':arrow:'"><img src="smiles/icon_arrow.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':D'"><img src="smiles/icon_biggrin.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':S'"><img src="smiles/icon_confused.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+='8)'"><img src="smiles/icon_cool.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':*('"><img src="smiles/icon_cry.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':D'"><img src="smiles/icon_biggrin.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':shock:'"><img src="smiles/icon_eek.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':evil:'"><img src="smiles/icon_evil.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':!:'"><img src="smiles/icon_exclaim.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+='^:('"><img src="smiles/icon_frown.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':lol:'"><img src="smiles/icon_lol.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':x'"><img src="smiles/icon_mad.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':mrgreen:'"><img src="smiles/icon_mrgreen.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':|'"><img src="smiles/icon_neutral.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':?'"><img src="smiles/icon_question.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':P'"><img src="smiles/icon_razz.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':oops:'"><img src="smiles/icon_redface.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':roll:'"><img src="smiles/icon_rolleyes.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+='::('"><img src="smiles/icon_sad.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':)'"><img src="smiles/icon_smile.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':o'"><img src="smiles/icon_surprised.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':twisted:'"><img src="smiles/icon_twisted.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':wink:'"><img src="smiles/icon_wink.gif" border="0" /></a>
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
<input type="submit" name="Submit" value="Send message">
<input type="reset" name="Reset" value="Reset">
</div>
</td>
</tr>
</table>
</form>
<?php
}
?>
session_start();
include ('connect.inc.php');
$tijd = date("H:i");
//nederlandse datum opstellen
if ($_SESSION['login'] != true){
die("Unable to open the page you need to login first.");
}
$dagvanweek = date("l");
$arraydag = array("Sunday", "Monday", "Tuesday",
"Wednesday", "Thursday",
"Friday", "Saturday");
$dagvanweek = $arraydag[date("w")];
$arraymaand = array("January", "February", "March", "April", "May",
"June", "July", "August", "September",
"Octobre", "November", "December");
$datum = date("j ") . $arraymaand[date("n") - 1] . date(" Y");
if(isset($_POST['Submit'])) { //als er op submit is gedrukt
//checken of alles ingevuld is
if ($_POST['titel'] == "")
$error ="Jou need to fill in a title!";
elseif ($_POST['bericht'] == "")
$error = "Fill in a message!";
if ($error)
{ //als er iets niet is ingevuld...
?><div align="center"><table width="50%"
cellspacing="0" cellpadding="2">
<tr>
<td height="36">
<div align="center"><font color="#000000" face="Verdana,
Arial, Helvetica, sans-serif" size="1"><div align=center>
<font color=black size=-1 face=verdana><b><? echo $error; ?></b>
<br></font></div></font></div>
<form method="post" action="javascript:history.go(-1)">
<div align=center><input type="submit" name="Terug"
value="Back"></div>
</form></td></tr></table></div>
<?php
}
elseif (!$error) //als alles is ingevuld ...
{
$titel = addslashes($_POST['titel']);
$bericht = $_POST['bericht'];
$bericht = htmlspecialchars($_POST['bericht'],ENT_QUOTES);
$bericht = addslashes($bericht);
$bericht = nl2br($bericht);
$bericht = str_replace("<br />", "", $bericht);
$jenickname =stripslashes($_SESSION['username']);
$jeid = $_SESSION['id'];
$nummer = $_POST['nummer'];
$que = "SELECT * FROM members WHERE id='$nummer'";
$rec = mysql_query($que) or die(mysql_error());
while ($obj = mysql_fetch_object($rec)) {
$wie = $obj->username;
$wie = strtolower($wie);
}
$query = "INSERT INTO berichten (titel, wie, bericht, datum,
tijd, van, vanid) VALUES ('$titel', '$wie', '$bericht', '$datum',
'$tijd', '$jenickname', '$jeid')";
mysql_query($query) or die (mysql_error());
echo "<font face=verdana size=1>The message has been send.";
}
}
else
{
?>
<form name="formulier" method="post" action="">
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td>
<font face="Verdana, Arial, Helvetica, sans-serif" size="1">To id
:</font></div>
</td>
</tr>
<tr>
<td>
<font face="Verdana, Arial, Helvetica, sans-serif" size="1">
<? if(is_numeric($_GET['id'])){
$postid = $_GET['id'];
}else{
sleep(2);
echo "That is not a valid id.";
$postid = "";
}?>
<input type="text" name="nummer" value="<? echo $postid; ?>"> [<a href=memberlist.php target=_blank>find id</a>]
</font></div>
</td>
</tr>
<tr>
<td>
<font face="Verdana, Arial, Helvetica, sans-serif" size="1">Title:</font></div>
</td>
</tr>
<tr>
<td>
<font face="Verdana, Arial, Helvetica, sans-serif" size="1">
<input type="text" name="titel" size="50" maxlength="50">
</font></div>
</td>
</tr>
<tr>
<td>
<font face="Verdana, Arial, Helvetica, sans-serif" size="1">Message:</font></div>
</td>
</tr>
<tr>
<td>
<a href="#" onclick="document.add.bericht.value+=' [url=http://][/url]'" title="[link=http://]Description[/link]">[URL]</a>
<a href="#" onclick="document.add.bericht.value+='[img]http://[/img]'" title="[img]http://[/img]">[IMAGE]</a>
<a href="#" onclick="document.add.bericht.value+='[b][/b]'" title="[b]Text[/b]">[<b>BOLD TEXT</b>]</a>
<a href="#" onclick="document.add.bericht.value+='[i][/i]'" title="[i]Text[/i]">[<i>ITALIC TEXT</i>]</a>
<a href="#" onclick="document.add.bericht.value+='[u][/u]'" title="[u]Text[/u]">[<u>UNDERLINED TEXT</u>]</a><br>
<textarea name="bericht" cols="60" rows="20" class="input"></textarea><br>
<a href="#" onclick="document.add.bericht.value+=':arrow:'"><img src="smiles/icon_arrow.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':D'"><img src="smiles/icon_biggrin.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':S'"><img src="smiles/icon_confused.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+='8)'"><img src="smiles/icon_cool.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':*('"><img src="smiles/icon_cry.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':D'"><img src="smiles/icon_biggrin.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':shock:'"><img src="smiles/icon_eek.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':evil:'"><img src="smiles/icon_evil.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':!:'"><img src="smiles/icon_exclaim.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+='^:('"><img src="smiles/icon_frown.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':lol:'"><img src="smiles/icon_lol.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':x'"><img src="smiles/icon_mad.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':mrgreen:'"><img src="smiles/icon_mrgreen.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':|'"><img src="smiles/icon_neutral.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':?'"><img src="smiles/icon_question.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':P'"><img src="smiles/icon_razz.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':oops:'"><img src="smiles/icon_redface.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':roll:'"><img src="smiles/icon_rolleyes.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+='::('"><img src="smiles/icon_sad.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':)'"><img src="smiles/icon_smile.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':o'"><img src="smiles/icon_surprised.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':twisted:'"><img src="smiles/icon_twisted.gif" border="0" /></a>
<a href="#" onclick="document.add.bericht.value+=':wink:'"><img src="smiles/icon_wink.gif" border="0" /></a>
</td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td>
<input type="submit" name="Submit" value="Send message">
<input type="reset" name="Reset" value="Reset">
</div>
</td>
</tr>
</table>
</form>
<?php
}
?>
http://pastebin.be/989/
btw de javascript werkt ook nog niet maar dat is offtopic.
Gewijzigd op 01/01/1970 01:00:00 door Big-smoke
Kan iemand helpen ik zie echt niet waarom die sessies veranderen?
zoek sessions op:
$_SESSION['session_naam']="de waarde";
kijk waar hij de 'nieuwe' waarde van username toekent, via de acties die je uitvoert. Dan kom je er heel snel achter.
de sessie blijft hetzelfde over geheel de pagina
ik had eerst in m'n script dezelfde $var als dat m'n sessie heette ( $_SESSION['var'] ). Toen werd het ook veranderd om de een of andere reden. Misschien moet je daar even op controleren..