Projekt

Obecné

Profil

Stáhnout (2.56 KB) Statistiky
| Větev: | Tag: | Revize:
1 6daefa8c Petr Lukašík
<?
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 ("&nbsp;".$pocethesel."&nbsp;");
54
			if (StrLen ($number) <= MAXPOLOZKA)
55
			{
56
//tady webbookandchapter a webtransliteration if it is in old encoding keiln
57
				if (Pg_Exec ("INSERT INTO obtexts (bookandchapter, paragraph, transliteration, stransliteration, autor, date) VALUES ('($webbookandchapter,', '$paragraph', '$webtransliteration', '$stransliteration', '$auth_userkod', '$date')"))
58
				{
59
					$heseldobre++;
60
				}
61
//				$state = pg_exec("select rec_state from obtextp where bookandchapter LIKE '%$webbookandchapter%'");
62
//				$state = pg_fetch_row($state, 0);
63
//				$state = $state[0];
64
//				if ($state != 'U' && $state != 'N') {
65
//					pg_exec("update obtextp set rec_state='U' where bookandchapter LIKE '%$webbookandchapter%'");
66
//				}
67
			}
68
    }
69
    else
70
		$konec = true;
71
		echo (" &nbsp;&nbsp;&nbsp;$bookandchapter&nbsp;");
72
	} while (! $konec);
73
  FClose ($fr1);
74
	Pg_Close ($spojeni);
75
	echo ("<hr>Total number of inserted lines: $pocethesel<br>\n");
76
	echo ("Number of lines inserted: $heseldobre<br>\n");
77
	echo ("Number of lines which were too long (not inserted): $heselnevlozeno<br>\n");
78
?>
79
	<form action="/utf/ktools.php">
80
		<input type=submit value="back to ktools">
81
	</form>
82
</FONT>
83
</BODY>
84
</HTML>