C:\$Recycle.Bin\S-1-5-21-3967099092-2644009230-141905953-500\$R24B99I\web\print.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
<? 
$nocheck
=TRUE;
require(
"inc/menu.php");
require(
"inc/html.php");
require(
"inc/common.php");

$config=getconfig();

$output="";
$nav="";
$direction="";
$ownedby="";
$genre="";
$filter="";
$url="";

$fields="u.fname, m.title, m.director, m.author, m.sound, m.comments, m.extra, m.genreid, m.reldate, m.runtime, m.rating";
$from="movie m, user u";
$where="m.userid = u.id";
$orderby="m.title";

if (!
saneempty($_GET["userid"])) {
    
$ownedby=mysql_result(doquery("select concat(fname, \" \", lname) from user where id = ".intval($_GET["userid"])),0);
    
$filter[]="<B>Owner:</B> ".$ownedby;
    
$where.=" and m.userid = ".intval($_GET["userid"]);
}
if (!
saneempty($_GET["genreid"])) {
    
$genre=mysql_result(doquery("select name from genre where id = ".intval($_GET["genreid"])),0);
    
$filter[]="<B>Genre:</B> ".$genre;
    
$where.=" and find_in_set(".intval($_GET["genreid"]).",m.genreid)";
}
if (!
saneempty($_GET["year"])) {
    
$filter[]="<B>Released year:</B> ".intval($_GET["year"]);
    
$where.=" and m.reldate = ".intval($_GET["year"]);
}
if (!
saneempty($_GET["region"])) {
    
$filter[]="<B>Region:</B> ".intval($_GET["region"]);
    
$where.=" and m.region = ".intval($_GET["region"]);
    if (
saneempty($_GET["media"])) {
        
$filter[]="<B>Media:</B> DVD";
        
$where.=" and m.mediaid = 1";
    }
}
if (!
saneempty($_GET["media"])) {
    
$medianame=mysql_result(doquery("select name from media where id = ".intval($_GET["media"])),0);
    
$filter[]="<B>Media:</B> ".$medianame;
    
$where.=" and m.mediaid = ".intval($_GET["media"]);
}

if (!
saneempty($_GET["skeywords"])) {
    
$filter[]="<B>Search for:</B> ".$_GET["s"];
    if (
intval($config["mysqlversion"])>=4.0) {
        
$where.=" and (match(m.title) against (\"".greatescape($_GET["skeywords"])."\" IN BOOLEAN MODE) or match(m.comments) against (\"".greatescape($_GET["skeywords"])."\" IN BOOLEAN MODE) or match(m.extra) against (\"".greatescape($_GET["skeywords"])."\" IN BOOLEAN MODE))";
    } else {
        
$where.=" and (match(m.title) against (\"".greatescape($_GET["skeywords"])."\") or match(m.comments) against (\"".greatescape($_GET["skeywords"])."\") or match(m.extra) against (\"".greatescape($_GET["skeywords"])."\"))";
    }
}

if (!
saneempty($_GET["spersons"])) {
    
$filter[]="<B>Search for:</B> ".$_GET["s"];
    if (
intval($config["mysqlversion"])>=4.0) {
        
$where.=" and (match(m.director) against (\"".greatescape($_GET["spersons"])."\" IN BOOLEAN MODE) or match(m.author) against (\"".greatescape($_GET["spersons"])."\" IN BOOLEAN MODE) or match(m.sound) against (\"".greatescape($_GET["spersons"])."\" IN BOOLEAN MODE))";
    } else {
        
$where.=" and (match(m.sound) against (\"".greatescape($_GET["spersons"])."\") or match(m.author) against (\"".greatescape($_GET["spersons"])."\") or match(m.sound) against (\"".greatescape($_GET["spersons"])."\"))";
    }
}


if (!
saneempty($filter)) {
    
$output.=table(tr(td("Filters in effect:<BR />\n".implode("; ",$filter))),0,1,0,"","filters");
}

$query="select ".$fields." from ".$from." where ".$where." order by ".$orderby;

// $output.=$query."<BR /><BR />";

$result=doquery($query);

if (
mysql_num_rows($result)==0) {
    
$output.="No Movies found";
} else {

    
$numrows=mysql_num_rows($result);

    while (
$row=mysql_fetch_assoc($result)) {
            if(
is_numeric($row["title"][0]))
                    
$cmp='0-9';
            else
                    
$cmp=$row["title"][0];
            if(
strtoupper($cmp)!=strtoupper($lastchar))
            {
            
$rows.=tr(td("","100%","","","","5"));
                    
$rows.=tr(td("<B>".strtoupper($cmp)."</B>","100%","letter","","","5"));
                    
$lastchar=$cmp;
            }

        
$cells=td(htmlspecialchars($row["title"]));
        
$cells.=td($row["director"]);
        
$cells.=td($row["author"]);

        
$genres=array();
        
$query="select id, name from genre order by id";
        
$genreres=doquery($query);
    
        while (
$genrerow=mysql_fetch_assoc($genreres)) {
            
$genres[$genrerow["id"]]=$genrerow["name"];
        }
        
$genreout=array();
        
$tmp=explode(",",$row["genreid"]);
        foreach (
$tmp as $val) {
            
$genreout[]=$genres[$val];
        }
        
$cells.=td(implode(" / ",$genreout),"",$class);

        
$cells.=td($row["reldate"]);

        
//$cells.=td($row["runtime"]);
        //
        //$rating="";
        //for ($i=0;$i<$row["rating"];$i++) {
        //    $rating.="*";
        //}
        //
        //$cells.=td($rating);

        
$rows.=tr($cells);
    }

    
$output.=table($rows,0,2,2,"100%");

    
$output.="<BR /><BR />\n";
    
$output.="Total number of Movies: ".$numrows;
}

require(
"inc/pheader.php");
echo 
$output;
require(
"inc/pfooter.php");

?>