1
|
<?
|
2
|
include "autorizace.inc.php";
|
3
|
ksa_authorize();
|
4
|
if ($auth_level == 0) ksa_unauthorized();
|
5
|
?>
|
6
|
<HTML>
|
7
|
<HEAD>
|
8
|
<META content=text/html; http-equiv=Content-Type>
|
9
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD W3 HTML//EN">
|
10
|
<TITLE></TITLE>
|
11
|
</HEAD>
|
12
|
<BODY>
|
13
|
<h1><center> Data insert into database table obtexts</center></h1>
|
14
|
<br>
|
15
|
<FONT FACE='Unicode Arial MS' SIZE=3>
|
16
|
<?
|
17
|
if ( ($file1 == ""))
|
18
|
{
|
19
|
echo ("Filename not given!<br>\n");
|
20
|
echo ("<br><br><a href=\"./ktools.html\"> back</a>");
|
21
|
echo ("</BODY>");
|
22
|
echo ("</HTML>");
|
23
|
exit;
|
24
|
}
|
25
|
$file1="/home/webowner/data-in/bybsrc/".$file1;
|
26
|
if ( ($fr1 = FOpen ($file1, "r")) == false )
|
27
|
{
|
28
|
echo ("The file is probably read-only, check it!<br> Name: ".$file1."\n");
|
29
|
echo ("<br><br><a href=\"../index.php3\"> Back to tools menu</a>");
|
30
|
echo ("</BODY>");
|
31
|
echo ("</HTML>");
|
32
|
exit;
|
33
|
}
|
34
|
$konec = false;
|
35
|
@$spojeni = Pg_Connect("user=dbowner dbname=klinopis");
|
36
|
require "./fcek2u2.php";
|
37
|
define ("MAXPOLOZKA", 62690);
|
38
|
define ("MAXREAD", 62000);
|
39
|
// $date = Date ("Y-m-d");
|
40
|
$date = '2003-08-07';
|
41
|
do
|
42
|
{
|
43
|
if (($text = FGetS ($fr1, MAXREAD)) != false )
|
44
|
{
|
45
|
if ($typdat == 1) //nova hesla
|
46
|
$bookandchapter = StrTok ($text, "^");
|
47
|
$paragraph = StrTok ("^");
|
48
|
$transliteration = StrTok ("^");
|
49
|
$zmena = StrTok ("^");
|
50
|
// $text = "";
|
51
|
include "./convertk2u2.php";
|
52
|
$pocethesel++;
|
53
|
if (($pocethesel % 100) == 0) echo (" ".$pocethesel." ");
|
54
|
if (StrLen ($number) <= MAXPOLOZKA)
|
55
|
{
|
56
|
if (Pg_Exec ("INSERT INTO obtexts (bookandchapter, paragraph, transliteration, stransliteration, autor, date) VALUES ('$webbookandchapter', '$paragraph', '$webtransliteration', '$stransliteration', '$auth_userkod', '$date')"))
|
57
|
{
|
58
|
$heseldobre++;
|
59
|
}
|
60
|
$state = pg_exec("select rec_state from obtextp where bookandchapter LIKE '%$webbookandchapter%'");
|
61
|
$state = pg_fetch_row($state, 0);
|
62
|
$state = $state[0];
|
63
|
if ($state != 'U' && $state != 'N') {
|
64
|
pg_exec("update obtextp set rec_state='U' where bookandchapter LIKE '%$webbookandchapter%'");
|
65
|
}
|
66
|
}
|
67
|
}
|
68
|
else
|
69
|
$konec = true;
|
70
|
echo (" $bookandchapter ");
|
71
|
} while (! $konec);
|
72
|
FClose ($fr1);
|
73
|
Pg_Close ($spojeni);
|
74
|
echo ("<hr>Total number of inserted lines: $pocethesel<br>\n");
|
75
|
echo ("Number of lines inserted: $heseldobre<br>\n");
|
76
|
echo ("Number of lines which were too long (not inserted): $heselnevlozeno<br>\n");
|
77
|
?>
|
78
|
<form action="/utf/ktools.php">
|
79
|
<input type=submit value="back to ktools">
|
80
|
</form>
|
81
|
</FONT>
|
82
|
</BODY>
|
83
|
</HTML>
|