Esempio n. 1
0
function erro($msg, $id_conn)
{
    echo $msg;
    execute_query("END TRANSACTION", $id_conn);
    execute_query("ROLLBACK", $id_conn);
    close_database($id_conn);
    return;
}
Esempio n. 2
0
function print_footer($msg = "")
{
    if ($msg != "") {
        print "<hr/>\n";
        print "{$msg}\n";
    }
    print "<hr/>\n";
    print "<div style='float: left'><a href='http://pecanproject.org'>PEcAn Project</a></div>\n";
    print "<div style='float: right'><a href='http://betydb.org'>BETY Project</a></div>\n";
    print "</body>\n";
    print "</html>\n";
    close_database();
}
Esempio n. 3
0
function grava_usuario()
{
    $filename = upload_foto();
    require '../config/infodbcon.php';
    require '../config/database.php';
    $id_conn = open_database();
    $post = array_map("mysql_real_escape_string", $_POST);
    execute_query("START TRANSACTION", $id_conn);
    if ($post['cmb_cadastro'] == '0') {
        $sql = 'INSERT INTO tb_usuario ';
        $sql .= '(usuario_nome, usuario_login, usuario_senha, usuario_email, usuario_foto, usuario_info, usuario_ativo)';
        $sql .= 'VALUES ';
        $sql .= '(\'' . addslashes(utf8_decode($_POST['nome'])) . '\', \'' . utf8_decode($post['login']) . '\', ';
        $sql .= '\'' . md5('123mudar') . '\', \'' . $post['email'] . '\',';
        $sql .= '\'' . $filename . '\', \'' . addslashes(utf8_decode($_POST['infor'])) . '\', \'' . ($post['ativo'] ? 1 : 0) . '\')';
    } else {
        $sql = 'UPDATE tb_usuario SET ';
        $sql .= 'usuario_nome = \'' . addslashes(utf8_decode($_POST['nome'])) . '\', usuario_login = \'' . $post['login'] . '\', ';
        $sql .= 'usuario_email = \'' . $post['email'] . '\', ';
        $sql .= 'usuario_info=\'' . addslashes(utf8_decode($_POST['infor'])) . '\', ';
        $sql .= 'usuario_ativo=\'' . (isset($post['ativo']) ? 1 : 0) . '\' ';
        if ($post['trocoufoto']) {
            $sql .= ',usuario_foto=\'' . $filename . '\' ';
        }
        $sql .= 'WHERE ';
        $sql .= 'usuario_id=' . $post['cmb_cadastro'];
    }
    if (!execute_query($sql, $id_conn)) {
        $messagem = utf8_decode('Query Inválida: ') . mysql_error() . "\n";
        $messagem .= 'Pesquisa Inteira: ' . $sql;
        echo $messagem;
        execute_query("ROLLBACK", $id_conn);
    } else {
        execute_query('COMMIT', $id_conn);
        echo '1';
    }
    execute_query("END TRANSACTION", $id_conn);
    close_database($id_conn);
}
Esempio n. 4
0
 */
// Check login
require "common.php";
if ($authentication) {
    open_database();
    if (!check_login()) {
        header("Location: index.php");
        close_database();
        exit;
    }
    if (get_page_acccess_level() > $min_run_level) {
        header("Location: history.php");
        close_database();
        exit;
    }
    close_database();
}
?>
<!DOCTYPE html>
<html>
<head>
<title>EBI Sites</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" type="text/css" href="sites.css" />
<script type="text/javascript" src="jquery-1.7.2.min.js"></script>
<script type="text/javascript">
    function validate() {
        $("#error").html("");
    }
        
Esempio n. 5
0
<?php

/*
    @Autor: Clésio Teixeira da Silva
    @Versão: 2.2
    @Última Alteração: 14/09/2015
*/
session_start();
// arquivo de funções.
require "../funcoes/php/funcao.php";
//Função encontrada dentro do arquivo funcao.php. Tem como incumbência verificar se o usuário está logado.
session_checker();
require "../config/infodbcon.php";
require "../config/database.php";
$id_conn = open_database();
libera_acesso('colecao', $id_conn);
close_database($id_conn);
require '../html/colecao.html';
echo '<script>foto_usuario(\'' . $_SESSION['usuario_id'] . '\')</script>';
exit;
Esempio n. 6
0
function DeleteFileFromDatabase($md5)
{
    if (!open_database()) {
        return array();
    }
    $results = exec_query("DELETE FROM storage WHERE md5 = '" . escape_string($md5, false) . "'", false);
    close_database();
    return $results;
}
Esempio n. 7
0
function cleanSearchTables()
{
    // Clean up the database tables before performing a new search or updating the collection
    debuglog("Cleaning Search Results", "MYSQL", 6);
    // Any track that was previously hidden needs to be re-hidden
    generic_sql_query("UPDATE Tracktable SET Hidden = 1, isSearchResult = 0 WHERE isSearchResult = 3");
    // Any track that was previously a '2' (added to database as search result) but now
    // has a playcount needs to become a zero and be hidden.
    hide_played_tracks();
    // remove any remaining '2's
    generic_sql_query("DELETE FROM Tracktable WHERE isSearchResult = 2");
    // Set '1's back to '0's
    generic_sql_query("UPDATE Tracktable SET isSearchResult = 0 WHERE isSearchResult = 1");
    // This may leave some orphaned albums and artists
    remove_cruft();
    //
    // remove_cruft creates some temporary tables and we need to remove them because
    // remove cruft will be called again later on if we're doing a collection update.
    // Sadly, DROP TABLE runs into locking problems, at least with SQLite, so instead
    // we close the DB connection and start again.
    // So this function must be called BEFORE prepareCollectionUpdate, as that creates
    // temporary tables of its own.
    //
    close_database();
    sleep(1);
    connect_to_database();
}
Esempio n. 8
0
function erro($msg, $id_conn)
{
    echo json_encode(array('id' => '-1', 'msg' => $msg));
    execute_query("END TRANSACTION", $id_conn);
    execute_query("ROLLBACK", $id_conn);
    close_database($id_conn);
    return;
}