web/getdb.inc
author viric@llimona
Thu, 18 May 2006 22:59:47 +0200
changeset 0 6371497b4e53
permissions -rw-r--r--
Init from svn. The wxpython is the final one.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
     1
<?php
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
     2
$mysql_server = "localhost";
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
     3
$mysql_user = "lingvigilouser";
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
     4
$mysql_password = "carrinclo";
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
     5
$mysql_db = "lingvigilo";
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
     6
$frazotablo = "frazoj_ru_ca";
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
     7
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
     8
function konekti()
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
     9
{
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    10
	global $mysql_server, $mysql_user, $mysql_password, $mysql_db;
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    11
	$connexio = mysql_connect($mysql_server, $mysql_user, $mysql_password);
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    12
	mysql_select_db($mysql_db, $connexio);
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    13
	return $connexio;
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    14
}
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    15
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    16
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    17
function strtosql($cadena)
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    18
{
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    19
	return ereg_replace("\'", "\'", $cadena);
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    20
}
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    21
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    22
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    23
function preni_frazojn($konekto,$fraztipo=0)
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    24
{
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    25
	global $frazotablo;
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    26
	$resultat = mysql_query(
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    27
		"SELECT id,vorto,frazo,korekta,klarigo,korektisto FROM " .
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    28
		$frazotablo . " WHERE korekta=" . $fraztipo . ";",
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    29
		$konekto);
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    30
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    31
	echo mysql_error();
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    32
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    33
	while ($fila = mysql_fetch_row($resultat))
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    34
	{
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    35
		$frazoj[$fila[0]] = array(
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    36
				"vorto" => $fila[1],
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    37
				"frazo" => $fila[2],
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    38
				"korekta" => $fila[3],
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    39
				"klarigo" => $fila[4],
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    40
				"korektisto" => $fila[5]);
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    41
	}
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    42
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    43
	if (!isset($frazoj))
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    44
		$frazoj=0;
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    45
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    46
	return $frazoj;
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    47
}
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    48
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    49
function teksto_korekto($korekteco)
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    50
{
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    51
	switch($korekteco)
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    52
	{
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    53
	case 0: return "Ne korektita"; break;
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    54
	case 1: return "Ĝusta"; break;
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    55
	case 2: return "Malĝusta"; break;
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    56
	case 3: return "Nekutima"; break;
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    57
	}
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    58
}
6371497b4e53 Init from svn. The wxpython is the final one.
viric@llimona
parents:
diff changeset
    59
?>