Pfarrverband Irdning - Donnersbach - Donnersbachwald
 Die Pfarre   Kontakt   Gottesdienst   Gruppen, Anliegen, Firmung   Termine    Bilder 
Gottesdienstplan
0) { return ($ob); } } else { print $ausdruck . "ERR:1210
\n"; } return(NULL); } function SQLO($con,$ausdruck) # Returns obj - but only the first record! { $GLOBAL["error"] = 0; // $ausdruck=noslash($ausdruck); $qu = pg_query ($con,$ausdruck); if ($qu) { $obj = pg_fetch_object ($qu); # Gets only the first Object!!! (0) if ($obj) { return($obj); } else { return(NULL); } } else { print $ausdruck . "o
\n"; return(NULL); } } function opendb($dbname, $dbuser, $dbpw, $dbhost, $dbport) { if ($dbport > 1) { $x = pg_connect("dbname=$dbname user=$dbuser password=$dbpw host=$dbhost port=$dbport"); } else { $x = pg_connect("dbname=$dbname user=$dbuser password=$dbpw host=$dbhost"); } SQL($x,"set DateStyle TO 'German'"); SQL($x,"set client_encoding TO 'UTF8'"); return $x; }; function SQLH($con,$ausdruck,$header,$tab) { $GLOBAL["error"] = 0; $ausdruck=noslash($ausdruck); $x=pg_exec($con,$ausdruck); if($x) { $fields = pg_numfields($x); $rows = pg_numrows($x); for ($i=0; $i < $fields; $i++) { $header[$i] = pg_fieldname($x,$i); } for ($i=0; $i < $rows; $i++) { $tab[$i] = pg_fetch_row($x,$i); } // echo "F:$fields R: $rows
\n"; return $rows; } else { $GLOBALS["error"] = 1; } }; function closedb() { pg_close_all; }; function dbshow($tabelle) //zeigt Inhalt einer Tabelle in HTML Format { $c_id=alidb_connect(); $sql1=alidb_exec($c_id,"select * from $tabelle;"); $x=pg_result_all($sql1); alidb_closeall; return $x; }; function dbinsert($feld, $par,$tabelle) { $c_id=alidb_connect(); //SQL Ausdruck vorbereiten $ins=count($par); $st="insert into $tabelle ($feld[1]"; for ($i=2; $i<=$ins;$i++) { $st.=",$feld[$i]"; }; $st.=") values($par[1]"; for ($i=2; $i<=$ins;$i++) { $st.=",$par[$i]"; }; $st.=")"; //SQL alidb_exec($c_id,$st); alidb_closeall(); return $x; }; function show_all($h,$e) { echo "\n"; for ($i=0;$i<=count($h);$i++) { echo "\n"; }; echo "\n"; for ($j=0;$j<=count($e);$j++) { echo ""; for ($i=0;$i<=count($h);$i++) { echo "\n"; }; echo ""; }; echo "
$h[$i]
"; echo $e[$j][$i]; echo "
"; }; function check_pw($login,$pw,$db) { $r = "select * from login where lower(login)=lower('$login') AND lower(pw)=lower('$pw') AND valid='t'"; # $r = "select * from login where login='" . $login . "' AND pw='" . $pw . "' AND valid='t'"; $e = SQLO($db,$r); $GLOBALS["eMail"]=$e->email; $GLOBALS["nl"]=$e->nl; $GLOBALS["name"]=$e->name; $GLOBALS["tel"]=$e->tel; return($err); } function check_userpw($login,$pw,$db) { $e[0][0]=0; $r = "select id from person where lower(login)=lower('$login') AND lower(pw)=lower('$pw') AND activ=1"; $e = SQLO($db,$r); return($e->id); } function fzahl($z) { if ($z < 0) { $minus = "-";} else {$minus ="";} $z = abs($z); $e = sprintf("%.2f", $z); # Richtig abgeschnitten und gerundet list ($v,$n) = split('\.',$e,2); # Vorkomma und Nachkomma $t = intval($v / 1000); # Tausender $h = $v - $t * 1000; # Hunderter if ( $t != 0) { $e = sprintf("$minus$t.%03d,%02d", $h,$n); } else { $e = sprintf("$minus%d,%02d", $h,$n); } return($e); } # # Gives a unique key # function get_key($keyname,$db) # Name of the row in the Key-table { $r = "BEGIN WORK;\nLOCK keytable;\nupdate keytable set id = id + 1 WHERE key='$keyname';\n SELECT MAX(id) as key from keytable where key='$keyname';"; $t = "COMMIT WORK;\n"; $e = SQLO($db,$r); $key = $e->key; $err = SQL($db,$t); return($key); } function get_pin($anz) { $selbst=array('a','e','i','o','u','y','a','e','i','o','u'); $mit= array('b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','z'); $zahl=array('1','2','3','4','5','6','7','8','9','0','+','-','(','$'); $p=""; srand((double)microtime()*1000000); $k = rand(0,1); for ($i=0;$i<($anz-1);$i++) { if ($k == 0) /* Start with Selbstlaut */ { $j = rand(0,10); $p = $p . $selbst[$j]; $k=1; } else { $j = rand(0,19); $p = $p . $mit[$j]; $k=0; } } $j = rand(0,13); $p = $p . $zahl[$j]; return($p); } ?>