forked from julmud/phpDVDProfiler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
no_coo.php
104 lines (88 loc) · 4.06 KB
/
no_coo.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
<?php
error_reporting(E_ALL);
define('IN_SCRIPT', 1);
include('global.php');
if ($inbrowser)
echo "<pre>";
$coltype = '';
if (isset($collection))
$coltype = "collectiontype='$collection' AND ";
// List all of the profiles empty of COO
$sql = "SELECT id,title,collectiontype FROM $DVD_TABLE WHERE $coltype (countryoforigin='' and countryoforigin2='' and countryoforigin3='')";
if (($handleadult == 2) || (($handleadult == 1) && !$IsPrivate))
$sql .= " AND isadulttitle=0";
$sql .= " ORDER BY sorttitle ASC";
$result = $db->sql_query($sql);
$count = $db->sql_numrows($result);
echo "You have $count profiles with no country of origin\n";
if ($count > 0) {
printf("%20s - %-10s - %s\n", "id", "collection", "title");
while ($dvd = $db->sql_fetchrow($result)) {
$id = $dvd['id'];
$collection = $dvd['collectiontype'];
$title = $dvd['title'];
printf("%20s - %-10s - %s\n", $id, $collection, $title);
}
}
$db->sql_freeresult($result);
// List all of the profiles with an empty slot before a non-empty slot
$sql = "SELECT id,title,collectiontype,countryoforigin,countryoforigin2,countryoforigin3 FROM $DVD_TABLE WHERE $coltype "
."((countryoforigin='' AND (countryoforigin2!='' OR countryoforigin3!='')) OR "
."(countryoforigin!='' AND countryoforigin2='' AND countryoforigin3!=''))";
if (($handleadult == 2) || (($handleadult == 1) && !$IsPrivate))
$sql .= " AND isadulttitle=0";
$sql .= " ORDER BY sorttitle ASC";
$result = $db->sql_query($sql);
$count = $db->sql_numrows($result);
echo "You have $count profiles with a missing country of origin before a real country of origin\n";
if ($count > 0) {
printf("%20s - %-10s - %s: %s\n", "id", "collection", "title", "| coo1 | coo2 | coo3 |");
while ($dvd = $db->sql_fetchrow($result)) {
$id = $dvd['id'];
$collection = $dvd['collectiontype'];
$title = $dvd['title'];
printf("%20s - %-10s - %s: | %s | %s | %s |\n", $id, $collection, $title, $dvd['countryoforigin'], $dvd['countryoforigin2'], $dvd['countryoforigin3']);
}
}
$db->sql_freeresult($result);
// List all of the profiles with a duplicate slot
$sql = "SELECT id,title,collectiontype,countryoforigin,countryoforigin2,countryoforigin3 FROM $DVD_TABLE WHERE $coltype "
."(countryoforigin!='' AND (countryoforigin=countryoforigin2 OR countryoforigin=countryoforigin3)) OR (countryoforigin2!='' AND countryoforigin2=countryoforigin3)";
if (($handleadult == 2) || (($handleadult == 1) && !$IsPrivate))
$sql .= " AND isadulttitle=0";
$sql .= " ORDER BY sorttitle ASC";
$result = $db->sql_query($sql);
$count = $db->sql_numrows($result);
echo "You have $count profiles with a duplicate country of origin\n";
if ($count > 0) {
printf("%20s - %-10s - %s: %s\n", "id", "collection", "title", "| coo1 | coo2 | coo3 |");
while ($dvd = $db->sql_fetchrow($result)) {
$id = $dvd['id'];
$collection = $dvd['collectiontype'];
$title = $dvd['title'];
printf("%20s - %-10s - %s: | %s | %s | %s |\n", $id, $collection, $title, $dvd['countryoforigin'], $dvd['countryoforigin2'], $dvd['countryoforigin3']);
}
}
$db->sql_freeresult($result);
// Find which COOs are not locales
$sql = "SELECT id,title,collectiontype,countryoforigin,countryoforigin2,countryoforigin3 FROM $DVD_TABLE WHERE $coltype "
."(countryoforigin!='' AND (countryoforigin=countryoforigin2 OR countryoforigin=countryoforigin3)) OR (countryoforigin2!='' AND countryoforigin2=countryoforigin3)";
if (($handleadult == 2) || (($handleadult == 1) && !$IsPrivate))
$sql .= " AND isadulttitle=0";
$sql .= " ORDER BY sorttitle ASC";
$result = $db->sql_query($sql);
$count = $db->sql_numrows($result);
echo "You have $count profiles with a duplicate country of origin\n";
if ($count > 0) {
printf("%20s - %-10s - %s: %s\n", "id", "collection", "title", "| coo1 | coo2 | coo3 |");
while ($dvd = $db->sql_fetchrow($result)) {
$id = $dvd['id'];
$collection = $dvd['collectiontype'];
$title = $dvd['title'];
printf("%20s - %-10s - %s: | %s | %s | %s |\n", $id, $collection, $title, $dvd['countryoforigin'], $dvd['countryoforigin2'], $dvd['countryoforigin3']);
}
}
$db->sql_freeresult($result);
if ($inbrowser)
echo "</pre>";
?>