Can't connect to database.

"; exit; } date_default_timezone_set( "Asia/Calcutta" ); $authenticated = false; $authlevel = 0; if( isset( $_SERVER["PHP_AUTH_USER"] ) && isset( $_SERVER["PHP_AUTH_PW"] ) ) { $authlevel = -1; $sql = "select fu_level, fu_pass_change from fotolib_user where " . "fu_name = \$1 and fu_password = \$2"; $values[1] = $_SERVER["PHP_AUTH_USER"]; $values[2] = $_SERVER["PHP_AUTH_PW"]; $ress = pg_query_params( $G_conn, $sql, $values ); if( $ress ) { $row = pg_fetch_array( $ress, NULL, PGSQL_ASSOC ); if( $row ) { $authenticated = true; $authlevel = $row["fu_level"]; if( $row["fu_pass_change"] > 0 ) { if( $cmd != "savepwd" ) { $cmd = "editpwd"; } } } } } $loginnr = $_SESSION["loginnr"]; if( isset( $_POST["loginnr"] ) ) { $loginnr = $_POST["loginnr"]; } if( $authlevel < 0 || ($cmd == "logout" && $_SESSION["loginnr"] == $loginnr) ) { $_SESSION["loginnr"] += 1; header( "WWW-Authenticate: Basic realm=\"Fotolib (user 'guest' pass 'guest').\"" ); //header( "Location: " . $_SERVER["HTTP_REFERER"] ); header( "HTTP/1.0 401 Unauthorized" ); echo "sorry, no access."; exit; } require( "constants.php" ); require( "gfx.php" ); require( "img.php" ); require( "foto.php" ); require( "show.php" ); require( "stats.php" ); require( "tags.php" ); require( "remote.php" ); function page_header( $authenticated, $authlevel ) { // header( 'Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0' ); header( "Cache-Control: no-cache, must-revalidate" ); header( "Expires: Sat, 26 Jul 1997 05:00:00 GMT" ); header( "Content-type: text/html; charset=UTF-8" ); echo "\n"; ?> pics.borg.ch/fotolib

pics.borg.ch/fotolib

= 2 ) { echo ""; echo ""; echo ""; /* echo ""; */ } echo ""; echo ""; ?>
"; echo ""; echo ""; echo "
"; echo ""; echo ""; echo "
"; echo ""; echo ""; echo "
"; echo ""; echo ""; echo "
"; echo ""; echo ""; echo "
"; echo ""; echo ""; $logintext = "login"; if( $authenticated ) { $logintext = "logout ($authlevel)"; } echo ""; echo "
"; } function show_env() { foreach( $_SERVER as $key => $value ) { echo "$key = '$value'
\n"; } } function text2html( $text, $cr2br ) { if( $text == "" ) { return " "; } $text = htmlspecialchars( $text ); if( $cr2br ) { $text = str_replace( "\n", "
", $text ); } return $text; } function markup2html( $text, $cr2br ) { if( $text == "" ) { return " "; } $text = htmlspecialchars( $text ); if( $cr2br ) { $text = str_replace( "\n", "
", $text ); } if( strpos( $text, "[" ) === false ) { } else { $parts = explode( "[", $text ); $partcnt = count($parts); $style = array(); $url = null; $tagname = "span"; $in_tag = false; $text = $parts[0]; for( $i=1; $i<$partcnt; $i++ ) { $tt = explode( "]", $parts[$i], 2 ); $emit_tag = false; if( count($tt) == 2 ) { $tv = explode( "=", $tt[0], 2 ); $tag = $tv[0]; $value = ""; if( count($tv) > 0 ) { $value = $tv[1]; } switch( $tag ) { case "url": if( preg_match( "/^[a-z]+:\\/\\/[a-z0-9].*\$/", $value ) ) { $url = $value; $emit_tag = true; } break; case "/url": $url = null; $emit_tag = true; break; case "pl": if( preg_match( "/^[1-9][0-9]*$/", $value ) ) { $url = "?cmd=show&id=$value"; $emit_tag = true; } break; case "/pl": $url = null; $emit_tag = true; break; case "bc": if( preg_match( "/^[a-z0-9#]+\$/", $value ) ) { $style["background-color"] = $value; $emit_tag = true; } else if( $value == "" ) { unset( $style["background-color"] ); $emit_tag = true; } break; case "/bc": unset( $style["background-color"] ); $emit_tag = true; break; } } if( $emit_tag ) { if( $in_tag ) { $text .= ""; $in_tag = false; } $stylestr = ""; foreach( $style as $n => $v ) { $stylestr .= "$n: $v; "; } if( $stylestr == "" ) { $stylestr = " style=\"$stylestr\""; } if( $url ) { $add = " href=\"" . htmlentities( $url ) . "\""; $tagname = "a"; $text .= "<$tagname$add>"; $in_tag = true; } else if( $stylestr != "" ) { $tagname = "span"; $text .= "<$tagname$stylestr>"; $in_tag = true; } $text .= $tt[1]; } else { $text .= "[" . $parts[$i]; } } if( $in_tag ) { $text .= ""; } } return $text; } $no_auth_cmds = array( "img" => true, "search" => true, "show" => true, "" => true ); if( substr( $cmd, 0, 3 ) == "img" ) { if( !isset( $no_auth_cmds[$cmd] ) && $authlevel <= 0 ) { $cmd = "img_none"; } imagecmd( $G_conn, $cmd, $authenticated, $authlevel ); } else if( substr( $cmd, 0, 4 ) == "rem-" ) { remotecmd( $G_conn, $cmd, $authenticated, $authlevel ); } else { if( !isset( $no_auth_cmds[$cmd] ) && $authlevel <= 0 ) { $cmd = ""; } $showfooter = false; if( $cmd != "foto_save" ) { $showfooter = true; page_header( $authenticated, $authlevel ); } switch( $cmd ) { case "tags": tags_list( $G_conn ); break; case "tags_edit": tags_edit( $G_conn ); break; case "tags_save": tags_save( $G_conn ); break; case "incoming": foto_list_incoming( $G_conn ); break; case "stats": stats_main( $G_conn ); break; case "foto_save": foto_save( $G_conn, $authenticated, $authlevel ); break; case "foto_rot": foto_rot( $G_conn, $authenticated, $authlevel ); break; case "edit": foto_edit( $G_conn ); break; case "show": show( $G_conn, $authenticated, $authlevel ); break; case "search": search( $G_conn, $authenticated, $authlevel ); break; case "": default: tags_show_dated( $G_conn ); break; } if( $showfooter ) { page_footer(); } } ?>