当前位置: 首页>>代码示例>>PHP>>正文


PHP db_conn函数代码示例

本文整理汇总了PHP中db_conn函数的典型用法代码示例。如果您正苦于以下问题:PHP db_conn函数的具体用法?PHP db_conn怎么用?PHP db_conn使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了db_conn函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: view_err

function view_err($_POST, $err = "")
{
    # get vars
    foreach ($_POST as $key => $value) {
        ${$key} = $value;
    }
    # Query server for depts
    db_conn("exten");
    $sql = "SELECT * FROM departments ORDER BY deptname ASC";
    $deptRslt = db_exec($sql) or errDie("Unable to view customers");
    if (pg_numrows($deptRslt) < 1) {
        return "<li class=err>There are no Departments found in Cubit.";
    } else {
        $depts = "<select name='deptid'>";
        while ($dept = pg_fetch_array($deptRslt)) {
            if ($dept['deptid'] == $deptid) {
                $sel = "selected";
            } else {
                $sel = "";
            }
            $depts .= "<option value='{$dept['deptid']}' {$sel}>{$dept['deptname']}</option>";
        }
        $depts .= "</select>";
    }
    //layout
    $view = "<br><br><form action='" . SELF . "' method=post name=form>\r\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=400>\r\n\t\t<input type=hidden name=key value=slctcust>\r\n\t\t<input type=hidden name=cussel value=cussel>\r\n\t\t<tr><th colspan=2>Statement</th></tr>\r\n\t\t<tr><td colspan=2>{$err}</td></tr>\r\n\t\t<tr class='bg-odd'><td>Select Department</td><td valign=center>{$depts}</td></tr>\r\n\t\t<tr class='bg-even'><td>First Letters of customer</td><td valign=center><input type=text size=5 name=letters value='{$letters}' maxlength=5></td></tr>\r\n\t\t<tr><td><br></td></tr>\r\n\t\t<tr><td><input type=button value='&laquo Cancel' onClick='javascript:history.back();'></td><td valign=center><input type=submit value='Continue &raquo'></td></tr>\r\n\t</table></form>\r\n\t<p>\r\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t\t<tr><th>Quick Links</th></tr>\r\n\t\t<tr class='bg-odd'><td><a href='invoice-view.php'>View Invoices</a></td></tr>\r\n\t\t<tr class='bg-odd'><td><a href='customers-new.php'>New Customer</a></td></tr>\r\n\t\t<script>document.write(getQuicklinkSpecial());</script>\r\n\t\t<tr class='bg-odd'><td><a href='main.php'>Main Menu</a></td></tr>\r\n\t</table>";
    return $view;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:28,代码来源:invoice-stmnt.php

示例2: printDept

function printDept()
{
    # Set up table to display in
    $printDept = "\r\n    <h3>Departments</h3>\r\n    <table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n    <tr><th>Dept No</th><th>Department</th><th>Income Account</th><th>Debtors Control Account</th><th>Creditors Control Account</th></tr>";
    # connect to database
    db_conn("exten");
    # Query server
    $i = 0;
    $sql = "SELECT * FROM departments WHERE div = '" . USER_DIV . "' ORDER BY deptname ASC";
    $deptRslt = db_exec($sql) or errDie("Unable to retrieve Departments from database.");
    if (pg_numrows($deptRslt) < 1) {
        return "<li>There are no Departments in Cubit.";
    }
    while ($dept = pg_fetch_array($deptRslt)) {
        # get ledger account name
        core_connect();
        $sql = "SELECT accname FROM accounts WHERE accid = '{$dept['incacc']}' AND div = '" . USER_DIV . "'";
        $accRslt = db_exec($sql);
        $accinc = pg_fetch_array($accRslt);
        # get debtors account name
        $sql = "SELECT accname FROM accounts WHERE accid = '{$dept['debtacc']}' AND div = '" . USER_DIV . "'";
        $accRslt = db_exec($sql);
        $accdebt = pg_fetch_array($accRslt);
        # get creditors account name
        $sql = "SELECT accname FROM accounts WHERE accid = '{$dept['credacc']}' AND div = '" . USER_DIV . "'";
        $accRslt = db_exec($sql);
        $acccred = pg_fetch_array($accRslt);
        $printDept .= "<tr class='" . bg_class() . "'><td>{$dept['deptno']}</td><td>{$dept['deptname']}</td><td>{$accinc['accname']}</td><td>{$accdebt['accname']}</td><td>{$acccred['accname']}</td><td><a href='dept-edit.php?deptid={$dept['deptid']}'>Edit</a></td>";
        $printDept .= "<td><a href='dept-rem.php?deptid={$dept['deptid']}'>Remove</a></td></tr>";
        $i++;
    }
    $printDept .= "</table>\r\n    <p>\r\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=15%>\r\n        <tr><td><br></td></tr>\r\n        <tr><th>Quick Links</th></tr>\r\n\t\t<tr class='bg-odd'><td><a href='dept-add.php'>Add Department</a></td></tr>\r\n\t\t<tr class='bg-odd'><td><a href='../main.php'>Main Menu</a></td></tr>\r\n\t</table>";
    return $printDept;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:34,代码来源:dept-view.php

示例3: slctacc

function slctacc()
{
    # from period
    $prds = "<select name=prd>";
    db_conn(YR_DB);
    $sql = "SELECT * FROM info WHERE prdname !=''";
    $prdRslt = db_exec($sql);
    if (pg_numrows($prdRslt) < 1) {
        return "<li class=err>ERROR : There are no periods set for the current year";
    }
    while ($prd = pg_fetch_array($prdRslt)) {
        if ($prd['prddb'] == PRD_DB) {
            $sel = "selected";
        } else {
            $sel = "";
        }
        $prds .= "<option value='{$prd['prddb']}' {$sel}>{$prd['prdname']}</option>";
    }
    $prds .= "</select>";
    db_connect();
    $sql = "SELECT * FROM employees WHERE div = '" . USER_DIV . "' ORDER BY fname,snames ASC";
    $supRslt = db_exec($sql) or errDie("Could not retrieve employees Information from the Database.", SELF);
    if (pg_numrows($supRslt) < 1) {
        return "<li class=err> There are no employees in Cubit.";
    }
    $supts = "<select name='supids[]' multiple size='10'>";
    while ($sup = pg_fetch_array($supRslt)) {
        $supts .= "<option value='{$sup['empnum']}'>{$sup['sname']}, {$sup['fnames']}</option>";
    }
    $supts .= "</select>";
    $slctacc = "\n\t\t\t\t\t<p>\n\t\t\t\t\t<h3>Employee Ledger</h3>\n\t\t\t\t\t<h4>Select Options</h4>\n\t\t\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t\t\t\t<input type='hidden' name='key' value='viewtran'>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<th>Field</th>\n\t\t\t\t\t\t\t<th>Value</th>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td valign='top'></td>\n\t\t\t\t\t\t\t<td><input type='radio' name='accnt' value='slct' checked='yes'>Selected Accounts | <input type='radio' name='accnt' value='all'>All Accounts</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td valign='top'>Select Employee(s)</td>\n\t\t\t\t\t\t\t<td>{$supts}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>Select period</td>\n\t\t\t\t\t\t\t<td>{$prds}</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t\t\t<td>Order By</td>\n\t\t\t\t\t\t\t<td>Transaction Date<input type='radio' name='t' checked value='t'>System Date<input type=radio name=t value='s'></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t<tr><td><br></td></tr>\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td align='right'><input type='submit' value='Continue &raquo;'></td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t\t<p>\n\t\t\t\t\t\t<table " . TMPL_tblDflts . " width='25%'>\n\t\t\t\t\t\t\t<tr><td><br></td></tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<th>Quick Links</th>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t\t\t\t\t</table>";
    return $slctacc;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:33,代码来源:emp-ledger-xls.php

示例4: write

function write($_POST)
{
    extract($_POST);
    $id += 0;
    db_conn("crm");
    $Sl = "SELECT * FROM crms WHERE id='{$id}'";
    $Ry = db_exec($Sl) or errDie("Unable to get data.");
    if (pg_num_rows($Ry) < 1) {
        return "Invalid user.";
    }
    $crmdata = pg_fetch_array($Ry);
    if ($crmdata['teamid'] == 0) {
        return "This user is set to 'Non Active' and you cannot select mutple teams for him. Please select a team under settings 'Select default teams'";
    }
    $tar = explode("|", $crmdata['teams']);
    $i = 0;
    $Sl = "SELECT * FROM teams WHERE div='" . USER_DIV . "' ORDER BY name";
    $Ry = db_exec($Sl) or errDie("Unable to get data from teams.");
    $tv = "";
    while ($data = pg_fetch_array($Ry)) {
        $tid = $data['id'];
        $tid += 0;
        if (isset($team[$tid])) {
            $tv .= "{$tid}|";
        }
    }
    $tvs = explode("|", $tv);
    if (!in_array($crmdata['teamid'], $tvs)) {
        return "You cannot remove a team from a user if it is still set as his default. Change the default teams for a user under settings.";
    }
    $Sl = "UPDATE crms SET teams='{$tv}' WHERE id='{$id}'";
    $Ry = db_exec($Sl) or errDie("Unable to update.");
    $out = "<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t<tr><th>Done</th></tr>\r\n\t<tr class='bg-odd'><td>Your changes have been saved.</td></tr>\r\n\t</table>";
    return $out;
}
开发者ID:kumarsivarajan,项目名称:accounting-123,代码行数:35,代码来源:crms-teams.php

示例5: pretake_print

function pretake_print()
{
    extract($_REQUEST);
    $fields = array();
    $fields["offset"] = 0;
    $fields["store"] = 0;
    $fields["limit"] = OFFSET_SIZE;
    extract($fields, EXTR_SKIP);
    if (isset($store) and $store != "0") {
        $whsearch = "WHERE whid = '{$store}'";
    } else {
        $whsearch = "";
    }
    $sql = "SELECT stkid, stkcod, stkdes, whid FROM cubit.stock {$whsearch} ORDER BY stkcod ASC, whid LIMIT {$limit} OFFSET {$offset}";
    $stock_rslt = db_exec($sql) or errDie("Unable to retrieve stock.");
    $stock_out = "";
    while (list($stkid, $stkcod, $stkdes, $whid) = pg_fetch_array($stock_rslt)) {
        db_conn("exten");
        $get_wh = "SELECT whname FROM warehouses WHERE whid = '{$whid}' LIMIT 1";
        $run_wh = db_exec($get_wh) or errDie("Unable to get warehouse information.");
        if (pg_numrows($run_wh) < 1) {
            $whname = "Default";
        } else {
            $whname = trim(pg_fetch_result($run_wh, 0, 0));
        }
        $stock_out .= "\n\t\t\t<tr>\n\t\t\t\t<td>{$whname}</td>\n\t\t\t\t<td>{$stkcod}</td>\n\t\t\t\t<td>{$stkdes}</td>\n\t\t\t\t<td width='10%' style='border-bottom: 1px solid #000'>&nbsp;</td>\n\t\t\t</tr>";
    }
    $OUTPUT = "\n\t\t<style>\n\t\t\tth { text-align: left }\n\t\t</style>\n\t\t<table " . TMPL_tblDflts . " width='100%'>\n\t\t\t<tr>\n\t\t\t\t<td><h2>Pre Stock Take</h2></td>\n\t\t\t\t<td align='right'><h3>Page " . page_number($offset, $store) . "</h3>\n\t\t\t</tr>\n\t\t</table>\n\t\t<table " . TMPL_tblDflts . " width='100%'>\n\t\t\t<tr>\n\t\t\t\t<th align='left'>Store</th>\n\t\t\t\t<th align='left'>Stock Code</th>\n\t\t\t\t<th align='left'>Stock Description</th>\n\t\t\t\t<th align='left'>Quantity</th>\n\t\t\t</tr>\n\t\t\t{$stock_out}\n\t\t</table>";
    require "tmpl-print.php";
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:30,代码来源:stock_take_pre.php

示例6: remove

function remove()
{
    db_conn('core');
    $Sl = "SELECT * FROM income";
    $Ri = db_exec($Sl);
    while ($ad = pg_fetch_array($Ri)) {
        $Sl = "SELECT * FROM accounts WHERE catid='{$ad['catid']}'";
        $Rp = db_exec($Sl);
        if (pg_num_rows($Rp) < 1) {
            $Sl = "DELETE FROM income WHERE catid='{$ad['catid']}'";
            $Rp = db_exec($Sl);
        }
    }
    $Sl = "SELECT * FROM balance";
    $Ri = db_exec($Sl);
    while ($ad = pg_fetch_array($Ri)) {
        $Sl = "SELECT * FROM accounts WHERE catid='{$ad['catid']}'";
        $Rp = db_exec($Sl);
        if (pg_num_rows($Rp) < 1) {
            $Sl = "DELETE FROM balance WHERE catid='{$ad['catid']}'";
            $Rp = db_exec($Sl);
        }
    }
    $Sl = "SELECT * FROM expenditure";
    $Ri = db_exec($Sl);
    while ($ad = pg_fetch_array($Ri)) {
        $Sl = "SELECT * FROM accounts WHERE catid='{$ad['catid']}'";
        $Rp = db_exec($Sl);
        if (pg_num_rows($Rp) < 1) {
            $Sl = "DELETE FROM expenditure WHERE catid='{$ad['catid']}'";
            $Rp = db_exec($Sl);
        }
    }
    return "Done\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=25%>\n\t<tr><th>Quick Links</th></tr>\n\t<script>document.write(getQuicklinkSpecial());</script>\n\t<script>document.write(getQuicklinkSpecial());</script>\n\t</table>";
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:35,代码来源:remcat.php

示例7: slctacc

function slctacc()
{
    # from period
    $prds = "<select name=prd>";
    db_conn(YR_DB);
    $sql = "SELECT * FROM info WHERE prdname !=''";
    $prdRslt = db_exec($sql);
    if (pg_numrows($prdRslt) < 1) {
        return "<li class=err>ERROR : There are no periods set for the current year";
    }
    while ($prd = pg_fetch_array($prdRslt)) {
        if ($prd['prddb'] == PRD_DB) {
            $sel = "selected";
        } else {
            $sel = "";
        }
        $prds .= "<option value='{$prd['prddb']}' {$sel}>{$prd['prdname']}</option>";
    }
    $prds .= "</select>";
    core_connect();
    $sql = "SELECT * FROM accounts WHERE div = '" . USER_DIV . "' ORDER BY accname ASC";
    $accRslt = db_exec($sql) or errDie("Could not retrieve Categories Information from the Database.", SELF);
    if (pg_numrows($accRslt) < 1) {
        return "<li class=err> There are no Accounts in Cubit.";
    }
    $accs = "<select name=accids[] multiple size=10>";
    while ($acc = pg_fetch_array($accRslt)) {
        $accs .= "<option value='{$acc['accid']}'>{$acc['accname']}</option>";
    }
    $accs .= "</select>";
    $slctacc = "\n\t\t\t<p>\n\t\t\t<h3>General Ledger</h3>\n\t\t\t<h4>Select Options</h4>\n\t\t\t<table " . TMPL_tblDflts . ">\n\t\t\t<form action='" . SELF . "' method='POST'>\n\t\t\t\t<input type='hidden' name='key' value='viewtran'>\n\t\t\t\t<tr>\n\t\t\t\t\t<th>Field</th>\n\t\t\t\t\t<th>Value</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td valign='top'>Accounts</td>\n\t\t\t\t\t<td><input type='radio' name='accnt' value='slct' checked='yes'>Selected Accounts | <input type='radio' name='accnt' value='all'>All Accounts</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td valign='top'>Select account(s)</td>\n\t\t\t\t\t<td>{$accs}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr class='" . bg_class() . "'>\n\t\t\t\t\t<td>Select period</td>\n\t\t\t\t\t<td>{$prds}</td>\n\t\t\t\t</tr>\n\t\t\t\t<tr><td><br></td></tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td align='center'><input type='button' value='&laquo Back' onClick='javascript:history.back()'></td>\n\t\t\t\t\t<td align='center'><input type='submit' value='Continue &raquo;'></td>\n\t\t\t\t</tr>\n\t\t\t</table>\n\t\t\t<p>\n\t\t\t<table " . TMPL_tblDflts . " width='25%'>\n\t\t\t\t<tr><td><br></td></tr>\n\t\t\t\t<tr><th>Quick Links</th></tr>\n\t\t\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t\t\t</table>";
    return $slctacc;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:33,代码来源:ledger-xls.php

示例8: budgetTotalFromYear

function budgetTotalFromYear($accid, $budfor)
{
    db_conn("cubit");
    $sql = "SELECT SUM(bi.amt) FROM cubit.buditems bi, cubit.budgets bd\n\t\t\tWHERE bi.budid=bd.budid AND bi.id='{$accid}' AND bd.budfor='{$budfor}'\n\t\t\t\tAND bd.prdtyp='yr' AND bi.prd='" . BUDGET_YEARS_INDEX . "'";
    $rslt = db_exec($sql) or errDie("Error reading monthly budget total.");
    return pg_fetch_result($rslt, 0, 0);
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:7,代码来源:budget.lib.php

示例9: OUTPUT

function OUTPUT($_POST)
{
    extract($_POST);
    $typeid = remval($typeid);
    # Set up table to display in
    $OUTPUT .= "<td valign=top width='33%'>\r\n<table border=0 width='90%'>\r\n<tr><td align=center nowrap><h3>Document Data</h3></td></tr>\r\n<tr><th>Type</th><th>Ref</th><th>Document</th><th>Date</th><th>Description</th><th>Filename</th></tr>";
    if ($typeid != '0') {
        $whe = "AND typeid='{$typeid}' ";
    } else {
        $whe = "";
    }
    # Connect to database
    //db_conn (YR_DB);
    db_conn("yr2");
    # Query server
    $i = 0;
    $sql = "SELECT * FROM documents WHERE div = '" . USER_DIV . "' {$whe} ORDER BY docname ASC";
    $docRslt = db_exec($sql) or errDie("Unable to retrieve Documents from database.");
    if (pg_numrows($docRslt) < 1) {
        return "<li>There are no Documents in Cubit.</li>\r\n\t\t\t <p>\r\n\t\t\t <table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=15%>\r\n\t\t<tr><td><br></td></tr>\r\n\t\t<tr><th>Quick Links</th></tr>\r\n\t\t<tr class='bg-odd'><td><a href='docadd.php'>Add Document</a></td></tr>\r\n\t\t<tr class='bg-odd'><td><a href='docview.php'>View Documents</a></td></tr>\r\n\t\t<tr class='bg-odd'><td><a href='../main.php'>Main Menu</a></td></tr>\r\n\t\t<tr class='bg-odd'><td><a href='docman-index.php'>Back</a></td></tr>\r\n\t\t</table>";
    }
    while ($doc = pg_fetch_array($docRslt)) {
        $OUTPUT .= "<tr class='" . bg_class() . "'><td>{$doc['typename']}</td><td>{$doc['docref']}</td><td>{$doc['docname']}</td><td>{$doc['docdate']}</td><td>{$doc['descrip']}</td><td>{$doc['filename']}</td><td><a href='docedit.php?docid={$doc['docid']}'>Edit</a></td>";
        $OUTPUT .= "<td><a href='docdload.php?docid={$doc['docid']}'>Download</a></td><td><a href='docrem.php?docid={$doc['docid']}'>Remove</a></td></tr>";
        $i++;
    }
    $OUTPUT .= "</table></td>";
    return $OUTPUT;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:29,代码来源:test-index.php

示例10: saveImage

function saveImage($base)
{
    echo 'save fn enter';
    define('UPLOAD_DIR', 'thumbnail/');
    echo 'define ';
    //$base = str_replace('data:image/jpeg;base64,', '', $base);
    $data = base64_decode($base);
    echo 'img decoded ';
    $img_url_name = rand(0, 99999) . ".jpg";
    echo 'rand fn ';
    $file = UPLOAD_DIR . $img_url_name;
    echo 'full url';
    if (file_put_contents($file, $data)) {
        echo 'put contents in server ';
        $conn = db_conn();
        if ($conn != false) {
            echo '3rd if ';
            //echo 'connection success';
            $query = "UPDATE `video` SET `thumbnail_img`='{$img_url_name}' WHERE `id`='{$vid_id}'";
            echo 'Query ';
            $stmnt = $conn->prepare($query);
            echo 'Query prepare';
            if ($stmnt->execute()) {
                echo 'Query execute';
                echo 'updated';
            } else {
                echo 'sql error';
            }
        } else {
            echo 'conn error';
        }
    }
}
开发者ID:abhishekori,项目名称:Whats_your_talent,代码行数:33,代码来源:upload_thumbnail.php

示例11: slctacc

function slctacc()
{
    # from period
    $prds = "<select name=prd>";
    db_conn(YR_DB);
    $sql = "SELECT * FROM info WHERE prdname !=''";
    $prdRslt = db_exec($sql);
    if (pg_numrows($prdRslt) < 1) {
        return "<li class=err>ERROR : There are no periods set for the current year";
    }
    while ($prd = pg_fetch_array($prdRslt)) {
        if ($prd['prddb'] == PRD_DB) {
            $sel = "selected";
        } else {
            $sel = "";
        }
        $prds .= "<option value='{$prd['prddb']}' {$sel}>{$prd['prdname']}</option>";
    }
    $prds .= "</select>";
    core_connect();
    $sql = "SELECT * FROM accounts WHERE div = '" . USER_DIV . "' ORDER BY accname ASC";
    $accRslt = db_exec($sql) or errDie("Could not retrieve Categories Information from the Database.", SELF);
    if (pg_numrows($accRslt) < 1) {
        return "<li class=err> There are no Accounts in Cubit.";
    }
    $accs = "<select name=accids[] multiple size=10>";
    while ($acc = pg_fetch_array($accRslt)) {
        $accs .= "<option value='{$acc['accid']}'>{$acc['accname']}</option>";
    }
    $accs .= "</select>";
    $slctacc = "\n\t<p>\n\t<h3>General Ledger</h3>\n\t<h4>Select Options</h4>\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\n\t<form action='" . SELF . "' method=post>\n\t<input type=hidden name=key value=viewtran>\n\t<tr><th>Field</th><th>Value</th></tr>\n\t<tr class='bg-even'><td valign=top>Accounts</td><td><input type=radio name=accnt value=slct checked=yes>Selected Accounts | <input type=radio name=accnt value=all>All Accounts</td></tr>\n\t<tr class='bg-odd'><td valign=top>Select account(s)</td><td>{$accs}</td></tr>\n\t<tr class='bg-even'><td>Select period</td><td>{$prds}</td></tr>\n\t<tr><td><br></td></tr>\n\t<tr><td align=center><input type=button value='&laquo Back' onClick='javascript:history.back()'></td><td align=center><input type=submit value='Continue &raquo;'></td></tr>\n\t</table>\n\t<p>\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width=25%>\n\t\t<tr><td><br></td></tr>\n\t\t<tr><th>Quick Links</th></tr>\n\t\t<tr class=datacell><td align=center><a target=_blank href='../core/acc-new2.php'>Add account (New Window)</a></td></tr>\n\t\t<script>document.write(getQuicklinkSpecial());</script>\n\t</table>";
    return $slctacc;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:33,代码来源:old-ledger.php

示例12: view

function view()
{
    global $_GET;
    extract($_GET);
    if (!isset($target)) {
        $OUTPUT = "<li class=err>Invalid use of module</li>";
        require "template.php";
    }
    $vars = "";
    foreach ($_GET as $key => $value) {
        if ($key != "target") {
            $vars .= "&{$key}={$value}";
        }
    }
    // compute the auth url
    db_conn("cubit");
    $sql = "SELECT * FROM cubitnet_sitesettings WHERE div='" . USER_DIV . "'";
    $rslt = db_exec($sql) or errDie("Error reading username and password for Cubit.co.za");
    if (pg_num_rows($rslt) < 1) {
        $OUTPUT = "<li class=err>Cubit.co.za Settings not set up yet.\r\n\t\t\tPlease <a href='cubitnet_settings.php'>enter</a> the settings first</li>";
        require "template.php";
    }
    extract(pg_fetch_array($rslt));
    db_conn("cubit");
    $sql = "SELECT setting_value FROM cubitnet_settings WHERE setting_name='cubitnet_hash'";
    $rslt = db_exec($sql) or errDie("Error reading hash value for Cubit.co.za.");
    if (pg_num_rows($rslt) < 1) {
        $OUTPUT = "<li class=err>Cubit.co.za Settings not set up yet.\r\n\t\t\tPlease <a href='cubitnet_settings.php'>enter</a> the settings first</li>";
        require "template.php";
    }
    $cubitnet_hash = pg_fetch_result($rslt, 0, 0);
    print "\r\n\t<frameset rows=0,* border=0>\r\n\t\t<frame name=https_auth src='" . IDENTIFY_URL . "?hash={$cubitnet_hash}&username={$cn_username}&password={$cn_password}'>\r\n\t\t<frame name=data_frame src='{$target}?{$vars}'>\r\n\t</frameset>";
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:33,代码来源:https_face.php

示例13: write_data

function write_data($_POST)
{
    # get vars
    foreach ($_POST as $key => $value) {
        ${$key} = $value;
    }
    db_conn('cubit');
    if (!pglib_transaction("BEGIN")) {
        return "<li class=err>Unable to edit group(TB)</li>";
    }
    $Sl = "SELECT * FROM grpadd WHERE id='{$id}'";
    $Ri = db_exec($Sl) or errDie("Unable to get group details.");
    if (pg_num_rows($Ri) < 1) {
        return "Invalid group.";
    }
    $cdata = pg_fetch_array($Ri);
    # write to db
    $S1 = "UPDATE grpadd SET grpname='{$grpname}',unit='{$unit}' WHERE id  = '{$id}'";
    $Ri = db_exec($S1) or errDie("Unable to access database.");
    $Data = pg_fetch_array($Ri);
    if (!pglib_transaction("COMMIT")) {
        return "<li class=err>Unable to edit group. (TC)</li>";
    }
    $write_data = "<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "' width='50%'>\r\n\t<tr><th>Group Added</th></tr>\r\n\t<tr class=datacell><td>{$grpname} has been added to Cubit.</td></tr>\r\n\t</table>\r\n\t<p>\r\n\t<table border=0 cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t<tr><th>Quick Links</th></tr>\r\n        <tr class='bg-odd'><td><a href='docman-index.php'>Document Management</a></td></tr>\r\n\t</table>";
    return $write_data;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:26,代码来源:grpedit.php

示例14: login

function login($_POST)
{
    global $_SESSION;
    extract($_POST);
    require_lib("validate");
    $v = new validate();
    $v->isOk($code, "string", 1, 5, "Invalid company name.");
    # Display errors, if any
    if ($v->isError()) {
        $confirm = "";
        $errors = $v->getErrors();
        foreach ($errors as $e) {
            $confirm .= "<li class='err'>" . $e["msg"] . "</li>";
        }
        return slctcomp($confirm);
    }
    # Change code to lowercase
    $code = strtolower($code);
    if (!db_check("cubit_" . $code)) {
        return slctcomp("<li class='err'>Invalid Company. Select another company or<br />\n\t\t\tclick <a href='company-new.php?key=recover'>here</a> to see if Cubit can recover from this error.</li>");
    }
    # Get Company Name
    db_conn("cubit");
    $sql = "SELECT name FROM companies WHERE code = '{$code}'";
    $compRslt = db_exec($sql) or errDie("Unable to access database.", SELF);
    if (pg_numrows($compRslt) < 1) {
        $comp['name'] = "";
    } else {
        $comp = pg_fetch_array($compRslt);
    }
    $_SESSION["code"] = $code;
    $_SESSION["comp"] = $comp['name'];
    header("Location: doc-index.php");
}
开发者ID:kumarsivarajan,项目名称:accounting-123,代码行数:34,代码来源:complogin.php

示例15: enter

function enter()
{
    db_connect();
    # Get Departments
    $depts = "<select name='deptid[]'>";
    $sql = "SELECT * FROM depts ORDER BY dept ASC";
    $deptRslt = db_exec($sql);
    if (pg_numrows($deptRslt) < 1) {
        return "<li>There are no departments in Cubit.";
    } else {
        while ($dept = pg_fetch_array($deptRslt)) {
            $depts .= "<option value='{$dept['deptid']}'>{$dept['dept']}</option>";
        }
    }
    $depts .= "</select>";
    # Get all permission exceptions
    db_conn('cubit');
    $sql = "SELECT * FROM perm";
    $rs = db_exec($sql);
    if (pg_numrows($rs) < 1) {
        return "there are not new permission to be added";
    }
    $perm = "";
    while ($scr = pg_fetch_array($rs)) {
        $perm .= "<tr class='bg-odd'><td><input type=hidden name=scripts[] value='{$scr['script']}'>{$scr['script']}</td><td>{$depts}</td><td><input type=text size=30 name=names[]></td></tr>";
    }
    $enter = "<h3>New Script(s)</h3>\r\n\t<form action='" . SELF . "' method=post>\r\n\t<input type=hidden name=key value=confirm>\r\n\t<table cellpadding='" . TMPL_tblCellPadding . "' cellspacing='" . TMPL_tblCellSpacing . "'>\r\n\t\t<tr><th>Name</th><th>Department</th></tr>\r\n\t\t{$perm}\r\n\t\t<tr><td><br></td></tr>\r\n\t\t<tr><td colspan=2 align=right><input type=submit value='Confirm &raquo;'></td></tr>\r\n\t</table>\r\n\t</form>\r\n\t<p>\r\n\t<table border=0 cellpadding='2' cellspacing='1'>\r\n\t\t<tr><th>Quick Links</th></tr>\r\n\t\t<tr class='bg-odd'><td><a href='main.php'>Main Menu</a></td></tr>\r\n\t</table>";
    return $enter;
}
开发者ID:andrecoetzee,项目名称:accounting-123.com,代码行数:29,代码来源:acctab-new.php


注:本文中的db_conn函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。