function login($dbdesc)
 {
     $request = $_POST;
     $db = getdb("login", $dbdesc);
     $sql = "SELECT \n\t\t\t\t\t\tid, name, permission_type \n\t\t\t\t\tFROM \n\t\t\t\t\t\tuser \n\t\t\t\t\tWHERE \n\t\t\t\t\t\tname = ? AND \n\t\t\t\t\t\tpassword = SHA1(?) AND \n\t\t\t\t\t\tactive = true;";
     $stmt = $db->prepare($sql);
     echo $db->error;
     $stmt->bind_param("ss", $request["username"], $request["password"]);
     $stmt->execute();
     $result = $stmt->get_result();
     $row = $result->fetch_array();
     if ($result->lengths < 1) {
         error("Fatal: Invalid user name or password used, or your account is not active now.");
     }
     $_SESSION["id"] = $row["id"];
     $_SESSION["name"] = $row["name"];
     $_SESSION["permission_type"] = $row["permission_type"];
     /*
     				Header("HTTP/1.1 303 See Other"); 
     				Header("Location: ".$dbdesc["hmap"][$_SESSION["permission_type"]]);
     				echo "If your browser stayed on this page, click <a href="
     					.$dbdesc["hmap"][$_SESSION["permission_type"]]
     					.">here</a> to your home page.<br />";*/
     echo json_encode(array("status" => "success", "path" => $dbdesc["hmap"][$_SESSION["permission_type"]]));
 }
예제 #2
0
function getmods_db()
{
    $db = getdb();
    $dbmods = array();
    # opening the DB worked
    if ($db) {
        # get that db module list
        $rv = $db->query("SELECT * FROM modules");
        while ($row = $rv->fetchArray()) {
            $dbmods[$row['moddir']] = $row;
        }
    }
    return $dbmods;
}
function getnewest($cat)
{
    // Currently unused...
    $found = 0;
    $count = getrows('all');
    while ($found == 0) {
        $DATA = getdb($count);
        if ($DATA['Category'] == $cat) {
            $found = 1;
        } else {
            $count--;
        }
    }
    return $count;
}
echo $adress1;
?>
	</div>
	<div class="form_row" style="padding-bottom:0px;color:#000;text-align:left">
		<?php 
echo $adress2;
?>
	</div>
	<div class="form_row" style="padding-bottom:0px;color:#000;text-align:left">
		<?php 
echo $postcode . " - " . $city;
?>
	</div>
	<div class="form_row" style="padding-bottom:0px;color:#000;text-align:left">
		<?php 
echo getdb("state", $id_state) . " - " . getdb("country", $id_country);
?>
	</div>
	-->
	<div id="map" style="height: 300px;border:1px solid black">
		
	</div>
</div>

<div class="jqmWindow" id="myOverlay">

<ul class="gallery_demo_unstyled">

    <li><img src="image/galleria/1.jpg" alt="Flowing Rock" title="Flowing Rock Caption"></li>
    <li><img src="image/galleria/2.jpg" alt="Stones" title="Main room"></li>
    <li class="active"><img src="image/galleria/3.jpg" alt="Grass Blades" title="Lounge bar"></li>
예제 #5
0
	(at your option) any later version.

	TorrentFlux is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with TorrentFlux; if not, write to the Free Software
	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
