function getScalar($query) { $result = getRow($query); if (!$result) { return false; } return array_pop($result); }
public function index() { try { $order = 1; if (isset($_REQUEST["order"])) { $order = intval($_REQUEST["order"]); } $roomDAO = CreateObject("Model_DAO_Room"); $tempOrder = $this->getTempOrder($order); //dieu kien where $where = ""; $where = $roomDAO->getWhere(); //echo $where; if (strlen($where) != 0) { $where = " where " . $where; } $this->getObjectSearch(); // end dieu kien where $sql = "select * from " . table_prefix("room") . " " . $where . " " . $tempOrder; //echo $sql; $page = 1; if (isset($_REQUEST["p"])) { $page = intval($_REQUEST["p"]); } $row_total = getRow($sql); $page_size = 6; $pagegroup_size = 5; if (isset($_REQUEST["order"])) { $url = "index.php?rt=inex/index&order={$order}"; } else { $url = "index.php?rt=inex/index"; } $rooms = $roomDAO->lists($order, $page * $page_size - $page_size, $page_size); $this->registry->template->page = $page; $this->registry->template->row_total = $row_total; $this->registry->template->page_size = $page_size; $this->registry->template->pagegroup_size = $pagegroup_size; $this->registry->template->url = $url; $this->registry->template->rooms = $rooms; $this->registry->template->roomDAO = $roomDAO; if (isset($_SESSION["listSoSanh"])) { $arrs = $_SESSION["listSoSanh"]; $roomSoSanhs = array(); foreach ($arrs as $item) { $obj = $roomDAO->get($item); $roomSoSanhs[] = $obj; } $this->registry->template->roomSoSanhs = $roomSoSanhs; $this->registry->template->order = $order; } $searchObj = $_SESSION["searchObj"]; $this->registry->template->searchObj = $searchObj; $this->registry->template->show('index_index'); } catch (MyException $ex) { $ex->__toString(); } }
function getCuentasEmailsTo() { $sql = "SELECT * FROM cuentas_emails_to"; $resultSet = getRS($sql); $result = array(); while ($row = getRow($resultSet)) { $result[$row["email"]] = $row["email"]; } return $result; }
function contactInfo($db, $call) { $contacts = ''; $q3 = "SELECT contact, validity " . "FROM ares_contact_info " . "WHERE `type` = 4 AND `call`='" . $call . "'"; //echo "<p>[" . $q3 . "]</p>\n"; $r3 = getResult($q3, $db); if ($row3 = getRow($r3, $db)) { $contacts = $row3[0]; } echo $contacts . ", "; }
private function completeInfoForApart($apartId) { $SQL = "SELECT * FROM apartments a " . "WHERE id = " . $apartId; try { $row = getRow($SQL); } catch (Exception $e) { throw new Exception("Unable to get apartment info from database"); } if (!$row) { throw new Exception("An apartment doesn't exist in the database"); } return $row; }
function valorizarPorCliente($year = null, $paraGraf = false) { $data = ""; $sql = "SELECT *\n\t\t\t\tFROM\n\t\t\t\t(\n\t\t\t\t SELECT t2.id_cliente, t2.razon_social_cliente, SUM(t1.total_venta) total_por_cliente\n\t\t\t\t FROM ventas t1\n\t\t\t\t INNER JOIN clientes t2 ON t2.id_cliente=t1.id_cliente\n\t\t\t\t WHERE t1.id_registro_estado=1\n\t\t\t\t AND EXTRACT(YEAR FROM t1.fecha_venta) = {$year}\n\t\t\t\t GROUP BY t2.id_cliente\n\t\t\t\t) rs1\n\t\t\t\tORDER BY total_por_cliente DESC"; $rs = getRS($sql); $sql = "SELECT SUM(t1.total_venta) total_por_anio\n\t\t\t\t FROM ventas t1\n\t\t\t\t WHERE t1.id_registro_estado=1\n\t\t\t\t AND EXTRACT(YEAR FROM t1.fecha_venta) = {$year}"; $rsTotalPorAnio = getRS($sql); $rowTotalPorAnio = getRow($rsTotalPorAnio); $totalPorAnio = $rowTotalPorAnio["total_por_anio"]; $porc_cte = 0; $total_acum = 0; $porc_fact = 0; $porc_acum = 0; $nroDeClientes = getNrosRows($rs); if ($nroDeClientes) { $nro = 1; while ($row = getRow($rs)) { $porc_cte = round($nro * 100 / $nroDeClientes, 2); $porc_fact = round($row["total_por_cliente"] * 100 / $totalPorAnio, 4); $porc_acum += $row["total_por_cliente"] * 100 / $totalPorAnio; $total_acum += $row["total_por_cliente"]; $porc_item = round($porc_acum, 4); if ($porc_item >= 0 && $porc_item <= 80) { $clase = "A"; } else { if ($porc_item > 80 && $porc_item <= 90) { $clase = "B"; } else { $clase = "C"; } } if (!$paraGraf) { $data .= "<row id='" . $row["id_cliente"] . "'>" . "<cell><![CDATA[" . $nro . "]]></cell>" . "<cell><![CDATA[" . $row["razon_social_cliente"] . "]]></cell>" . "<cell><![CDATA[" . $porc_cte . "]]></cell>" . "<cell><![CDATA[" . round($row["total_por_cliente"], 2) . "]]></cell>" . "<cell><![CDATA[" . $porc_fact . "]]></cell>" . "<cell><![CDATA[" . round($total_acum, 2) . "]]></cell>" . "<cell><![CDATA[" . $porc_item . "]]></cell>" . "<cell><![CDATA[" . $clase . "]]></cell></row>"; } else { if ($nro == 11) { break; } $data .= "<item id='{$nro}'><cliente>" . $row["razon_social_cliente"] . "</cliente><monto>" . round($row["total_por_cliente"], 2) . "</monto></item>"; } $nro++; } } if (!$paraGraf) { $fin = "</rows>"; $cab = "<?xml version='1.0' encoding='iso-8859-1'?><rows>"; } else { $fin = "</data>"; $cab = "<data>"; } return $cab . $data . $fin; }
public function challenge() { global $cn; // DB読込み(メンバーテーブルから認証) $strSQL = "select a.member_id, a.login_pwd as pass, a.login_pwd_md5 as hashed_pass, a.pass_salt, a.name1, a.name2, a.disp_name, a.email, a.nickname, a.api_key, a.force_chpwd, a.login_ok_ymd " . "from v_member_header a " . "where login_id = '{$_REQUEST['email']}' "; $result = selectQuery($cn, $strSQL); if ($row = getRow($result)) { RCMSUser::setLogin($row, $_REQUEST['login_save']); LoginHistory::write($cn, RCMSUser::getUser()); $_SESSION["password_inputted"] = 1; return array(true, $_REQUEST['login_save'] == 1); } return array(true, $_REQUEST['login_save'] == 1); }
function contactInfo($db, $call) { $contacts = ''; $q3 = "SELECT ares_contact_type, contact, validity, A.type " . "FROM ares_contact_info A, ares_contact_type B " . "WHERE A.type = B.type AND A.call='" . $call . "'"; //echo "<p>" . $q3 . ",/p>\n"; $r3 = getResult($q3, $db); while ($row3 = getRow($r3, $db)) { $xx = $row3[1]; if ($row3[3] < 4) { $xx = formatNumber($row3[1]); } if ($row3[2] == 1) { $contacts = $contacts . $row3[0] . ": <b>" . $xx . "</b><br>"; } else { $contacts = $contacts . $row3[0] . ": " . $xx . "<br>"; } } echo $contacts; }
function del_file($fid, $user = 0) { $del_time = time() + 8 * 3600; if ($user == 1) { $sql = "select filepath from files where fid = '{$fid}'"; if ($file = getRow($sql)) { $path = $file['filepath']; if (file_exists($path)) { unlink($path); // 彻底删除 } else { $err_msg = "对不起,该文件不存在,请检查文件名!"; } /* 删除成功,才能修改数据库,否则数据将发生不完整性!此逻辑有些问题 如果文件不存在,但是找到了,说明数据库有记录,此时也应该删除该记录,因为此记录是无效记录 */ $sql = "delete from files where fid = '{$fid}'"; // 彻底删除 } else { $err_msg = "对不起,删除失败,该文件可能不存在,请检查文件名,或者稍后再试!"; } } else { $sql = "update files set status = 2, del_time = {$del_time} where fid = '{$fid}'"; } /*print_r($sql); exit;*/ $result = mysql_query($sql); if (!$result) { $err_msg = "对不起,删除失败,数据库繁忙,请稍后再试!"; } else { if (mysql_affected_rows() == 0) { $err_msg = "对不起,删除失败,该文件可能不存在,请检查文件名,或者稍后再试!"; } } if (isset($err_msg)) { //echo $err_msg; return $err_msg; } return true; }
function displayRows($data, $alldata) { if (!count($data)) { return; } $titlerow = ' <div class="titlerow"> <div class="span-9">Auth Item</div><div class="span-2">Currently Included</div><div class="span-2">Indirectly Included</div><div class="span-2">Include</div> </div> '; $evenodd = array('evenrow', 'oddrow'); $types = array('Operations', 'Op Groups (Tasks)', 'Roles'); foreach (array(2, 1, 0) as $type) { $panels[$types[$type]] = $titlerow; $rownum[$types[$type]] = 0; } foreach ($data as $datum) { $panel = $types[$datum['type']]; $panels[$panel] .= '<div class="' . $evenodd[$rownum[$panel]++ % 2] . '">'; $panels[$panel] .= getRow($datum, $alldata); $panels[$panel] .= '</div>'; } return $panels; }
for ($iCt = 0; $iCt < count($names); $iCt++) { # $savefile = $name; $savefile = $names[$iCt]; $reg = "/^(\\d{1,3}\\.){3}\\d{1,3},\\s{$savefile},\\s\\d{4}\\/\\d{2}\\/\\d{2},\\s\\d{2}:\\d{2}:\\d{2},\\sW3SVC1,\\sPOPPY,\\s192\\.168\\.30\\.17,\\s\\d{1,5},\\s\\d{1,5},\\s\\d{1,5},\\s\\d{1,5},\\s\\d{1,5},\\s.{3,4},\\s.*\\/(login\\.asp|HqMain\\.asp|HallMain\\.asp|HqMenu\\.asp),/i"; $files = array(); $drc = dir($directory); while ($fl = $drc->read()) { if ($fl == '.' or $fl == '..') { continue; } # filesに追加 $files[] = $directory . "/" . $fl; } sort($files); for ($i = 0; $i < count($files); $i++) { getRow($files[$i], $reg, $savefile); } } function getRow($file, $reg, $savefile) { echo $file . "::" . $savefile . "<BR>"; $fp = fopen($file, 'r') or die('end'); $result = array(); while (!feof($fp)) { $row = fgets($fp, 1024); if (preg_match($reg, $row)) { $result[] = $row; echo $row . "::" . $savefile . "<BR>"; } } fclose($fp);
<?php /* 文件预览 改进:使用id传递不够安全,容易被用户自己输入id查看 使用自己的加密技术 或者使用md5加密id等,由于加密不可逆,故数据库需要存储此md5值! window.location更加不安全,把路径名等,全部暴露了, 需要改进,使用加密技术生成! */ header('content-type: text/html; charset=utf-8'); require "../include/init.php"; require_once '../include/file.func.tool.php'; $fid = $_GET['fid'] + 0; // 安全检查 $sql = "select * from files where fid = '{$fid}'"; if ($file = getRow($sql, $conn)) { echo "<script> window.location=\"" . $file['filepath'] . "\";</script> "; // echo nl2br(htmlentities(file_get_contents($file['filepath']))); 乱码,格式也不对 } else { echo "id 非法!"; }
while ($row2 = getRow($r2, $db)) { //echo $district . ',' . $row2[0] . "<br>\n"; $q3 = 'SELECT `aresmem`,`drillsnum`,`drillshrs`,`psesnum`,`pseshrs`,`eopsnum`,`eopshrs`,`aresopsnum`,`aresops` ' . "FROM `arpsc_ecrept` WHERE `county`='" . $row2[1] . "' AND `period`=" . $period; $r3 = getResult($q3, $db); if ($row3 = getRow($r3, $db)) { $hours = $row3[2] + $row3[4] + $row3[6] + $row3[8]; $value = $hours * 18.11; $lastperiod = $period - 1; $q4 = "SELECT `aresmem` FROM `arpsc_ecrept` WHERE `county`='" . $row2[1] . "' AND `period`=" . $lastperiod; $r4 = getResult($q4, $db); if ($row4 = getRow($r4, $db)) { $change = $row3[0] - $row4[0]; } else { $q4 = "SELECT `aresmem` FROM `arpsc_ecrept` WHERE `county`='" . $row2[1] . "' AND `period`=0"; $r4 = getResult($q4, $db); if ($row4 = getRow($r4, $db)) { $change = $row3[0] - $row4[0]; } else { $change = " "; } } echo "\t<tr>\n"; if ($district != $olddistrict) { echo $district; $olddistrict = $district; } echo ',' . $row2[0] . ',' . round($hours) . ',' . round($value) . ',' . $row3[0] . ',' . $change . ',' . $row3[1] . ',' . $row3[2] . ',' . $row3[3] . ',' . $row3[4] . ',' . $row3[5] . ',' . $row3[6] . "<br .>\n"; } else { if ($row2[0] == 'Arenac') { if ($district != $olddistrict) { echo $district;
$q6 = "SELECT COUNT(*) FROM `arpsc_ecrept` WHERE `period`="; $testperiod = (int) $p9 + 1; $q6 = $q6 . $testperiod; $r6 = getResult($q6, $db); $row6 = getRow($r6, $db); if ($row6[0] > 0) { $url = "Summary.php?period=" . $testperiod; echo " <td class=\"" . $rowclass . "\"><a href=\"" . $url . "\">Fwd 1m></a></td>\n"; } else { echo " <td class=\"" . $rowclass . "\">Fwd 1m></td>\n"; } $q6 = "SELECT COUNT(*) FROM `arpsc_ecrept` WHERE `period`="; $testperiod = (int) $p9 + 3; $q6 = $q6 . $testperiod; $r6 = getResult($q6, $db); $row6 = getRow($r6, $db); if ($row6[0] > 0) { $url = "Summary.php?period=" . $testperiod; echo " <td class=\"" . $rowclass . "\"><a href=\"" . $url . "\">Fwd 1Q>></a></td>\n"; } else { echo " <td class=\"" . $rowclass . "\">Fwd 1Q>></td>\n"; } echo " </table>\n"; echo " <p> </p>\n"; echo " </center>"; echo " </div>\n\n"; sectLeaders($db); footer($starttime . "Z", $maxdate, "\$Revision: 1.0 \$ - \$Date: 2008-10-15 15:08:57-04 \$"); ?> </div> </body>
global $array, $column; $array = $arr; $column = $col; usort($array, "cmp"); return $array; } $ip = $_SERVER['REMOTE_ADDR']; $entry_line = $ip . "\r\n"; $fp = fopen('logs.txt', 'a'); fputs($fp, $entry_line); fclose($fp); $file = file('logs.txt'); $counts = array_count_values($file); $ipList = array_unique($file); $array = array(); $ind = 0; for ($i = 0; $i < count($file); $i++) { if (array_key_exists($i, $ipList)) { $array[$ind][0] = $ipList[$i]; $array[$ind++][1] = $counts[$ipList[$i]]; } } $array = razor_sort($array, 1); $text = ''; for ($i = count($array) - 1; $i >= 1; $i--) { $text .= getRow($array[$i][0], $array[$i][1]); } echo getTable($text); ?> </body> </html>
/** * Find an adjacent article relative to a provided threshold level * * @param scalar $threshold The value to compare against * @param string $s string Optional section restriction * @param string $type string Find lesser or greater neighbour? Possible values: '<' (previous, default) or '>' (next) * @param array $atts Attribute of article at threshold * @param string $threshold_type 'cooked': Use $threshold as SQL clause; 'raw': Use $threshold as an escapable scalar * @return array|string An array populated with article data, or the empty string in case of no matches */ function getNeighbour($threshold, $s, $type, $atts = array(), $threshold_type = 'raw') { global $prefs; static $cache = array(); $key = md5($threshold . $s . $type . join(n, $atts)); if (isset($cache[$key])) { return $cache[$key]; } extract($atts); $expired = $expired && $prefs['publish_expired_articles']; $customFields = getCustomFields(); //Building query parts // lifted from publish.php. This is somewhat embarrassing, isn't it? $ids = array_map('intval', do_list($id)); $id = !$id ? '' : " and ID IN (" . join(',', $ids) . ")"; switch ($time) { case 'any': $time = ""; break; case 'future': $time = " and Posted > now()"; break; default: $time = " and Posted <= now()"; } if (!$expired) { $time .= " and (now() <= Expires or Expires = " . NULLDATETIME . ")"; } $custom = ''; if ($customFields) { foreach ($customFields as $cField) { if (isset($atts[$cField])) { $customPairs[$cField] = $atts[$cField]; } } if (!empty($customPairs)) { $custom = buildCustomSql($customFields, $customPairs); } } if ($keywords) { $keys = doSlash(do_list($keywords)); foreach ($keys as $key) { $keyparts[] = "FIND_IN_SET('" . $key . "',Keywords)"; } $keywords = " and (" . join(' or ', $keyparts) . ")"; } // invert $type for ascending sortdir $types = array('>' => array('desc' => '>', 'asc' => '<'), '<' => array('desc' => '<', 'asc' => '>')); $type = $type == '>' ? $types['>'][$sortdir] : $types['<'][$sortdir]; // escape threshold and treat it as a string unless explicitly told otherwise if ($threshold_type != 'cooked') { $threshold = "'" . doSlash($threshold) . "'"; } $safe_name = safe_pfx('textpattern'); $q = array("select ID, Title, url_title, unix_timestamp(Posted) as uposted\n\t\t\tfrom " . $safe_name . " where {$sortby} {$type} " . $threshold, $s != '' && $s != 'default' ? "and Section = '" . doSlash($s) . "'" : filterFrontPage(), $id, $time, $custom, $keywords, 'and Status=4', 'order by ' . $sortby, $type == '<' ? 'desc' : 'asc', 'limit 1'); $cache[$key] = getRow(join(n . ' ', $q)); return is_array($cache[$key]) ? $cache[$key] : ''; }
?> <h1>Used Cars for Sale</h1> <a href="index.html">Back</a><br><br> <form method="post"> <fieldset> <legend>Download Results</legend> <p> <input type="submit" name="download" id="download" value="Download Excel Spreadsheet"> </p> </fieldset> </form> <?php while ($row = getRow($result)) { ?> <h2><?php echo $row['make']; ?> </h2> <ul> <li>Price: $<?php echo number_format($row['price'], 2); ?> </li> <li>Year: <?php echo $row['yearmade']; ?> </li> <li>Mileage: <?php
include 'includes/functions.inc'; // Open the database $db = mysql_connect($host, $dbuser, $dbpassword); mysql_select_db($DatabaseName, $db); // Get the requested county $county = $_GET['county']; //=========================================================================== // D a t a b a s e D a t a //=========================================================================== // Initialize the database query $q3 = "SELECT `drillshrs`,`pseshrs`,`eopshrs`,`aresops`,`period` " . "FROM `arpsc_ecrept` WHERE `county`='" . $county . "' ORDER BY `period`"; $r3 = getResult($q3, $db); $i = 0; // Index into arrays to store results to graph // Loop through all returned rows while ($row3 = getRow($r3, $db)) { if ($row3[4] > 0) { $hours = $row3[0] + $row3[1] + $row3[2] + $row3[3]; $i = $i + 1; $x[$i] = $row3[4]; // Period $y[$i] = $hours; // Total hours $y1[$i] = $row3[0]; // Drills $y2[$i] = $row3[1]; // Public Service $y3[$i] = $row3[2]; // Emergency $y4[$i] = $row3[3]; // Admin
// Display the month name for this report $SQL = 'SELECT `lastday` FROM `periods` WHERE `periodno`=' . $period; $periodname = convertDate(singleResult($SQL, $db)); // Get the actual report data for this period $SQL = 'SELECT B.`netfullname`,A.`QNI`,A.`QTC`,A.`QTR`,A.`sessions`,' . 'A.`updated`,A.`manhours`,A.`netid` ' . 'FROM `netreport` A, `nets` B ' . 'WHERE A.`period`=' . $period . ' AND A.`netID`=B.`netID` ' . 'ORDER BY `QTC` DESC, `QNI` DESC'; $result = getResult($SQL, $db); // We will use rownum to keep track of light and dark rows $rownum = 1; // The following variables are used to calculate totals for the month $TQNI = 0; $TQTC = 0; $TQTR = 0; $TSess = 0; $TMH = 0; // Loop through the rows of the result while ($myrow = getRow($result, $db)) { // Update the latest data date, if necessary if ($myrow[5] > $maxdate) { $maxdate = $myrow[5]; } // Calculate totals for the obvious ones $TQNI = $TQNI + $myrow[1]; $TQTC = $TQTC + $myrow[2]; $TQTR = $TQTR + $myrow[3]; $TSess = $TSess + $myrow[4]; // For manhours, use reported if available if ($myrow[6] > 0) { $TMH = $TMH + $myrow[6]; } else { if ($myrow[4] > 0 && $myrow[3] > 0) { $manhours = $myrow[3] / $myrow[4] * $myrow[1];
# # # This work is made available under the terms of the Creative Commons Attribution-NonCommercial 3.0 Unported, # # # # http://creativecommons.org/licenses/by-nc/3.0/legalcode # # # # This work is WITHOUT ANY WARRANTY; without even the implied warranty of FITNESS FOR A PARTICULAR PURPOSE. # # # ######################################################################################################################### maxArg(2); $uid = getVar("id"); if ($uid) { //Display single users $select = intval($uid) != 0 ? "user_id" : "username"; //$select = "user_id"; $sql = "SELECT * \n\t\t\t\tFROM users\n\t\t\t\tWHERE {$select}='{$uid}'\n\t\t\t"; $data = getRow($sql); if ($data) { ?> <h3><?php echo $data['username']; ?> 's Profile</h3> <img src="http://www.gravatar.com/avatar/<?php echo md5($data['email']); ?> ?d=monsterid"> <table border=0> <tr><td></td><td></td></tr> <?php foreach ($data as $field => $val) { echo "<tr><td>{$field}</td><td> => </td><td> {$val}</td></tr>";
<?php include "dblib.inc"; include "clublib.inc"; checkAdmin(); $message = ""; // recupero i dati del cliente $cliente = getRow($customers_table, "ID_Cliente", $session['ID_Cliente']); // e relative fatture $rs_fatture = dynQuery('*', $invoices_table, "ID_Cliente = {$session['ID_Cliente']}"); if (isset($actionflag)) { // nella generazione delle note il progressivo annuo si resetta quando cambia l'anno di riferimento. // il sistema quindi inserisce il progressivo in un campo incrementale controllando l'anno: // quando cambia l'anno della data emissione fattura, il progressivo riparte da 1 // questo metodo comporta un controllo aggiuntivo sul progressivo, ovvero non deve essere inserito un // progressivo in tabella se l'ultimo progressivo inserito ha una data successiva alla data fattura attuale. // Ha come vantaggio la possibilita' di non dover azzerare i contatori o rimuovere le fatture dell'anno // precedente ad inizio anno, consentendo una maggior continuita' fra gli esercizi. // controllo che i dati della nota di credito siano giusti, quindi passo all'anteprima // controllo che l'imponibile non sia 0 if ($form['Imponibile'] == 0) { $message = "L'imponibile della nota di credito non può essere nullo!<br>"; } // controllo che sia inserita e corretta la data nota if (!checkdate($mese, $giorno, $anno)) { $message .= "La data nota di credito {$giorno}-{$mese}-{$anno} non è corretta! <br>"; } // controllo che la data nota di credito non sia inferiore alla data fattura // recupero i dati della fattura da stornare $rs_fattura = dynQuery("*", $invoices_table, "ID_Fattura = {$form['ID_Fattura']}"); $fattura = dbms_fetch_array($rs_fattura);
$query .= " where (sd_movimenti.Id_Voce_Bilancio = sd_voci_bilancio.id OR sd_movimenti.Id_Voce_Bilancio = 0)\r\n\t\t and sd_movimenti.Deleted = 'N'\r\n and sd_soggetti.ID_Soggetto = sd_movimenti.ID_Soggetto\r\n and sd_movimenti.Id_Voce_Bilancio = " . $searchByVoceBilancioSelect . " "; } else { $annoCorrente = date("Y", time() + $timeadjust); $query .= " where (sd_movimenti.Id_Voce_Bilancio = sd_voci_bilancio.id OR sd_movimenti.Id_Voce_Bilancio = 0)\r\n\t\t\t\t\t\t\tand sd_movimenti.Deleted = 'N'\r\n and sd_soggetti.ID_Soggetto = sd_movimenti.ID_Soggetto "; } } } } $query .= " group by id_movimento\r\n order by " . $orderby . ""; $query .= " LIMIT 0, 50 "; $result = connetti_query($query); while ($a_row = dbms_fetch_array($result)) { // per il momento la gestione degli allegati e' rimandata $a_row["Allegato"] = ""; // ricavo l'intestazione della banca e il saldo parziale $banca = getRow($bank_table, "ID_Banca", $a_row['ID_Banca']); //$saldo = Saldo($a_row['ID_Banca'], $a_row["Data_Valuta"]); if ($a_row["Entrate"] != "0.00") { $saldo = "+" . formatEuro($a_row["Entrate"]); } else { $saldo = "-" . formatEuro($a_row["Uscite"]); } print "<tr>"; $href = "Admin_Upd_Movimento.php?ID_Movimento="; //print "<td class=\"FacetDataTD\"><a href=\"$href".$a_row["ID_Movimento"]."\">".formatDate($a_row["Data_Valuta"])."</a> </td>"; print "<td class=\"FacetDataTD\">" . $a_row["ID_Movimento"] . " </td>"; print "<td class=\"FacetDataTD\" valign=\"center\"><a href=\"{$href}" . $a_row["ID_Movimento"] . "\">" . $a_row["Data_Valuta"] . "</a> </td>"; print "<td class=\"FacetDataTD\">" . $a_row["Data_Competenza"] . " </td>"; print "<td class=\"FacetDataTD\">" . $a_row["Anno_Bilancio"] . " </td>"; print "<td class=\"FacetDataTD\">" . $a_row["Tipo_Pagamento"] . " </td>"; print "<td class=\"FacetDataTD\">" . $a_row["Cognome"] . " " . $a_row["Nome"] . " " . $a_row["Ragione_Sociale"] . " </td>";
private function getEntry() { $row = getRow("SELECT last_mod, contents FROM " . safe_pfx('jmd_wiki_events') . " WHERE title = '{$this->day}'"); if ($row) { $diff = str_replace('-', '', $this->currentDate) - str_replace('-', '', $row['last_mod']); // if the content is at least two months old, update if ($diff > 200) { return $this->setEntry($update = 1); } else { return $row['contents']; } } }
<?php include "dblib.inc"; include "clublib.inc"; checkAdmin(); $message = "Sei sicuro di voler rimuovere il cliente?"; if (isset($actionflag) && $actionflag == "Delete") { $result = delRow($customers_table, "ID_Cliente", $ID_Cliente); header("Location: Admin_Clienti.php"); exit; } $form = getRow($customers_table, "ID_Cliente", $ID_Cliente); //$form["E_Mail"]=$session["E_Mail"]; ?> <html> <head> <title>Aggiorna Cliente</title> <?php include "Header.php"; ?> <!-- BEGIN Record pws_clienti --> <form method="post" action="<?php print $PHP_SELF; ?> " > <!-- flag di invio del modulo --> <input type="Hidden" name="actionflag" value="Delete"> <input type="Hidden" name="ID_Cliente" value="<?php
<?php include "dblib.inc"; include "clublib.inc"; checkAdmin(); $message = ""; if (isset($actionflag) && $actionflag == "Delete") { //$result = delRow($mov_table, "ID_Movimento", $ID_Movimento); $result = connetti_query("update sd_movimenti set Deleted='Y' where ID_Movimento=" . $ID_Movimento); header("Location: Admin_Movimenti.php"); exit; } if (!isset($actionflag)) { // inizializzo l'array associativo del modulo // recupero i dati dell'ordine dal db $form = getRow($mov_table, "ID_Movimento", $ID_Movimento); if (!($form['Entrate'] == 0)) { $Entrata = "SI"; $form['Importo'] = $form['Entrate']; } else { $Entrata = "NO"; $form['Importo'] = $form['Uscite']; } $idVoceBilancioResult = connetti_query("SELECT id_voce_bilancio as ID_VOCE FROM sd_movimenti WHERE id_movimento = " . $ID_Movimento); while ($idVoceBilancioRow = dbms_fetch_array($idVoceBilancioResult)) { $idVoceBilancio = $idVoceBilancioRow['ID_VOCE']; } // converto la data in Unix timestamp $ts_Data_Valuta = strtotime($form['Data_Valuta']); $ts_Data_Competenza = strtotime($form['Data_Competenza']); // ricavo giorno, mese, anno
} $SQL2 = "SELECT `day_of_week`,`call` FROM `rep_liaisons` WHERE " . "`net`=3 ORDER BY `day_of_week`"; $res2 = getResult($SQL2, $db); while ($row2 = getRow($res2, $db)) { $ypos = 43 + 22 * $row2[0]; ImageString($image, $fontbody, 130, $ypos, $row2[1], $callcolor); } $SQL3 = "SELECT `day_of_week`,`call` FROM `rep_liaisons` WHERE " . "`net`=4 ORDER BY `day_of_week`"; $res3 = getResult($SQL3, $db); while ($row3 = getRow($res3, $db)) { $ypos = 43 + 22 * $row3[0]; ImageString($image, $fontbody, 220, $ypos, $row3[1], $callcolor); } $SQL4 = "SELECT `day_of_week`,`call` FROM `rep_nws` ORDER BY `day_of_week`"; $res4 = getResult($SQL4, $db); while ($row4 = getRow($res4, $db)) { $ypos = 43 + 22 * $row4[0]; ImageString($image, $fontbody, 300, $ypos, $row4[1], $callcolor); } // Black box around the image ImageLine($image, 4, $ih - 1, $iw - 1, $ih - 1, $gray4); ImageLine($image, 3, $ih - 2, $iw - 1, $ih - 2, $gray3); ImageLine($image, 2, $ih - 3, $iw - 1, $ih - 3, $gray2); ImageLine($image, 1, $ih - 4, $iw - 1, $ih - 4, $gray1); ImageLine($image, $iw - 4, 1, $iw - 4, $ih - 4, $gray1); ImageLine($image, $iw - 3, 2, $iw - 3, $ih - 3, $gray2); ImageLine($image, $iw - 2, 3, $iw - 2, $ih - 2, $gray3); ImageLine($image, $iw - 1, 4, $iw - 1, $ih - 1, $gray4); ImageLine($image, 1, 1, $iw - 5, 1, $black); ImageLine($image, $iw - 5, 1, $iw - 5, $ih - 5, $black); ImageLine($image, $iw - 5, $ih - 5, 1, $ih - 5, $black);
<?php include 'includes/session.inc'; $title = _('Michigan Section FSD-212'); include 'includes/functions.inc'; // Remember the launch time $starttime = strftime("%A, %B %d %Y, %H:%M"); // Open the database $db = mysql_connect($host, $dbuser, $dbpassword); mysql_select_db($DatabaseName, $db); ARESheader($title, "Adjust Member Count"); ARESleftBar($db); echo ' <div id="main">' . "\n"; $Q1 = "SELECT DISTINCT `COUNTY` FROM `arpsc_ecrept`"; $R1 = getResult($Q1, $db); while ($row1 = getRow($R1, $db)) { $Q2 = "SELECT MAX(`PERIOD`) FROM `arpsc_ecrept` " . "WHERE `county`='" . $row1[0] . "'"; $last = singleResult($Q2, $db); $Q3 = "SELECT `ARESMEM` FROM `arpsc_ecrept` " . "WHERE `COUNTY`='" . $row1[0] . "' " . "AND `PERIOD`=" . $last; $latest = singleResult($Q3, $db); $Q4 = "SELECT `ARESMEM` FROM `arpsc_ecrept` " . "WHERE `COUNTY`='" . $row1[0] . "' " . "AND `PERIOD`=0"; $zeroth = singleResult($Q4, $db); echo "<p>" . $row1[0] . ": " . $last . ", "; if ($latest == $zeroth) { echo $latest . ", " . $zeroth . "</p>\n"; } else { if ($zeroth > 0) { echo "<b>" . $latest . ", " . $zeroth . "</b><br/>\n"; $Q5 = 'UPDATE `arpsc_ecrept` SET `ARESMEM`=' . $latest . " WHERE `COUNTY`='" . $row1[0] . "' AND `PERIOD`=0"; echo "---" . $Q5 . "---</p>\n"; $R5 = getResult($Q5, $db);
public function list_comment() { try { $commentDAO = CreateObject("Model_DAO_Comment"); $page = 1; if (isset($_REQUEST["p"])) { $page = intval($_REQUEST["p"]); } $row_total = getRow("select * from " . table_prefix("comment")); $showResult = 0; if (isset($_REQUEST["showResult"])) { $showResult = $_REQUEST["showResult"]; $page_size = $showResult; } if ($showResult == 0) { $page_size = 5; } $pagegroup_size = 5; $url = "index.php?rt=admin/list_comment"; $comments = $commentDAO->lists($page * $page_size - $page_size, $page_size); $this->registry->template->page = $page; $this->registry->template->row_total = $row_total; $this->registry->template->page_size = $page_size; $this->registry->template->pagegroup_size = $pagegroup_size; $this->registry->template->pagegroup_size = $pagegroup_size; $this->registry->template->url = $url; $this->registry->template->comments = $comments; $this->registry->template->showResult = $showResult; $this->registry->template->showAdmin('list_comment'); } catch (MyException $ex) { header("Location: index.php?admin/index"); } }
function safe_row($things, $table, $where, $debug = '') { $q = "select {$things} from " . PFX . "{$table} where {$where}"; $rs = getRow($q, $debug); if ($rs) { return $rs; } return array(); }
<?php include "dblib.inc"; include "clublib.inc"; checkAdmin(); $message = "Sei sicuro di voler rimuovere il Fornitore?"; if (isset($actionflag) && $actionflag == "Delete") { $result = delRow($suppliers_table, "ID_Fornitore", $ID_Fornitore); header("Location: Admin_Fornitori.php"); exit; } $form = getRow($suppliers_table, "ID_Fornitore", $ID_Fornitore); ?> <html> <head> <title>Aggiorna Fornitore</title> <?php include "Header.php"; ?> <!-- BEGIN Record pws_clienti --> <form method="post" action="<?php print $PHP_SELF; ?> " > <!-- flag di invio del modulo --> <input type="Hidden" name="actionflag" value="Delete"> <input type="Hidden" name="ID_Fornitore" value="<?php print $ID_Fornitore;