forked from RoyBellingan/Seishonotasuke
-
Notifications
You must be signed in to change notification settings - Fork 1
/
f.php
executable file
·211 lines (177 loc) · 4.28 KB
/
f.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
<?php
/*
* Draft di come dovrebbe all'incirca venire a livello logico la cosa...
*
*
*/
include_once ("util/top_foot_inc.php");
$addizionali=4;
$lang = (empty($_COOKIE['lang'])) ? 'italiano' : $_COOKIE['lang'];
//$lang="ita";
$lang_frequency=$lang."_frequency";
echo "$lang";
include_once ("util/top_foot_inc.php");
//dumpa ($GLOBALS,1);
//include_once ("elenco_lib.php");
top2();
connetti();
$word=$_GET['w'];
$word=htmlentities($word,ENT_COMPAT,"UTF-8");
$sql="select id_word, frequency from $lang_frequency where word >= '$word'";
$fs = mysql_query($sql);
$rs=mysql_fetch_row($fs);
//dumpa ($rs);
$err=mysql_error($db);
if ($err)
{
echo "<br>$sql <br> $err<hr>";
}
$id=$rs[0];
$feq=$rs[1];
echo "<span>$word con id = $id e freq di $feq<br>$sql<br></span>";
// $parole_less="";
// $parole_over="";
// $sql="select * from (select word from ita_frequency where id_word > $id order by `id_word` ASC limit $addizionali) as t2 order by word ASC ";
// $fs = mysql_query($sql);
//
// //dumpa ($rs);
// $err=mysql_error($db);
// if ($err)
// {
// echo "<br>$sql <br> $err<hr>";
// }
//
// while ($rs=mysql_fetch_row($fs))
// {
// $parole_over[]=$rs[0];
// }
//
// $sql="select * from (select word from ita_frequency where id_word < $id order by `id_word` DESC limit $addizionali) as t2 order by word ASC ";
// $fs = mysql_query($sql);
//
// //dumpa ($rs);
// $err=mysql_error($db);
// if ($err)
// {
// echo "<br>$sql <br> $err<hr>";
// }
//
//
// while ($rs=mysql_fetch_row($fs))
// {
// $parole_less[]=$rs[0];
// }
if ($id<=25)
{
$idn=1;
$pos=$id-2;
}
else
{
$idn=$id-25;
$pos=24;
}
$sql="select * from (select word from $lang_frequency where id_word > $idn order by `id_word` ASC limit 51) as t2 order by word ASC ";
$fs = mysql_query($sql);
//dumpa ($rs);
$err=mysql_error($db);
if ($err)
{
echo "<br>$sql <br> $err<hr>";
}
$i=0;
while ($rs=mysql_fetch_row($fs))
{
$parole_less[]=$rs[0];
if ($i==$pos )
{
//$parole_less[] ="Id parola: $id, appare con frequenza di $feq";
}
$i++;
}
$sl="<select size=\"5\" id=\"prova\" ONCLICK=\"location = this.options[this.selectedIndex].value;\" >";
?>
<!--
<select size="5" >
<optgroup label="az"></optgroup>
<option selected="selected">ciao</option>
<option></option>
</select>
-->
<?php
$sl=$sl.selecta_sl($parole_less,$pos)."</select>";
//dumpa ($parole_less,1);
echo "Alfabetica<br>";
echo $sl;
/************/
/*
* Per orindare con le frequenze devo prima vedere 24 item prima che frequenza ci stà quindi un
* select freq < $feqn limit 24,1
*
*
*
*
*
*/
//$feq
//UNa unica non va bene perchè non sò quanti risultati ci sono in una sola...
//$sql="(select word from ita_frequency where frequency = $feq and word <= '$word' order by word DESC limit 24) UNION (select word from ita_frequency where frequency = $feq and word > '$word' order by word ASC limit 24) order by word ASC";
$sql="select word from (select word from $lang_frequency where frequency = $feq and word <= '$word' order by word DESC limit 24)as t2 order by word ASC" ;
$fs = mysql_query($sql);
echo "<br>$sql <br> $err<hr>";
//dumpa ($rs);
$err=mysql_error($db);
if ($err)
{
echo "<br>$sql <br> $err<hr>";
}
$i=0;
while ($rs=mysql_fetch_row($fs))
{
//dumpa ($rs);
$parole_feq[]=$rs[0];
if ($i==24 )
{
//$parole_less[] ="Id parola: $id, appare con frequenza di $feq";
}
$i++;
}
$i--;
$sl="<select size=\"5\" id=\"prova2\" ONCHANGE=\"location = this.options[this.selectedIndex].value;\" >";
$sl=$sl.selecta_sl($parole_feq,$i);
$sql="select word from (select word from $lang_frequency where frequency = $feq and word > '$word' order by word ASC limit 24)as t2 order by word ASC" ;
$fs = mysql_query($sql);
echo "<br>$sql <br> $err<hr>";
//dumpa ($rs);
$err=mysql_error($db);
if ($err)
{
echo "<br>$sql <br> $err<hr>";
}
$parole_feq="";
$i=0;
while ($rs=mysql_fetch_row($fs))
{
//dumpa ($rs);
$parole_feq[]=$rs[0];
if ($i==24 )
{
//$parole_less[] ="Id parola: $id, appare con frequenza di $feq";
}
$i++;
}
$sl=$sl.selecta_l($parole_feq)."</select>";
//dumpa ($parole_feq,1);
echo "<br>Frequenza<br>";
echo $sl;
//echo $word;
//echo "<br>Id parola: $id, appare con frequenza di $feq";
//dumpa ($parole_over,1);
foot();
?>
<script type="text/javascript">
window.onload = function()
{
document.getElementById('prova').size=9;
document.getElementById('prova2').size=9;
}</script>