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
|
<? require("inc/menu.php"); require("inc/html.php"); require("inc/common.php");
$config=getconfig();
$output="";
if (isset($_GET["visit"])) { doquery("update user set lastcheck = now() where id = ".intval($_COOKIE["userid"])); }
$output.="Welcome, ".$_COOKIE["username"]."\n<P>\n";
$result=doquery("select movie.id as movieid, movie.title, date_format(movie.insertdate,\"".$config["dateformat"]."\") as insertdate, concat(u.fname, \" \", u.lname) as name, u.id as userid from movie, user u, user u2 where movie.insertdate > u2.lastcheck and movie.userid = u.id and u2.id = ".intval($_COOKIE["userid"])." and u.id != ".intval($_COOKIE["userid"])." order by u.fname, movie.title");
$rowcount=mysql_num_rows($result);
if ($rowcount==0) { $output.="There have been no new movies entered since you last checked.\n"; } else { if ($rowcount==1) { $output.="Since your last visit there has been just 1 new movie added: (Click <A HREF=\"index.php?visit=true\">here</A> to clear this list.)\n"; } else { $output.="Since your last visit there have been ".$rowcount." new movies added: (Click <A HREF=\"index.php?visit=true\">here</A> to clear this list.)\n"; } $output.="<P>\n";
$lastname=""; $rows=""; while ($row=mysql_fetch_assoc($result)) { if ($lastname==$row["name"]) { $rows.=tr(td().td("<A HREF=\"viewmovie.php?movieid=".$row["movieid"]."\">"".htmlspecialchars($row["title"]).""</A> on ".$row["insertdate"])); } else { if (!saneempty($lastname)) { $rows.=tr(td().td()); } $rows.=tr(td("<A HREF=\"listmovies.php?userid=".$row["userid"]."\">".$row["name"]."</A> added ").td("<A HREF=\"viewmovie.php?movieid=".$row["movieid"]."\">"".htmlspecialchars($row["title"]).""</A> on ".$row["insertdate"])); } $lastname=$row["name"]; } $output.=table($rows,0,1,0); }
$content["body"] =& $output; dopage($content); ?>
|