本文整理汇总了PHP中dbopen函数的典型用法代码示例。如果您正苦于以下问题:PHP dbopen函数的具体用法?PHP dbopen怎么用?PHP dbopen使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dbopen函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: joke_query_comic
function joke_query_comic($page, $timestamp)
{
$sql = "select id,title,text,image,datetime from joke_18plus";
// condition
$sqlcond = sprintf("datetime<='%s'", date("Y-m-d H:i:s", $timestamp));
$sql = $sql . " where " . $sqlcond;
// order
$sql = $sql . " order by datetime desc";
// page
$page = $page < 1 ? 1 : $page;
$sql = $sql . sprintf(" limit %d,50", ($page - 1) * 50);
// query
$db = dbopen("joke");
if ($db->connect_errno) {
echo "mysql error " . $db->connect->error;
return;
}
$res = $db->query($sql);
$comics = array();
while ($row = $res->fetch_assoc()) {
$comic = array();
$comic["id"] = $row["id"];
$comic["title"] = $row["title"];
$comic["content"] = $row["text"];
$comic["image"] = split(",", $row["image"]);
$comic["datetime"] = $row["datetime"];
$comics[] = $comic;
// add book
}
$res->free();
return $comics;
}
示例2: ts_query
function ts_query($page, $limit)
{
$sql = sprintf("select * from ts order by datetime desc");
// page
$page = $page < 1 ? 1 : $page;
$sql = $sql . sprintf(" limit %d,50", ($page - 1) * 50);
// query
$db = dbopen("feedback");
if ($db->connect_errno) {
echo "mysql error " . $db->connect->error;
return;
}
$res = $db->query($sql);
$items = array();
while ($row = $res->fetch_assoc()) {
$item = array();
$item["user"] = $row["user"];
$item["datetime"] = $row["datetime"];
$item["content"] = $row["content"];
$item["contact"] = $row["contact"];
$items[] = $item;
}
$res->free();
return $items;
}
示例3: joke_feedback
function joke_feedback($user, $contact, $feedback)
{
// items
$datetime = date_format(date_create(), 'Y-m-d H:i:s');
$sql = sprintf("insert into feedback (user, datetime, contact, content) values ('%s', '%s', '%s', '%s')", $user, $datetime, $contact, $feedback);
// query
$db = dbopen("joke");
if ($db->connect_errno) {
echo "mysql error " . $db->connect->error;
return;
}
$res = $db->query($sql);
}
示例4: gettablelocal
function gettablelocal($pfad, $database, $db, $dbid, $bemerk)
{
$dbget = dbopen($pfad, $database);
$qrydel = "DELETE FROM tbltable WHERE fldid_database=" . $dbid;
$db->exec($qrydel);
$sql = "SELECT name FROM sqlite_master WHERE type='table'";
$results = dbquery($pfad, $dbget, $sql);
$anz = 0;
$dbrowarr = array();
while ($row = dbfetch($pfad, $results)) {
$menge = array_push($dbrowarr, $row);
$anz = $anz + 1;
}
for ($i = 0; $i < $anz; $i++) {
$qryins = "INSERT INTO tbltable (fldid_database,fldbez,fldtyp) VALUES (" . $dbid . ",'" . $dbrowarr[$i]['name'] . "','')";
//echo $qryins."<br>";
$db->exec($qryins);
}
echo "<div class='alert alert-success'>";
echo $anz . " Tables ausgelesen für " . $bemerk . ".";
echo "</div>";
}
示例5: dbopen
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Book Detail</title>
<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<body>
<div id="books">
<?php
require "php/db.inc";
require "php/util.inc";
$db = dbopen("books");
if ($db->connect_errno) {
echo "mysql error " . $db->connect->error;
}
$book = php_reqvar("book", "");
if ($book < 1) {
echo "book is is null." . $book;
}
$sql = sprintf("select * from books where bid=%d", $book);
$res = $db->query($sql);
assert($res->num_rows == 1);
while ($row = $res->fetch_assoc()) {
echo "<table width=\"100%\">";
echo "<tr style=\"background-color: #CCCCCC\">";
echo "<td width=50px><a href='" . $row["uri"] . "'>" . $row["bid"] . "</a></td>";
echo "<td width=75px>" . $row["category"] . "</td>";
echo "<td width=20%>" . $row["name"] . "</td>";
echo "<td width=15%>" . $row["author"] . "</td>";
echo "<td width=120px>" . $row["datetime"] . "</td>";
echo "<td width=50px>" . $row["vote"] . "</td>";
示例6: dbopen
<?php
include "classes/dbtool.php";
include "config.php";
echo "<html>";
echo "<head>";
echo " <meta charset='utf-8'>";
echo " <meta name='viewport' content='width=device-width, initial-scale=1.0, user-scalable=no'>";
echo " <title>MySQLiteSync</title>";
// <!-- Bootstrap -->
echo " <link href='includes/bootstrap/css/bootstrap.min.css' rel='stylesheet'>";
echo "</head>";
echo "<body>";
$db = dbopen('', 'data/mysqlitesync.db');
$parentid = $_GET['id'];
if ($parentid == "") {
$parentid = '0';
}
echo "<div>";
echo "<h1 align='center'>MySQLiteSync</h1>";
if ($admin == "J") {
$sql = "SELECT * FROM tblmenu_liste WHERE fldview='J' AND fldid_parent='" . $parentid . "' ORDER BY fldsort";
} else {
$sql = "SELECT * FROM tblmenu_liste WHERE fldview='J' AND fldadmin='N' AND fldid_parent='" . $parentid . "' ORDER BY fldsort";
}
$results = dbquery('', $db, $sql);
while ($row = dbfetch('', $results)) {
if ($row['fldmenu'] == "SUBMENU") {
echo "<a href='index.php?id=" . $row['fldindex'] . "&lastid=" . $parentid . "' class='btn btn-default btn-lg btn-block glyphicon " . $row['fldglyphicon'] . "' role='button'> " . $row['fldbez'] . "</a>";
} else {
if ($row['fldlink'] != "") {
示例7: array
}
if ($_SERVER['REQUEST_METHOD']=='POST') {
ob_start();
require 'bin/lib/webgui.php';
$STDIN=@fopen('php://input','rb');
if ($STDIN===false) die('{"err":"Invalid Request"}');
$JSON=fgets($STDIN,65535);
$JSON=trim($JSON,"\t\r\n ");
$JSON=json_decode($JSON,true);
if (!is_array($JSON)) die('{"err":"Invalid Request"}');
$CMD=array();
$OUTJSON=array();
if (!isset($JSON['t']) or !is_numeric($JSON['t']) or strpos(AJ_LIST,' '.$JSON['t'].' ')===false) die('{"err":"Invalid Request type"}');
if (is_array($ini['db']) && !$DBH) dbopen($DBH);
WGSGarbage();
$t0=WGSession();
if (isset($ini['auth']) or isset($ini['logon']) and !$t0) {
if ($JSON['t']!=AJ_SYSTEM) WGLockGui(3,"Session");
}
if (isset($JSON['url'])) $JSON['url'] = WGExpandUrl($JSON['url']);
if ($JSON['t']==AJ_DIALOG) {
$JSON['url']='bin/dlg/'.$JSON['url'].'.app';
$WEBGUI['dialog'] = array(
"dialog"=> array(
"by" => $JSON['by'] ,
"datum" => $JSON['datum'],
示例8: add_menu
<?php
include "util.php";
include "../db/smssndbconn.php";
include "menu.php";
add_menu("../");
$con = dbopen();
$array = getRequests();
$groupid = "";
for ($i = 0; $i < count($array); $i++) {
if (false == strpos($array[$i], "=")) {
continue;
}
list($name, $value) = explode("=", $array[$i]);
if ($name == "id") {
$groupid = urldecode($value);
}
}
$sql = "SELECT id, name FROM bpgroups";
if ($groupid != 0) {
$sql .= " where id=" . $groupid;
}
if (!($result = mysqli_query($con, $sql))) {
echo "Error description: " . mysqli_error($con);
}
$num = mysqli_num_rows($result);
if ($num == 0) {
?>
<center>
Group <?php
示例9: insertsave
function insertsave($pararray, $listarray, $menu, $show, $autoinc_step, $autoinc_start, $menugrp)
{
echo "<a href='showtab.php?menu=" . $menu . "&menugrp=" . $menugrp . "' class='btn btn-primary btn-sm active' role='button'>Liste</a>";
$db = dbopen('../', '../data/mysqlitesync.db');
// echo $db->lastErrorMsg()."<br>";
//$sqlid = "select ".$pararray['fldindex']." from ".$pararray['dbtable']." order by ".$pararray['fldindex']." desc limit 1";
$sqlid = "SELECT * FROM tblindex WHERE fldtable='" . $pararray['dbtable'] . "'";
$results = $db->query($sqlid);
if ($row = $results->fetchArray()) {
$newrowid = $row['fldid'] + $autoinc_step;
//echo $newrowid."=newrowid<br>";
} else {
$newrowid = $autoinc_start;
}
$prozref = "N";
$dbtable = $pararray['dbtable'];
$sql = "INSERT INTO " . $dbtable . " (" . $pararray['fldindex'] . ",";
foreach ($listarray as $arrelement) {
if ($arrelement['fieldsave'] != "NO") {
switch ($arrelement['type']) {
case 'text':
$sql = $sql . $arrelement['dbfield'] . ",";
break;
case 'select':
$sql = $sql . $arrelement['dbfield'] . ",";
break;
case 'selectid':
$sql = $sql . $arrelement['dbfield'] . ",";
break;
case 'time':
$sql = $sql . $arrelement['dbfield'] . ",";
break;
case 'date':
$sql = $sql . $arrelement['dbfield'] . ",";
break;
case 'calc':
$sql = $sql . $arrelement['dbfield'] . ",";
break;
case 'timestamp':
$sql = $sql . $arrelement['dbfield'] . ",";
break;
}
}
}
$sql = substr($sql, 0, -1) . ") VALUES (" . $newrowid . ",";
foreach ($listarray as $arrelement) {
if ($arrelement['fieldsave'] != "NO") {
switch ($arrelement['type']) {
case 'text':
$sql = $sql . "'" . $_POST[$arrelement['dbfield']] . "',";
break;
case 'selectid':
$sql = $sql . "'" . $_POST[$arrelement['name']] . "',";
break;
case 'select':
$sql = $sql . "'" . $_POST[$arrelement['name']] . "',";
break;
case 'time':
$sql = $sql . "'" . $_POST[$arrelement['dbfield']] . "',";
break;
case 'date':
$sql = $sql . "'" . $_POST[$arrelement['dbfield']] . "',";
break;
case 'calc':
$sql = $sql . "'" . $_POST[$arrelement['dbfield']] . "',";
break;
case 'timestamp':
$sql = $sql . "CURRENT_TIMESTAMP,";
break;
case 'prozref':
$prozref = "J";
$dbfield = $arrelement['dbfield'];
break;
}
}
}
$sql = substr($sql, 0, -1) . ")";
//echo $sql."<br>";
$db->exec($sql);
$sqlid = "SELECT last_insert_rowid() as lastid FROM " . $pararray['dbtable'];
$results = $db->query($sqlid);
if ($row = $results->fetchArray()) {
$rowid = $row[0];
//echo $rowid."=rowid<br>";
}
if ($show == "anzeigen") {
echo "<div class='alert alert-success'>";
echo $sql . "<br>";
echo $db->lastErrorMsg() . "<br>";
echo "</div>";
}
if ($prozref == "J") {
$sqlfil = "SELECT * FROM tblfilter WHERE fldtablename='tblorte' AND fldfeld='fldid_suchobj'";
$resfil = $db->query($sqlfil);
if ($rowfil = $resfil->fetchArray()) {
if ($rowfil['fldwert'] != "(ohne)") {
$sqlsuch = "SELECT * FROM tblsuchobj WHERE fldbez='" . $rowfil['fldwert'] . "'";
$ressuch = $db->query($sqlsuch);
if ($rowsuch = $ressuch->fetchArray()) {
$refwhere = "fldid_suchobj=" . $rowsuch['fldindex'] . " AND fldid_orte=" . $rowid;
//.........这里部分代码省略.........
示例10: htmlspecialchars
<?
if (!isset($ini)) return;
if (count($_POST) and $_POST['logonui']==1) {
if (!$DBH) dbopen($DBH);
if (WGLogonUser($_POST['a'],$_POST['b']) and WGSession()) {
$WEBGUIhttpAuth=true;
return;
}
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title><?php
echo htmlspecialchars(@$ini['webgui']['title'], ENT_QUOTES);
?>
</title>
<?
if (@$ini['webgui']['cookie']) echo "<script src=\"/sys/cookie.js\"></script>\n";
?>
<link rel="stylesheet" href="/sys/win.css">
<link rel="stylesheet" href="/img/style.css">
<!--
EPTO WebGui V 8.0
(C) 2015 EPTO (A)
-->
</head>
<body>
示例11: dbopen
<?php
include "dbtool.php";
$pfad = $_GET['pfad'];
$database = $_GET['database'];
$bemerk = $_GET['bemerk'];
$dbid = $_GET['dbid'];
//echo $pfad.",".$database."pfad,database<br>";
$dbget = dbopen($pfad, $database);
$sql = "SELECT name FROM sqlite_master WHERE type='table'";
$results = dbquery($pfad, $dbget, $sql);
$anz = 0;
$dbrowarr = array();
while ($row = dbfetch($pfad, $results)) {
$menge = array_push($dbrowarr, $row);
$anz = $anz + 1;
}
echo "<div class='alert alert-success'>";
echo $anz . " Tables ausgelesen für " . $bemerk . ".";
echo "</div>";
$website = "http://localhost:8080/own/mysqlitesync/classes/gettablestruc.php?menu=table&dbid=" . $dbid;
echo "<form class='form-horizontal' method='post' action='" . $website . "'>";
echo "<input type='hidden' name='status' value='empfangen'/>";
for ($i = 0; $i < $anz; $i++) {
echo "<input type='hidden' name='dbid" . $i . "' value='" . $dbid . "'/>";
echo "<input type='hidden' name='name" . $i . "' value='" . $dbrowarr[$i]['name'] . "'/>";
}
echo "<input type='hidden' name='datcnt' value='" . $anz . "'/>";
echo "<dd><input type='submit' value='Get Table' /></dd>";
echo "</form>";
示例12: check_version
echo "<h1 align='left'>" . $headline . "</h1>";
echo "<div class='alert alert-success'>";
echo "Bitte erzeugen Sie das Unterverzeichnis 'data' im Verzeichnis '" . $dir . "' mit Schreibrechten und rufen diese Seite zur weiteren Installation erneut auf.";
echo "</div>";
echo "<a href='index.php' class='btn btn-primary btn-sm active' role='button'>Neustart</a><br>";
} else {
include "classes/install.php";
}
} else {
$dirdb = $dirdata . "/" . $database;
if (!file_exists($dirdb)) {
include "classes/install.php";
} else {
include "classes/checkupgrade.php";
check_version();
$db = dbopen('', 'data/' . $database);
$parentid = $_GET['id'];
if ($parentid == "") {
$parentid = '0';
}
echo "<div>";
echo "<h1 align='center'>" . $headline . "</h1>";
if ($admin == "J") {
$sql = "SELECT * FROM tblmenu_liste WHERE fldview='J' AND fldid_parent='" . $parentid . "' ORDER BY fldsort";
} else {
$sql = "SELECT * FROM tblmenu_liste WHERE fldview='J' AND fldadmin='N' AND fldid_parent='" . $parentid . "' ORDER BY fldsort";
}
$results = dbquery('', $db, $sql);
while ($row = dbfetch('', $results)) {
if ($row['fldmenu'] == "SUBMENU") {
echo "<a href='index.php?id=" . $row['fldindex'] . "&lastid=" . $parentid . "' class='btn btn-default btn-lg btn-block glyphicon " . $row['fldglyphicon'] . "' role='button'> " . $row['fldbez'] . "</a>";
示例13: db_delete
function db_delete($sql, $data)
{
$db_connection = dbopen();
$statement = prepare_statement($sql, $data, $db_connection);
$statement->execute();
$statement->free_result();
return;
}
示例14: bootstraphead
<?php
include "bootstrapfunc.php";
include "dbtool.php";
include "gettablestrucfunc.php";
bootstraphead();
bootstrapbegin("Get Tables<br>");
$menu = $_GET['menu'];
$dbid = $_GET['dbid'];
echo "<a href='showtab.php?menu=" . $menu . "&dbid=" . $dbid . "' class='btn btn-primary btn-sm active' role='button'>Zurück</a> ";
$db = dbopen('../', '../data/mysqlitesync.db');
$sql = "SELECT * FROM tbldatabase WHERE fldindex=" . $dbid;
$results = $db->query($sql);
if ($row = dbfetch('../', $results)) {
$database = $row['fldbez'];
$bemerk = $row['fldbemerk'];
$pfad = $row['fldpfad'];
$idsel = $row['fldid_select'];
//echo $pfad.",".$database."=pfad,database<br>";
}
$status = $_POST['status'];
if ($status == "empfangen") {
$datcnt = $_POST['datcnt'];
$bemerk = "";
gettableempfangen($datcnt, $bemerk);
} else {
if ($idsel == 1) {
gettablelocal($pfad, $database, $db, $dbid, $bemerk);
} else {
echo "<div class='alert alert-warning'>";
echo "Remote-Funktion gestartet.";
示例15: form_running_post
function form_running_post($rawData,$data) {
global $ini;
global $DBERROR;
global $DBH;
global $WEBGUI;
if (@$ini['webgui']['cansetup']!='webgui') FatalError("Setup Bloccato");
$path = $_SERVER['DOCUMENT_ROOT'].$WEBGUI['rvar']['APPPATH'];
$DBERROR=catchDBError;
if ($data['dbp1']!=$data['dbp2']) return LocalError("Le password del database non coincidono.");
if ($data['rp1']!=$data['rp2']) return LocalError("Le password di root non coincidono.");
$x = $_SERVER['DOCUMENT_ROOT'].'/etc/InstallHash';
if (file_exists($x)) {
$x = @file_get_contents($x);
if ($x===false) FatalError("Non riesco a leggere `InstallHash`");
list($a,$b)=@explode(' ',$x,2);
$x = $a.' '.$data['root'].':'.$data['rp1'];
$x = md5($x);
$b=strtolower($b);
if ($b!=$x) return LocalError("La login e la password di root non coincidono con quelle precedentemente segnalate nel file `InstallHash`\nRimuovere il file oppure usare le credenziali corrette.");
}
$ini['db'] = array(
'mysql'=> ($data['mysql'] ? $data['mysql'] : '127.0.0.1') ,
'db' => $data['db'],
'dblog'=> $data['dbl'],
'dbpas'=> $data['dbp1'])
;
$ini['db']['ok'] = true;
dbopen($DBH);
if ($ini['db']['ok']==false) return LocalError("Errore accesso database: {$ini['db']['err']}");
unset($ini['db']['ok']);
unset($ini['db']['err']);
if (!isset($ini['webgui'])) $ini['webgui']=array();
$ini['webgui']['title'] = $data['title'];
unset($ini['webgui']['autoexec']);
if (isset($ini['webgui']['install-autoexec'])) {
$ini['webgui']['autoexec']=$ini['webgui']['install-autoexec'];
unset($ini['webgui']['install-autoexec']);
}
unset($ini['allowdir']);
$a = array(
'etc',
'etc/conf.d',
'etc/desktop.json',
'etc/start.json',
'etc/mime.json',
'etc/mimehome.json',
'etc/server.php',
'tmp',
'var/cache',
'var/cache/font.json',
'var/cache/font.css',
'home',
'usr',
'bin/app/grp',
'bin/usr',
'bin/dlg',
'bin/dll',
'bin/font',
'bin/mod',
'bin/php',
'bin/theme',
'bin/wgx',
'bin/mime',
'bin/mime/ico')
;
foreach($a as $b) {
$c=$_SERVER['DOCUMENT_ROOT'].'/'.$b;
if (@file_exists($c) and @chmod($c,0770)==false ) return LocalError("Non riesco ad impostare i permessi su $b");
}
$dh=@opendir($path.'etc');
if ($dh===false) FatalError("Non trovo la directory skel file di installazione {$path}etc");
while($f=readdir($dh)) {
if (is_dir( $path.'etc/'.$f ) or $f[0]=='.') continue;
$dt = @file_get_contents($path.'etc/'.$f);
if ($dt===false) return LocalError("Non riesco a leggere `$f`");
if (@file_put_contents( $_SERVER['DOCUMENT_ROOT'].'/etc/'.$f , $dt ) == false ) return LocalError("No riesco a copiare: $f");
}
closedir($dh);
$dh=@opendir($path.'setup');
if ($dh===false) FatalError("Non trovo la directory skel file di installazione {$path}setup");
$lst=array();
while($f=readdir($dh)) {
$tf=$path.'setup/'.$f;
if (is_dir( $tf ) or $f[0]=='.') continue;
if (preg_match('/\.sql$/',$f)!=0) {
$a = intval($f);
//.........这里部分代码省略.........