hier mal mein auszug
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
function &makeasread($athr, $aunick) {
global $root;
$dbconnect = $root->con();
$globaluser = new user();
$ts = time();
$zru = $globaluser->zeilen_reg_user();
$rulr = mysql_query("select * from reg_user where reg_nick = '".$aunick."'");
$c = 0;
while(($rows = mysql_fetch_array($rulr)) && $c < $zru) {
$lastreadarray = $rows['lastread'];
if(empty($lastreadarray)) {
$lastreadarray = "\"$athr\" => \"$ts\"";
$ac = mysql_query("update reg_user set lastread = '".$lastreadarray."' where reg_nick = '".$aunick."'");
return TRUE;
exit;
}
if(!empty($lastreadarray)) {
eval("\$lastreadarray = array(".$lastreadarray.");");
foreach($lastreadarray as $key => $elem) {
if($key != $athr) {
if(empty($newlastreadarray)) {
$newlastreadarray .= "\"$key\" => \"$elem\"";
}
if(!empty($newlastreadarray)) {
$newlastreadarray .= ", \"$key\" => \"$elem\"";
}
}
}
if(!empty($newlastreadarray)) {
$newlastreadarray = $newlastreadarray.", \"$athr\" => \"$ts\"";
$ac = mysql_query("update reg_user set lastread = '".$newlastreadarray."' where reg_nick = '".$aunick."'");
return TRUE;
exit;
}
if(empty($newlastreadarray)) {
$newlastreadarray = "\"$athr\" => \"$ts\"";
$ac = mysql_query("update reg_user set lastread = '".$newlastreadarray."' where reg_nick = '".$aunick."'");
return TRUE;
exit;
}
}
}
}
sorry falls es etwas wüst ist aber ich lerne erst seit ca. 3 wochen php
gruss
J33d3X