作者:hsnune
项目:drmeatend
function DBExecute($query)
{
$link = DBConnect();
$result = mysqli_query($link, $query) or die(mysqli_error($link));
DBClose($link);
return $result;
}
作者:mailyosanto
项目:portal-vestibula
function DBInsert_Candidato(array $candidato)
{
$link = DBConnect();
$query_inserir = "INSERT INTO candidato (idcandidato, nome, cpf, rua, num, bairro, cidade, cep, fixo, cel, email, curso1, curso2, datahora) VALUES (NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, NOW())";
$stmt = $link->prepare($query_inserir) or die(mysqli_error($link));
if ($stmt) {
$stmt->bind_param("sssissssssss", $candidato["nome"], $candidato["cpf"], $candidato["rua"], $candidato["num"], $candidato["bairro"], $candidato["cidade"], $candidato["cep"], $candidato["fixo"], $candidato["cel"], $candidato["email"], $candidato["opc1"], $candidato["opc2"]);
$resultado = $stmt->execute() ? 1 : 0;
$stmt->store_result();
$stmt->close();
}
DBClose($link);
return $resultado;
}
作者:mailyosanto
项目:portal-vestibula
function DBInsert_Curso(array $curso, $foto1, $foto2, $foto3)
{
$link = DBConnect();
$query_curso = "INSERT INTO curso (idcurso, cod, nome, duracao, periodo, mensalidade, descricao, foto1, foto2, foto3) VALUES (NULL, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
$stmt = $link->prepare($query_curso) or die(mysqli_error($link));
if ($stmt) {
$stmt->bind_param("ssissssss", $curso["cod"], $curso["nome"], $curso["duracao"], $curso["periodo"], $curso["mensalidade"], $curso["descricao"], $foto1, $foto2, $foto3);
$resultado = $stmt->execute() ? 1 : 0;
$stmt->store_result();
$stmt->close();
}
DBClose($link);
return $resultado;
}
作者:aneto0
项目:preavawe
function DBEscape($dados)
{
$link = DBConnect();
if (!is_array($dados)) {
$dados = mysqli_real_escape_string($link, $dados);
} else {
$arr = $dados;
foreach ($arr as $key => $value) {
$key = mysqli_real_escape_string($link, $key);
$value = mysqli_real_escape_string($link, $value);
$dados[$key] = $value;
}
}
DBClose($link);
}
作者:KelCarm
项目:site_vendas_fs
function DBEscape($data)
{
$link = DBConnect();
if (!is_array($data)) {
$data = mysqli_real_escape_string($link, $data);
} else {
$arr = $data;
foreach ($arr as $key => $value) {
$key = DBEscape($key);
$value = DBEscape($value);
$data[$key] = $value;
}
}
DBClose($link);
return $data;
}
作者:lenerd
项目:magi
function DBProtect($dados)
{
//Protege contra SQL Inject
$link = DBConnect();
if (!is_array($dados)) {
$dados = mysqli_real_escape_string($link, $dados);
} else {
$arr = $dados;
foreach ($arr as $key => $value) {
$key = mysqli_real_escape_string($link, $key);
$value = mysqli_real_escape_string($link, $value);
$dados[$key] = $value;
}
}
DBClose($link);
return $dados;
}
作者:joffilyf
项目:boc
function importFromXML($ar, $acr, $contest = 0, $localsite = 0)
{
$data = implode("", explode("\n", $ar));
$parser = xml_parser_create();
xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 1);
xml_parser_set_option($parser, XML_OPTION_SKIP_WHITE, 1);
xml_parse_into_struct($parser, $data, $values, $tags);
xml_parser_free($parser);
// print_r($tags);
// print_r($values);
$orderkeys = array('CONTESTREC', 'SITETIME', 'SITEREC', 'USERREC', 'ANSWERREC', 'LANGUAGEREC', 'PROBLEMREC', 'CLARREC', 'RUNREC', 'TASKREC');
$norderkeys = 10;
$nc = 0;
unset($sitetime);
unset($nsitetime);
$conn = DBConnect();
if ($conn == null) {
return false;
}
// DBExec($conn,"begin work","importFromXML(begin)");
// DBExec($conn,"lock","importFromXML(lock)");
if ($contest != 0) {
$r = DBExec($conn, "select * from contesttable where contestnumber={$contest}");
if (DBnLines($r) == 0) {
echo "Unable to find the contest {$contest} in the database.\n";
DBExec($conn, "rollback work");
return false;
}
$ct = DBRow($r, 0);
if ($localsite == 0) {
$localsite = $ct["contestlocalsite"];
}
} else {
if ($localsite == 0) {
$localsite = 1;
}
}
// $mainsite = $ct["contestmainsite"];
DBClose($conn);
$conn = null;
for ($keyindex = 0; $keyindex < $norderkeys; $keyindex++) {
foreach ($tags as $key => $val) {
if ($values[$val[0]]['type'] != 'open') {
continue;
}
if ($key == "XML") {
continue;
}
if ($key != $orderkeys[$keyindex]) {
continue;
}
if (isset($acr[$key])) {
$ac = $acr[$key];
} else {
continue;
}
foreach ($val as $k => $v) {
if ($values[$v]['type'] != 'open') {
continue;
}
if (count($val) > $k + 1) {
$param = array();
if (isset($ac['site'])) {
for ($i = $v; $i < $val[$k + 1]; $i++) {
$p = strtolower($values[$i]["tag"]);
if ($p == 'site') {
if ($values[$i]["type"] == "complete" && isset($values[$i]["value"])) {
$tmp = sanitizeText(trim(implode('', explode('\\n', $values[$i]["value"]))));
if (is_array($ac['site']) && in_array($tmp, $ac['site'])) {
$param['site'] = $tmp;
} else {
if ($ac['site'] == -1 || $ac['site'] == -2 && $tmp == $localsite || $ac['site'] == -3 && $tmp != $localsite || $ac['site'] > 0 && $ac['site'] == $tmp) {
$param['site'] = $tmp;
}
}
}
}
}
}
for ($i = $v; $i < $val[$k + 1]; $i++) {
$p = strtolower($values[$i]["tag"]);
if (isset($ac[$p]) && $p != 'site') {
if ($values[$i]["type"] == "complete" && isset($values[$i]["value"])) {
if (is_string($ac[$p])) {
$param[$p] = $ac[$p];
} else {
$tmp = sanitizeText(trim(implode('', explode('\\n', $values[$i]["value"]))));
if (is_array($ac[$p]) && in_array($tmp, $ac[$p])) {
$param[$p] = $tmp;
} else {
if ($ac[$p] == -1 || $ac[$p] == -2 && $tmp == $localsite || $ac[$p] == -3 && $tmp != $localsite || $ac[$p] == 0 && isset($param['site']) || $ac[$p] > 0 && $ac[$p] == $tmp) {
$param[$p] = $tmp;
}
}
}
}
}
}
// echo "\nKEY KEY KEY\n";
// print_r($key);
//.........这里部分代码省略.........
作者:mailyosanto
项目:portal-vestibula
<?php
session_start();
if (!isset($_SESSION['login']) && !isset($_SESSION['senha'])) {
session_destroy();
unset($_SESSION['login']);
unset($_SESSION['senha']);
header('location: ../../portal/login.php');
}
?>
<?php
require '../banco/db_curso.php';
$link = DBConnect();
$id = $_GET['id'];
if (isset($id)) {
$query = $link->query("DELETE FROM curso WHERE idcurso = {$id}");
if ($query) {
echo "<script>location.href='../cursos.php';</script>";
} else {
header('location: ../cursos.php');
}
}
$stmt->close();
DBClose($link);
作者:sbaldric
项目:boc
LOGError("Unable to open file (" . basename($fname) . ")");
MSGError("Unable to open file (" . basename($fname) . ")");
echo "<script>window.close();</script></html>";
exit;
}
ob_end_flush();
// echo "</pre>\n";
DB_lo_close($lo);
if ($msg != '') {
// echo " <a href=\"#\" onClick=\"window.print()\"><h1>".$_GET["msg"]."</h1></a>";
echo "\n\n\n" . $msg . "\n";
echo $msg . "\n";
echo $msg . "\n";
}
DBExec($c, "commit work");
DBClose($c);
} else {
header("Expires: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
if (($str = file_get_contents($fname)) === false) {
header("Content-type: text/html");
echo "<html><head><title>View Page</title>";
MSGError("Unable to open file (" . basename($fname) . ")");
LOGError("Unable to open file (" . basename($fname) . ")");
echo "<script>window.close();</script></html>";
exit;
}
header("Content-type: text/plain");
echo decryptData($str, $cf["key"]);
作者:kreapptiv
项目:phprechnun
//
$PDFCompanyLogoHeight = $f['PDF_COMPANY_LOGO_HEIGHT'];
// Company Logo Width PDF
//
$PDFCompanyLogoWidth = $f['PDF_COMPANY_LOGO_WIDTH'];
// PDF Font
//
$PDFFont = $f['PDF_FONT'];
// TEMP Directory for PDF's
// The Webserver must have write access
// for this directory
//
$PDFDirectory = $f['PDF_DIR'];
// PDF Fontsize 1
//
$PDFFontsize1 = $f['PDF_FONT_SIZE1'];
// PDF Fontsize 2
//
$PDFFontsize2 = $f['PDF_FONT_SIZE2'];
// PDF Text Height e. g. Invoice / Offer
//
$PDFTypeHeight = $f['PDF_TYPE_HEIGHT'];
// PDF Attachment Text
//
$PDFAttachmentText = $f['PDF_ATTACHMENT_TEXT'];
}
}
// Close Database Connection ( optional )
//
DBClose();
作者:sbaldric
项目:boc
//.........这里部分代码省略.........
} else {
$yesla = $ans["yes"];
}
} else {
$yesla = 'f';
}
if ($aqui["runanswer"] != "") {
$rrr = DBExec($c, "select * from answertable where answernumber=" . $aqui["runanswer"] . " and contestnumber=" . $aqui["contestnumber"]);
$ans = DBnLines($rrr) > 0 ? DBRow($rrr, 0) : null;
if ($ans == null) {
echo "Problem with the answer table. Unable to send balloon because the answer was " . "not found (run=" . $aqui["runnumber"] . ", site=" . $aqui["runsite"] . ", contest=" . $aqui["contestnumber"] . ", answer=" . $aqui["runanswer"] . ").";
$yesaqui = 'x';
} else {
$yesaqui = $ans["yes"];
}
} else {
$yesaqui = 'f';
}
if ($yesla == 't' && $yesaqui == 'f') {
$rrr = DBExec($c, "select * from sitetable where contestnumber=" . $aqui["contestnumber"] . " and sitenumber={$localsite}");
if (DBnLines($rrr) <= 0) {
echo "Site info not found (contest={$aqui["contestnumber"]}, site={$localsite}).";
} else {
$b = DBRow($rrr, 0);
$ti = $b["sitestartdate"];
$tempo = time();
$ta = $tempo - $ti;
$tf = $b["sitelastmileanswer"];
// if ($ta < $tf) {
$rrr = DBExec($c, "select * from usertable where contestnumber=" . $aqui["contestnumber"] . " and usersitenumber={$localsite} and usernumber=" . $aqui["usernumber"]);
if (DBnLines($rrr) <= 0) {
echo "User info not found (contest={$aqui["contestnumber"]}, " . "site={$localsite}, user={$aqui["runusernumber"]}).";
} else {
$u = DBRow($rrr, 0);
$rrr = DBExec($c, "select * from problemtable where contestnumber=" . $aqui["contestnumber"] . " and problemnumber=" . $aqui["runproblem"]);
if (DBnLines($rrr) <= 0) {
echo "Problem info not found (contest={$aqui["contestnumber"]}, " . "problem={$aqui["runproblem"]}).";
} else {
$p = DBRow($rrr, 0);
mail("balloon@mainserver", "YES: team=" . $u["username"] . ", problem=" . $p["problemname"], "User " . $u["username"] . " should receive a balloon for " . $p["problemfullname"] . "\n");
}
}
// }
}
} else {
if ($yesla == 'f' && $yesaqui == 't') {
$rrr = DBExec($c, "select * from usertable where contestnumber=" . $aqui["contestnumber"] . " and usersitenumber={$localsite} and usernumber=" . $aqui["usernumber"]);
if (DBnLines($rrr) <= 0) {
echo "User info not found (contest={$aqui["contestnumber"]}, " . "site={$localsite}, user={$aqui["runusernumber"]}).";
} else {
$u = DBRow($rrr, 0);
$rrr = DBExec($c, "select * from problemtable where contestnumber=" . $aqui["contestnumber"] . " and problemnumber=" . $aqui["runproblem"]);
if (DBnLines($rrr) <= 0) {
echo "Problem info not found (contest={$aqui["contestnumber"]}, " . "problem={$aqui["runproblem"]}).";
} else {
$p = DBRow($rrr, 0);
mail("balloon@mainserver", "NO: team=" . $u["username"] . ", problem=" . $p["problemname"], "Remove the balloon from user " . $u["username"] . " for " . $p["problemfullname"] . "\n");
}
}
}
}
} else {
$situacao[$j] = "ok";
}
break;
}
}
if ($k >= $nn) {
$situacao[$j] = "inserir";
}
}
$upd = 0;
$ins = 0;
for ($j = 0; $j < $n; $j++) {
$atual = DBRow($r, $j);
if ($atual["runjudge"] == "") {
$atual["runjudge"] = "null";
}
if ($atual["runjudgesite"] == "") {
$atual["runjudgesite"] = "null";
}
if ($atual["updatetime"] == "") {
$atual["updatetime"] = time();
}
if ($situacao[$j] == "atualizar") {
$upd++;
DBExec($c, "update runtable set " . "usernumber=" . $atual["usernumber"] . "," . "rundate=" . $atual["rundate"] . "," . "rundatediff=" . $atual["rundatediff"] . "," . "rundatediffans=" . $atual["rundatediffans"] . "," . "runproblem=" . $atual["runproblem"] . "," . "runlangnumber=" . $atual["runlangnumber"] . "," . "runanswer=" . $atual["runanswer"] . "," . "runstatus='" . escape_string($atual["runstatus"]) . "'," . "runjudge=" . $atual["runjudge"] . "," . "runjudgesite=" . $atual["runjudgesite"] . "," . "runfilename='" . escape_string($atual["runfilename"]) . "'," . "updatetime=" . $atual["updatetime"] . " where contestnumber={$contest} and runsitenumber=" . $atual["runsitenumber"] . " and runnumber=" . $atual["runnumber"] . " and updatetime<" . $atual["updatetime"]);
} else {
if ($situacao[$j] == "inserir") {
$ins++;
echo "Run Inserts shouldn't exist (run=" . $atual["runnumber"] . ")...";
}
}
}
echo " updates={$upd}, insertions={$ins}\n\n";
DBExec($c, "commit work");
DBClose($t);
}
DBClose($c);
}
作者:kreapptiv
项目:phprechnun
function Logout()
{
global $db, $TBLName;
DBConnect();
$db->Execute("DELETE FROM {$TBLName}tmp_invoice WHERE USERNAME='{$_SESSION['Username']}'");
$db->Execute("DELETE FROM {$TBLName}tmp_offer WHERE USERNAME='{$_SESSION['Username']}'");
DBClose();
}