-
Notifications
You must be signed in to change notification settings - Fork 2
/
emo.php
244 lines (244 loc) · 11.6 KB
/
emo.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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
<?php
include "includes/laiks.php";
//kopskaits visi
$kopa = mysqli_query($connection, "SELECT count(*) skaits FROM `tweets` WHERE created_at between '$no' AND '$lidz'");
$r=mysqli_fetch_array($kopa);
$kopskaits = $r["skaits"];
//pozitīvie
$kopa = mysqli_query($connection, "SELECT count(*) skaits FROM `tweets` WHERE (`text` LIKE '%:D%' OR `text` LIKE '%:)%' OR `text` LIKE '%(:%' OR `text` LIKE '%;)%' OR `text` LIKE '%;]%' OR `text` LIKE '%:-)%' OR `text` LIKE '%:]%' OR `text` LIKE '%[:%' OR `text` LIKE '%:D%' OR `text` LIKE '%;D%' OR `text` LIKE '%xD%' OR `text` LIKE '%:^_^%' OR `text` LIKE '%:^^%' OR `text` LIKE '%:8)%' OR `text` LIKE '%:P%' OR `text` LIKE '%:*%' OR `text` LIKE '%;*%') AND tweets.created_at between '$no' AND '$lidz'");
$r=mysqli_fetch_array($kopa);
$poz = $r["skaits"];
//negatīvie
$kopa = mysqli_query($connection, "SELECT count( * ) skaits FROM tweets where (`text` LIKE '%:S%' OR `text` LIKE '%:(%' OR `text` LIKE '%):%' OR `text` LIKE '%:-(%' OR `text` LIKE '%:[%' OR `text` LIKE '%]:%' OR `text` LIKE '%;(%' OR `text` LIKE '%);%' OR `text` LIKE '%];%' OR `text` LIKE '%;[%' OR `text` LIKE '%:@%' OR `text` LIKE '%:/%' OR `text` LIKE '%:|%' OR `text` LIKE '%:?%' OR `text` LIKE '%:-_-%' OR `text` LIKE '%:O%' OR `text` LIKE '%O:%') AND tweets.created_at between '$no' AND '$lidz'");
$r=mysqli_fetch_array($kopa);
$neg = $r["skaits"];
//ar smaidiņiem
$arsm = $neg+$poz;
//Smaidiņš
$g1 = mysqli_query($connection, "SELECT count(*) skaits FROM `tweets` WHERE `text` LIKE '%:)%' AND tweets.created_at between '$no' AND '$lidz'");
$r1=mysqli_fetch_array($g1);
$s0 = $r1["skaits"];
//Smaidiņš
$g1 = mysqli_query($connection, "SELECT count(*) skaits FROM `tweets` WHERE `text` LIKE '%(:%' AND tweets.created_at between '$no' AND '$lidz'");
$r1=mysqli_fetch_array($g1);
$s1 = $r1["skaits"];
//Smaidiņš
$g1 = mysqli_query($connection, "SELECT count(*) skaits FROM `tweets` WHERE `text` LIKE '%;)%' AND tweets.created_at between '$no' AND '$lidz'");
$r1=mysqli_fetch_array($g1);
$s2 = $r1["skaits"];
//Smaidiņš
$g1 = mysqli_query($connection, "SELECT count(*) skaits FROM `tweets` WHERE `text` LIKE '%;]%' AND tweets.created_at between '$no' AND '$lidz'");
$r1=mysqli_fetch_array($g1);
$s3 = $r1["skaits"];
//Smaidiņš
$g1 = mysqli_query($connection, "SELECT count(*) skaits FROM `tweets` WHERE `text` LIKE '%:-%)' AND tweets.created_at between '$no' AND '$lidz'");
$r1=mysqli_fetch_array($g1);
$s4 = $r1["skaits"];
//Smaidiņš
$g1 = mysqli_query($connection, "SELECT count(*) skaits FROM `tweets` WHERE `text` LIKE '%:]%' AND tweets.created_at between '$no' AND '$lidz'");
$r1=mysqli_fetch_array($g1);
$s5 = $r1["skaits"];
//Smaidiņš
$g1 = mysqli_query($connection, "SELECT count(*) skaits FROM `tweets` WHERE `text` LIKE '%:D%' AND tweets.created_at between '$no' AND '$lidz'");
$r1=mysqli_fetch_array($g1);
$s6 = $r1["skaits"];
//Smaidiņš
$g1 = mysqli_query($connection, "SELECT count(*) skaits FROM `tweets` WHERE `text` LIKE '%;D%' AND tweets.created_at between '$no' AND '$lidz'");
$r1=mysqli_fetch_array($g1);
$s7 = $r1["skaits"];
//Smaidiņš
$g1 = mysqli_query($connection, "SELECT count(*) skaits FROM `tweets` WHERE `text` LIKE '%xD%' AND tweets.created_at between '$no' AND '$lidz'");
$r1=mysqli_fetch_array($g1);
$s8 = $r1["skaits"];
//Smaidiņš
$g1 = mysqli_query($connection, "SELECT count(*) skaits FROM `tweets` WHERE `text` LIKE '%:P%' AND tweets.created_at between '$no' AND '$lidz'");
$r1=mysqli_fetch_array($g1);
$s9 = $r1["skaits"];
//Smaidiņš
$g1 = mysqli_query($connection, "SELECT count(*) skaits FROM `tweets` WHERE `text` LIKE '%:*%' AND tweets.created_at between '$no' AND '$lidz'");
$r1=mysqli_fetch_array($g1);
$s10 = $r1["skaits"];
//Smaidiņš
$g1 = mysqli_query($connection, "SELECT count(*) skaits FROM `tweets` WHERE `text` LIKE '%;*%' AND tweets.created_at between '$no' AND '$lidz'");
$r1=mysqli_fetch_array($g1);
$s11 = $r1["skaits"];
//Smaidiņš
$g1 = mysqli_query($connection, "SELECT count(*) skaits FROM `tweets` WHERE `text` LIKE '%^_^%' AND tweets.created_at between '$no' AND '$lidz'");
$r1=mysqli_fetch_array($g1);
$s12 = $r1["skaits"];
//Smaidiņš
$g1 = mysqli_query($connection, "SELECT count(*) skaits FROM `tweets` WHERE `text` LIKE '%^^%' AND tweets.created_at between '$no' AND '$lidz'");
$r1=mysqli_fetch_array($g1);
$s13 = $r1["skaits"];
//Smaidiņš
$g1 = mysqli_query($connection, "SELECT count(*) skaits FROM `tweets` WHERE `text` LIKE '%8)%' AND tweets.created_at between '$no' AND '$lidz'");
$r1=mysqli_fetch_array($g1);
$s14 = $r1["skaits"];
//Smaidiņš
$g1 = mysqli_query($connection, "SELECT count(*) skaits FROM `tweets` WHERE `text` LIKE '%:O%' AND tweets.created_at between '$no' AND '$lidz'");
$r1=mysqli_fetch_array($g1);
$s15 = $r1["skaits"];
//Smaidiņš
$g1 = mysqli_query($connection, "SELECT count(*) skaits FROM `tweets` WHERE `text` LIKE '%O:%' AND tweets.created_at between '$no' AND '$lidz'");
$r1=mysqli_fetch_array($g1);
$s16 = $r1["skaits"];
//Smaidiņš
$g1 = mysqli_query($connection, "SELECT count(*) skaits FROM `tweets` WHERE `text` LIKE '%:S%' AND tweets.created_at between '$no' AND '$lidz'");
$r1=mysqli_fetch_array($g1);
$s17 = $r1["skaits"];
//Smaidiņš
$g1 = mysqli_query($connection, "SELECT count(*) skaits FROM `tweets` WHERE `text` LIKE '%:(%' AND tweets.created_at between '$no' AND '$lidz'");
$r1=mysqli_fetch_array($g1);
$s18 = $r1["skaits"];
//Smaidiņš
$g1 = mysqli_query($connection, "SELECT count(*) skaits FROM `tweets` WHERE `text` LIKE '%):%' AND tweets.created_at between '$no' AND '$lidz'");
$r1=mysqli_fetch_array($g1);
$s19 = $r1["skaits"];
//Smaidiņš
$g1 = mysqli_query($connection, "SELECT count(*) skaits FROM `tweets` WHERE `text` LIKE '%]:%' AND tweets.created_at between '$no' AND '$lidz'");
$r1=mysqli_fetch_array($g1);
$s20 = $r1["skaits"];
//Smaidiņš
$g1 = mysqli_query($connection, "SELECT count(*) skaits FROM `tweets` WHERE `text` LIKE '%;(%' AND tweets.created_at between '$no' AND '$lidz'");
$r1=mysqli_fetch_array($g1);
$s21 = $r1["skaits"];
//Smaidiņš
$g1 = mysqli_query($connection, "SELECT count(*) skaits FROM `tweets` WHERE `text` LIKE '%;[%' AND tweets.created_at between '$no' AND '$lidz'");
$r1=mysqli_fetch_array($g1);
$s22 = $r1["skaits"];
//Smaidiņš
$g1 = mysqli_query($connection, "SELECT count(*) skaits FROM `tweets` WHERE `text` LIKE '%:@%' AND tweets.created_at between '$no' AND '$lidz'");
$r1=mysqli_fetch_array($g1);
$s23 = $r1["skaits"];
//Smaidiņš
$g1 = mysqli_query($connection, "SELECT count(*) skaits FROM `tweets` WHERE `text` LIKE '%:/%' AND tweets.created_at between '$no' AND '$lidz'");
$r1=mysqli_fetch_array($g1);
$s24 = $r1["skaits"];
//Smaidiņš
$g1 = mysqli_query($connection, "SELECT count(*) skaits FROM `tweets` WHERE `text` LIKE '%:|%' AND tweets.created_at between '$no' AND '$lidz'");
$r1=mysqli_fetch_array($g1);
$s25 = $r1["skaits"];
//Smaidiņš
$g1 = mysqli_query($connection, "SELECT count(*) skaits FROM `tweets` WHERE `text` LIKE '%-_-%' AND tweets.created_at between '$no' AND '$lidz'");
$r1=mysqli_fetch_array($g1);
$s26 = $r1["skaits"];
?>
<h2 style='margin:auto auto; text-align:center;'>Ēdāju smaidiņu statistika</h2>
<h5 style='margin:auto auto; text-align:center;'>
<form method="post" action="smaidi">
No <input value="<?php echo $nn;?>" readonly size=9 type="text" id="from" name="from"/> līdz <input value="<?php echo $ll;?>" readonly size=9 type="text" id="to" name="to"/>
<INPUT TYPE="submit" name="submit" value="Parādīt"/>
</form>
</h5>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
var chart;
google.load('visualization', '1.0', {'packages':['corechart']});
google.setOnLoadCallback(drawChart);
$(window).resize(drawChart);
function drawChart() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Topping');
data.addColumn('number', 'Slices');
data.addRows([
['Ar smaidiņiem', <?php echo $arsm; ?>],
['Bez smaidiņiem', <?php echo $kopskaits - $arsm; ?>]
]);
var options = {'title':'Smaidiņi tvītos',
'backgroundColor':'transparent',
'is3D':'true'};
chart = new google.visualization.PieChart(document.getElementById('smile1'));
chart.draw(data, options);
}
</script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
var chart1;
google.load('visualization', '1.0', {'packages':['corechart']});
google.setOnLoadCallback(drawChart1);
$(window).resize(drawChart1);
function drawChart1() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Topping');
data.addColumn('number', 'Slices');
data.addRows([
['Pozitīvie', <?php echo $poz; ?>],
['Negatīvie', <?php echo $neg; ?>]]);
var options = {'title':'Noskaņojums',
'backgroundColor':'transparent',
'is3D':'true'};
chart1 = new google.visualization.PieChart(document.getElementById('smile2'));
chart1.draw(data, options);
}
</script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
var chart2;
google.load('visualization', '1.0', {'packages':['corechart']});
google.setOnLoadCallback(drawChart2);
$(window).resize(drawChart2);
function drawChart2() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Topping');
data.addColumn('number', 'Slices');
data.addRows([
[':)', <?php echo $s0; ?>],
['(:', <?php echo $s1; ?>],
[';)', <?php echo $s2; ?>],
[';]', <?php echo $s3; ?>],
[':-)', <?php echo $s4; ?>],
[':]', <?php echo $s5; ?>],
[':D', <?php echo $s6; ?>],
[';D', <?php echo $s7; ?>],
['xD', <?php echo $s8; ?>],
[':P', <?php echo $s9; ?>],
[':*', <?php echo $s10; ?>],
[';*', <?php echo $s11; ?>],
['^_^', <?php echo $s12; ?>],
['^^', <?php echo $s13; ?>],
['8)', <?php echo $s14; ?>]
]);
var options = {'title':'Pozitīvie smaidiņi',
'backgroundColor':'transparent',
'is3D':'true'};
chart2 = new google.visualization.PieChart(document.getElementById('smile3'));
chart2.draw(data, options);
}
</script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
var chart3;
google.load('visualization', '1.0', {'packages':['corechart']});
google.setOnLoadCallback(drawChart3);
$(window).resize(drawChart3);
function drawChart3() {
var data = new google.visualization.DataTable();
data.addColumn('string', 'Topping');
data.addColumn('number', 'Slices');
data.addRows([
[':O', <?php echo $s15; ?>],
['O:', <?php echo $s16; ?>],
[':S', <?php echo $s17; ?>],
[':(', <?php echo $s18; ?>],
['):', <?php echo $s19; ?>],
[']:', <?php echo $s20; ?>],
[';(', <?php echo $s21; ?>],
[';[', <?php echo $s22; ?>],
[':@', <?php echo $s23; ?>],
[':/', <?php echo $s24; ?>],
[':|', <?php echo $s25; ?>],
['-_-', <?php echo $s26; ?>]
]);
var options = {'title':'Negatīvie smaidiņi',
'backgroundColor':'transparent',
'is3D':'true'};
chart3 = new google.visualization.PieChart(document.getElementById('smile4'));
chart3.draw(data, options);
}
</script>
<br/>
<div id="smile1"></div>
<div id="smile2"></div>
<br style="clear:both;"/>
<div id="smile3"></div>
<div id="smile4"></div>