// ADODB support.
require_once 'db.php';
require_once "settingsfunctions.php";
// Create Connection.
$db = getdb();
loadSettings();
session_start("TorrentFlux");
require_once "config.php";
include "themes/" . $cfg["default_theme"] . "/index.php";
global $cfg;
if (isset($_SESSION['user'])) {
    header("location: index.php");
    exit;
}
ob_start();
// authentication
switch ($cfg['auth_type']) {
    case 3:
        /* Basic-Passthru */
    /* Basic-Passthru */
예제 #6
0
function fetch_library($userid)
{
    $stored = cache_fetch($userid, 'user');
    if ($stored !== false) {
        return $stored;
    }
    global $message;
    $codes = array();
    $db = getdb();
    if (!$db) {
        return $codes;
    }
    $sql = 'select now() as now, m.*, u.editable from ' . DB_TABLE . ' m, ' . DB_TABLE . '_users u where u.codeid = m.codeid and u.userid = \'' . $db->escape_string($userid) . '\' order by m.updated desc limit 100';
    $res = $db->query($sql);
    if ($res) {
        require_once 'mapbbcode.php';
        while ($row = $res->fetch_assoc()) {
            $item = array();
            $item['codeid'] = $row['codeid'];
            $item['editid'] = $row['editable'] ? $row['editid'] : '';
            $item['created'] = human_date($row['created'], $row['now']);
            $item['updated'] = human_date($row['updated'], $row['now']);
            $item['title'] = $row['title'];
            $item['stats'] = mapbbcode_stats($row['bbcode']);
            $codes[] = $item;
        }
        $res->free();
        cache_put($userid, 'user', $codes);
    } else {
        $message = 'Failed to retrieve user library: ' . $db->error;
    }
    return $codes;
}
예제 #7
0
function setLocalContent($state)
{
    $db = getdb();
    $db_state = $db->escapeString($state);
    $db->exec("REPLACE INTO prefs (pref, value) values ('show_local_content_link', '{$db_state}')");
    header("HTTP/1.1 200 OK");
    header("Content-Type: application/json");
    echo "{ \"status\" : \"OK\" }\n";
    exit;
}
예제 #8
0
<?php

$cfg["db_host"] = "localhost";
//es la direccion del servidor
$cfg["db_name"] = "encuest5_test";
//es el nombre de la base de datos
$cfg["db_pass"] = "******";
//es la contra del usuario
$cfg["db_user"] = "******";
//es el usuario
function getdb()
{
    global $cfg;
    #es para traer las variables
    $db = mysql_pconnect($cfg["db_host"], $cfg["db_user"], $cfg["db_pass"]);
    $db_sel = mysql_select_db($cfg["db_name"], $db);
    //print_r($db_sel); //indica si hay conección
    //echo($db_sel);
}
getdb();
예제 #9
0
function escape_str($str)
{
    $db = getdb();
    return substr($db->quote($str), 1, -1);
}
예제 #10
0
function updatemods()
{
    # if we don't turn off visible errors, even caught db
    # exceptions will print to the browser (as a "200 OK"),
    # breaking our ability to signal failure
    ini_set('display_errors', '0');
    $position = 1;
    try {
        $db = getdb();
        if (!$db) {
            throw new Exception($db->lastErrorMsg);
        }
        # figure out which modules to hide
        $hidden = array();
        if (isset($_GET['hidden'])) {
            foreach (explode(",", $_GET['hidden']) as $moddir) {
                $hidden[$moddir] = 1;
            }
        }
        $db->exec("BEGIN");
        # go to the DB and set the new order and new hidden state
        foreach (explode(",", $_GET['moddirs']) as $moddir) {
            $moddir = $db->escapeString($moddir);
            if (isset($hidden[$moddir])) {
                $is_hidden = 1;
            } else {
                $is_hidden = 0;
            }
            $rv = $db->exec("UPDATE modules SET position = '{$position}', hidden = '{$is_hidden}'" . " WHERE moddir = '{$moddir}'");
            if (!$rv) {
                throw new Exception($db->lastErrorMsg());
            }
            ++$position;
        }
    } catch (Exception $ex) {
        $db->exec("ROLLBACK");
        error_log($ex);
        header("HTTP/1.1 500 Internal Server Error");
        exit;
    }
    $db->exec("COMMIT");
    # restart kiwix so it sees what modules are visible/hidden
    kiwix_restart();
    header("HTTP/1.1 200 OK");
}
echo $_SESSION["post_adress1"];
?>
	</div>
	<div class="form_row" style="padding-bottom:0px;color:#000;text-align:left">
		<?php 
echo $_SESSION["post_adress2"];
?>
	</div>
	<div class="form_row" style="padding-bottom:0px;color:#000;text-align:left">
		<?php 
echo $_SESSION["post_postcode"] . " - " . $_SESSION["post_city"];
?>
	</div>
	<div class="form_row" style="padding-bottom:0px;color:#000;text-align:left">
		<?php 
echo getdb("state", $_SESSION["post_state"]) . " - " . getdb("country", $_SESSION["post_country"]);
?>
	</div>
	-->
	<div id="map" style="width: 330px; height: 300px;border:1px solid black">
		
	</div>
</div>


<div style="clear: left;"></div>
</div>



<?php

function config($var = '')
{
    $values = array('system_mail_from' => '', 'base_url' => '', 'password' => '', 'db_user' => '', 'db_pass' => '', 'db_name' => '', 'db_host' => 'localhost', 'capture_redirects' => 0, 'show_queries' => 1, 'show_debug' => 1, 'send_mail' => 1);
    if (array_key_exists($var, $values)) {
        return $values[$var];
    }
    if ($var == '') {
        return $values;
    } else {
        return false;
    }
}
function template_config()
{
    return array('base_dir' => "", 'template' => 'templates', 'compile' => 'templates_c', 'cache' => 'cache', 'config' => 'configs');
}
ini_set("display_errors", 1);
error_reporting(E_ALL & ~E_DEPRECATED);
date_default_timezone_set("America/Chicago");
require_once "includes/db/base.php";
$db = getdb('mysql:host=' . config('db_host') . ';dbname=' . config('db_name'), config('db_user'), config('db_pass'));
예제 #13
0
function get_data($codeid)
{
    if (!preg_match('/^[a-z]+$/', $codeid)) {
        return;
    }
    $data = cache_fetch($codeid, 'code');
    if ($data) {
        return $data;
    }
    $db = getdb();
    if (!$db) {
        return false;
    }
    $res = $db->query('select editid, title, bbcode from ' . DB_TABLE . " where codeid = '{$codeid}'");
    $assoc = $res->num_rows > 0 ? $res->fetch_assoc() : false;
    $res->free();
    cache_put($codeid, 'code', $assoc);
    cache_purge();
    // since we've accessed the db, why not purge the cache?
    return $assoc;
}
예제 #14
0
function escapesql($string = "", $int = 0)
{
    global $db;
    if (empty($db)) {
        $db = getdb();
    }
    if ($string) {
        $string = $db->quote($string);
    }
    if (!strlen($string) && $int) {
        $string = 'NULL';
    } else {
        if (!strlen($string)) {
            $string = '0';
        }
    }
    return $string;
}
예제 #15
0
function show_local_content_link()
{
    $db = getdb();
    $rv = $db->querySingle("SELECT 1 FROM prefs WHERE pref = 'show_local_content_link' AND value = '1'");
    return $rv;
}