Пример #1
0
function HandleMoveNode()
{
    define("CMD_MOVE_CATEGORY", <<<SQL
\t\tUPDATE site_categories SET our_category_id = ? WHERE id = ?
SQL
);
    define("CMD_MOVE_ITEM", <<<SQL
\t\tUPDATE items SET our_category_id = ?, mdate = NOW() WHERE id = ?
SQL
);
    global $db;
    $srcNodes = explode(",", $_REQUEST["srcNodes"]);
    foreach ($srcNodes as $nodeStr) {
        list($nodeId, $nodeType) = explode(":", $nodeStr);
        if ($nodeType == NODE_SITE_CATEGORY) {
            $res =& $db->query(CMD_MOVE_CATEGORY, array($_REQUEST["destNodeId"], $nodeId));
            if (PEAR::isError($res)) {
                printError($res);
                exit;
            }
        } else {
            if ($nodeType == NODE_SITE_ITEM) {
                $res =& $db->query(CMD_MOVE_ITEM, array($_REQUEST["destNodeId"], $nodeId));
                if (PEAR::isError($res)) {
                    printError($res);
                    exit;
                }
            }
        }
    }
}
Пример #2
0
function do_page()
{
    handleActions();
    printError();
    printAddCardSet();
    printChangePasswordForm();
}
Пример #3
0
function retrieveOrder($resultT, $db)
{
    $row = $resultT->FetchRow();
    $name = $row['name'];
    $customerId = $row['customerId'];
    $phone = htmlentities($_GET['phone'], ENT_QUOTES);
    //BRIDGE TABLE
    $query1 = "select * from customerToOrder where customerId ='{$customerId}'";
    $result1 = $db->Execute($query1);
    if (!$result1) {
        printError();
        return;
    }
    //PIZZA ORDER TABLE
    $row1 = $result1->FetchRow();
    $orderId = $row1['orderId'];
    $query2 = "select * from pizzaOrder where orderId ='{$orderId}'";
    $result2 = $db->Execute($query2);
    if (!$result2) {
        printError();
        return;
    }
    $row2 = $result2->FetchRow();
    $toppings = $row2['toppingId'];
    $size = $row2['sizeId'];
    showOrderForm($phone, $name, $toppings, $size);
}
Пример #4
0
function getTableFromStmt($stmt)
{
    global $db;
    $results = $stmt->fetchAll(PDO::FETCH_ASSOC);
    if (count($results) == 0) {
        printError("Keine Einträge vorhanden");
        return false;
    }
    echo '<table>';
    echo '<thead>';
    echo '<tr>';
    foreach ($results[0] as $key => $val) {
        echo '<th>' . $key . '</th>';
    }
    echo '</tr>';
    echo '</thead>';
    echo '<tbody>';
    foreach ($results as $arr) {
        echo '<tr>';
        foreach ($arr as $val) {
            echo '<td>' . $val . '</td>';
        }
        echo '</tr>';
    }
    echo '</tbody>';
    echo '</table>';
}
Пример #5
0
function se_search($params, &$smarty)
{
    $keyword = isset($params['keywords']) ? $params['keywords'] : 'null';
    $modifytext = isset($params['modifytext']) ? $params['modifytext'] : true;
    $modifyscore = isset($params['modifyscore']) ? $params['modifyscore'] : true;
    /* library */
    require dirname(__FILE__) . SLASH . 'include/lib.searchengine.php';
    $result_search_engine = query_search_engine($keyword);
    if ($result_search_engine === false) {
        printError();
        return;
    }
    $iScoreMax = $result_search_engine[0]['score'];
    foreach ($result_search_engine as &$elem) {
        if ($modifyscore) {
            $pourcent = intval($elem['score'] * 100 / $iScoreMax);
            $elem['score'] = $pourcent;
        }
        if ($modifytext) {
            $elem['texte'] = substr(strongText($elem['texte'], $keyword), 0, 400) . ' ...';
            $elem['nom'] = strongText($elem['nom'], $keyword);
        }
    }
    $smarty->assign('RESULT_SEARCH_SIZE', sizeof($result_search_engine));
    $smarty->assign('RESULT_SEARCH', $result_search_engine);
    //return true;
}
Пример #6
0
 public function indexAction()
 {
     $model = new SettingsModel();
     $form = Call::form('Index');
     $countrysList = $model->getCountryList();
     if (isPost()) {
         if ($form->isValid(allPost()) and (isset($form->data["email"]) or isset($form->data["password"]) and isset($form->data["password1"]))) {
             if (Request::getParam('user')->password == md5($form->data['password'])) {
                 $data = [];
                 if ($form->data['password1'] != '') {
                     $data['password'] = md5($form->data['password1']);
                 }
                 if (isset($form->data['email'])) {
                     $data['email'] = $form->data["email"];
                 }
                 if ($form->data['news'] == 1) {
                     $data['newsletter'] = $form->data["news"];
                 }
                 $model->setSettings(Request::getParam('user')->id, $data);
                 redirect(url('settings'));
             }
         } else {
             $this->view->error = printError($form->error, 'INDEX_ERROR_');
         }
     }
     $this->view->countrysList = $countrysList;
     $this->view->title = Lang::translate('INDEX_TITLE');
 }
Пример #7
0
function do_page()
{
    handleActions();
    $player_series = Player::getSessionPlayer()->stewardsSeries();
    if (count($player_series) == 0) {
        printNoSeries();
        return;
    }
    if (isset($_POST['series'])) {
        $_GET['series'] = $_POST['series'];
    }
    if (!isset($_GET['series'])) {
        $_GET['series'] = $player_series[0];
    }
    $active_series_name = $_GET['series'];
    if (count($player_series) > 1) {
        printStewardSelect($player_series, $active_series_name);
    } else {
        echo "<center> Managing {$active_series_name} </center>";
    }
    $active_series = new Series($active_series_name);
    printError();
    printSeriesForm($active_series);
    printLogoForm($active_series);
    printRecentEventsTable($active_series);
    printPointsForm($active_series);
    printStewardsForm($active_series);
}
function HandleRemoveNode()
{
    define("CMD_SEL_MOVED_SITECATEGORIES_IDS", <<<SQL
\t\tSELECT id FROM site_categories WHERE our_category_id = ?
SQL
);
    define("CMD_SEL_MOVED_ITEMS_IDS", <<<SQL
\t\tSELECT id FROM items WHERE our_category_id = ?
SQL
);
    define("CMD_DEL_OURSITE_CATEGORY", <<<SQL
\t\tDELETE FROM our_categories WHERE id = ?
SQL
);
    define("CMD_SEL_SUBCATEGORIES_IDS", <<<SQL
\t\tSELECT id FROM our_categories WHERE parent_id = ? ORDER BY id
SQL
);
    define("CMD_DEL_CATEGORY_FROMNEW", <<<SQL
\t\tUPDATE site_categories SET our_category_id = 0 WHERE id = ?
SQL
);
    define("CMD_DEL_ITEM_FROMNEW", <<<SQL
\t\tUPDATE items SET our_category_id = 0 WHERE id = ?
SQL
);
    global $db;
    $srcNodes = explode(",", $_REQUEST["destNodes"]);
    foreach ($srcNodes as $nodeStr) {
        list($nodeId, $nodeType) = explode(":", $nodeStr);
        // Удаление скопированного узла или элемента
        if (strlen($nodeType) > 0) {
            if ($nodeType == NODE_SITE_CATEGORY) {
                $res =& $db->query(CMD_DEL_CATEGORY_FROMNEW, array($nodeId));
                if (PEAR::isError($res)) {
                    printError($res);
                    exit;
                }
            } else {
                if ($nodeType == NODE_SITE_ITEM) {
                    $res =& $db->query(CMD_DEL_ITEM_FROMNEW, array($nodeId));
                    if (PEAR::isError($res)) {
                        printError($res);
                        exit;
                    }
                } else {
                    if ($nodeType == NODE_SITE_OURITEM) {
                        $res =& $db->query("DELETE FROM our_items WHERE id = ?", array($nodeId));
                        if (PEAR::isError($res)) {
                            printError($res);
                            exit;
                        }
                    }
                }
            }
        } else {
            removeNodeWithChilds($nodeId);
        }
    }
}
Пример #9
0
function HandleViewSite()
{
    define("CMD_SEL_ITEMSCOUNT", <<<SQL
\t\tSELECT count(*) FROM items
\t\t\tWHERE category_id = ? AND our_category_id = 0
\t\t\tORDER BY status DESC, mdate DESC
SQL
);
    define("CMD_SEL_SITECATEGORIES", <<<SQL
\t\tSELECT * FROM site_categories
\t\t\tWHERE site_id = ? AND our_category_id = 0
SQL
);
    global $db;
    $res =& $db->query(CMD_SEL_SITECATEGORIES, array($_REQUEST["siteId"]));
    if (PEAR::isError($res)) {
        printError($res);
        exit;
    }
    $categories = array();
    while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT)) {
        $catCount =& $db->getOne(CMD_SEL_ITEMSCOUNT, array($row->id));
        if (PEAR::isError($catCount)) {
            $catCount = 0;
        }
        $state = null;
        if ((int) $catCount > 0) {
            $state = "collapsed";
        }
        $customAttrs = array("siteId" => $_REQUEST["siteId"]);
        $categories[] = array("nodeId" => $row->id, "name" => $row->name, "state" => $state, "tp" => NODE_SITE_CATEGORY, "image" => getCategoryImageState($row), "customAttrs" => $customAttrs);
    }
    printTree($categories, true, true, "TreeCategories");
    print "<span id=\"siteId\" siteIdNum=\"" . $_REQUEST["siteId"] . "\" style=\"display: none;\"></span>";
}
Пример #10
0
 public function newEDT($data)
 {
     if (!$this->isPatient($data['pid']) || !checkFilled($data) || !verifyDate($data['dateperf']) || !checkNumber($data['cost']) || !checkNumber($data['duration']) || !checkNumber($data['pid'])) {
         return false;
     }
     // Verify the physicians mentioned are valid
     $a = new Admin();
     $physicians = $a->getAllPhysicians();
     $enames = explode(',', $data['enames']);
     foreach ($enames as $e) {
         if (!array_search(trim($e), $physicians)) {
             printError("A physician specified in the Physician Names field does not exist.");
             return false;
         }
     }
     $success = true;
     $pid = $data['pid'];
     unset($data['pid']);
     $newEDT = 0;
     if (!$this->dbh->insert('EDTRecords', $data)) {
         $success = false;
     } else {
         $result = $this->dbh->query('SELECT MAX(edtid) AS last FROM EDTRecords');
         $newEDT = $result[0]['last'];
         // Could potentially be bad, if the ordering of insertions between users interferes
     }
     if (!$this->dbh->insert('PatientExaminations', array('pid' => $pid, 'edtid' => $newEDT))) {
         $success = false;
     }
     return $success;
 }
Пример #11
0
function HandleAddItem()
{
    define("CMD_ADD_OURITEM", <<<SQL
\t\tINSERT INTO our_items (name, our_category_id, art, mdate)
\t\t\tVALUES (?, ?, ?, NOW())
SQL
);
    define("CMD_SEL_OURITEM_NEWID", <<<SQL
\t\tSELECT id FROM our_items 
\t\t\tWHERE name = ? AND our_category_id = ? AND art = ?
SQL
);
    global $db;
    $newItem = iconv("UTF-8", "windows-1251", urldecode($_REQUEST["itemName"]));
    $art = "art" . $_REQUEST["parentNodeId"] . "_" . time();
    $res =& $db->query(CMD_ADD_OURITEM, array($newItem, $_REQUEST["parentNodeId"], $art));
    if (PEAR::isError($res)) {
        printError($res);
        exit;
    }
    $newId =& $db->getOne(CMD_SEL_OURITEM_NEWID, array($newItem, $_REQUEST["parentNodeId"], $art));
    if (PEAR::isError($newId)) {
        printError($newId);
        exit;
    }
    // ¬озвратить номер добавленой категории
    print trim($newId);
}
Пример #12
0
function HandleAddNode()
{
    define("CMD_ADD_OURSITE_CATEGORY", <<<SQL
\t\tINSERT INTO our_categories (name, parent_id) VALUES (?, ?)
SQL
);
    define("CMD_SEL_OURSITE_NEWCATEGORYID", <<<SQL
\t\tSELECT id FROM our_categories WHERE name = ? AND parent_id = ?
SQL
);
    global $db;
    $newCategory = iconv("UTF-8", "windows-1251", urldecode($_REQUEST["categName"]));
    $res =& $db->query(CMD_ADD_OURSITE_CATEGORY, array($newCategory, $_REQUEST["parentNodeId"]));
    if (PEAR::isError($res)) {
        printError($res);
        exit;
    }
    $newId =& $db->getOne(CMD_SEL_OURSITE_NEWCATEGORYID, array($newCategory, $_REQUEST["parentNodeId"]));
    if (PEAR::isError($newId)) {
        printError($newId);
        exit;
    }
    // ¬озвратить номер добавленой категории
    print trim($newId);
}
Пример #13
0
function mysqlConnectDB($db)
{
    $servername = "localhost";
    $username = "******";
    $password = "******";
    $dbname = $db;
    $conn = new mysqli($servername, $username, $password, $dbname);
    if ($conn->connect_error) {
        printError();
    }
    return $conn;
}
Пример #14
0
function getParameter($name, array $argv)
{
    $envName = 'GITLAB_' . preg_replace('/\\s|-/', '_', strtoupper($name));
    if (isset($_ENV[$envName])) {
        return $_ENV[$envName];
    }
    $pregName = preg_quote($name);
    array_shift($argv);
    foreach ($argv as $argument) {
        if (preg_match("/^--{$pregName}=(.+)/", $argument, $matches)) {
            return $matches[1];
        }
    }
    printError("ERROR: Please provide the parameter --{$name} or set the environment variable {$envName}");
    exit(1);
}
Пример #15
0
function validateError()
{
    if (isset($_GET["error"])) {
        $accion = $_GET["error"];
        switch ($accion) {
            case 0:
                printError(0);
                break;
            case 1:
                printError(1);
                break;
            case 2:
                printError(2);
                break;
            default:
                break;
        }
    }
}
function HandleItemFirstInfo()
{
    global $db;
    if (!isset($_REQUEST["nodeType"])) {
        return;
    }
    if ($_REQUEST["nodeType"] != NODE_SITE_ITEM) {
        return;
    }
    // Вывод инфы для элемента источника
    $sql = "SELECT * FROM items WHERE id = ?";
    $row =& $db->getRow($sql, array($_REQUEST["nodeId"]), DB_FETCHMODE_OBJECT);
    if (PEAR::isError($row)) {
        printError($row);
        exit;
    }
    $ITEM_ID = $_REQUEST["nodeId"];
    $NOEDIT = true;
    $FIELDS = getViewFields($row->category_id);
    include "tpls/InfoItem.php";
}
Пример #17
0
function HandleSetStatus()
{
    define("CMD_SET_STAT", <<<SQL
\t\tUPDATE items SET status = ? WHERE id = ?
SQL
);
    define("CMD_SET_STAT_OURITEM", <<<SQL
\t\tUPDATE our_items SET status = ? WHERE id = ?
SQL
);
    define("CMD_SET_STAT_OURCAT", <<<SQL
\t\tUPDATE our_categories SET status = ? WHERE id = ?
SQL
);
    global $db;
    require_once "../includes/JSON.php";
    $json = new Services_JSON();
    if (get_magic_quotes_gpc()) {
        $_REQUEST["nodes"] = stripslashes($_REQUEST["nodes"]);
    }
    $data = $json->decode($_REQUEST["nodes"]);
    $res = null;
    $maxIndex = sizeof($data) - 1;
    foreach ($data as $i => $node) {
        if ($node->tp == NODE_SITE_ITEM) {
            $res = $db->query(CMD_SET_STAT, array($maxIndex - $i, $node->id));
        } else {
            if ($node->tp == NODE_SITE_OURITEM) {
                $res = $db->query(CMD_SET_STAT_OURITEM, array($maxIndex - $i, $node->id));
            } else {
                $res = $db->query(CMD_SET_STAT_OURCAT, array($maxIndex - $i, $node->id));
            }
        }
        if (PEAR::isError($res)) {
            printError($res);
            exit;
        }
    }
}
Пример #18
0
function checkSystem()
{
    global $messagem, $def;
    $language = array("pt", "es", "en", "fr");
    $diretory = array("xml", "html", "ini");
    if (!is_dir($def['SITE_PATH'])) {
        $cause = $message["invalid_dir"] . $def['SITE_PATH'];
        printError($cause, $message["check_def"]);
        return false;
    }
    foreach ($language as $lang) {
        foreach ($diretory as $dir) {
            $dir_path = $def['DATABASE_PATH'] . $dir . "/" . $lang . "/";
            if (!is_writeable($dir_path)) {
                $cause = $message["invalid_perm"] . $dir_path;
                printError($cause, $message["check_perm"]);
                return false;
            }
        }
    }
    return true;
}
Пример #19
0
function HandleExpand()
{
    global $db;
    if ($_REQUEST["treeId"] == "TreeCategories") {
        $res =& $db->query(CMD_SEL_ITEMS, array($_REQUEST["nodeId"]));
        if (PEAR::isError($res)) {
            printErr($res);
            exit;
        }
        $items = array();
        while ($row =& $res->fetchRow(DB_FETCHMODE_OBJECT)) {
            $customAttrs = array("categId" => $row->category_id);
            $items[] = array("nodeId" => $row->id, "name" => $row->art . " - " . $row->name, "state" => "item", "tp" => NODE_SITE_ITEM, "image" => getImageState($row), "customAttrs" => $customAttrs);
        }
        printTree($items, false);
    } else {
        if ($_REQUEST["treeId"] == "TreeOurSite") {
            $res =& $db->query(CMD_SEL_SUBCATEGORIES, array($_REQUEST["nodeId"]));
            if (PEAR::isError($res)) {
                printError($res);
                exit;
            }
            $categories = array();
            while ($row =& $res->fetchRow(DB_FETCHMODE_OBJECT)) {
                $catCount = getItemsCount($row->id);
                $state = null;
                if ($catCount > 0) {
                    $state = "collapsed";
                }
                $imgState = $row->viewmode == true ? "pics/ourcategoryHidden.png" : "pics/ourcategory.png";
                $categories[] = array("nodeId" => $row->id, "name" => $row->name, "state" => $state, "image" => $imgState);
            }
            addMovedItems($categories, $_REQUEST["nodeId"]);
            printTree($categories, false);
        }
    }
}
Пример #20
0
    $testClient->markReadyForPickup($orderId);
    printSuccess();
    printTitle('mark-delivered');
    $testClient->markDelivered($orderId);
    printSuccess();
    printTitle('cancel');
    $cancelOrderItems = [new \SlevomatZboziApi\Request\CancelOrderItem('787887454', 1), new \SlevomatZboziApi\Request\CancelOrderItem('7844544', 2)];
    $testClient->cancelOrder($orderId, $cancelOrderItems, 'Duvod storna');
    printSuccess();
} catch (\SlevomatZboziApi\Request\ConnectionErrorException $e) {
    printError(sprintf('%s %s', $e->getMessage(), $e->getPrevious()->getMessage()));
    //retry request
} catch (\SlevomatZboziApi\Request\InvalidRequestException $e) {
    printError($e->getMessage(), 'red', 'REQUEST ERROR: ');
    //fix error
} catch (\SlevomatZboziApi\ZboziApiException $e) {
    printError($e->getMessage());
    //retry request
}
function printError($message, $color = 'orangered', $startWith = '')
{
    echo sprintf('<br><b style="color: %s">%s%s</b><hr>', $color, $startWith, $message);
}
function printSuccess($additionalInfo = '')
{
    echo sprintf('<br><b style="color: green"> OK%s</b><hr>', $additionalInfo);
}
function printTitle($title)
{
    echo sprintf('<br><b style="background-color: darkslategray; color: white; padding: 5px">%s</b><br>', $title);
}
Пример #21
0
function checkNumber($field)
{
    if (!is_numeric($field)) {
        printError("Please ensure you input numbers in the appropriate fields (cost, patient ID, duration, etc)");
        return false;
    }
    return true;
}
Пример #22
0
if ($strSiteUrl != SITE_URL) {
    printFatalError(sprintf(_('
Site Url is: %s, while it should be %s.
Please change it in the web site config file: %s'), SITE_URL, $strSiteUrl, $configFile->getRelativePath()));
}
echo "[ OK ]\n";
echo _('Checking url rewriting ....');
$oFile = new PFile(SITE_PATH . '.htaccess');
if (!is_file($oFile->path)) {
    echo "[ !!!! WARNING !!!! ]\n";
    echo _('No .htaccess file has been found, you should rename the htaccess.txt file in .htaccess to active the url rewriting');
} else {
    //check the rewrite base match with the SITE_URL
    $strContent = file_get_contents($oFile->path);
    if (!preg_match('/(RewriteBase)([^\\n]*)/', $strContent, $tabMatch)) {
        printError('Can not find the rewritebase');
    } else {
        $strBase = trim($tabMatch[2]);
        if ($strBase != SITE_URL) {
            printFatalError(sprintf(_('RewriteBase is: %s, while it should be %s.
Please change it int the .htaccess file.
			'), $strBase, SITE_URL));
        }
    }
    echo "[ OK ]";
}
echo '

###############################################################################
Your installation seems to be good.
You should now remove the ' . basename(__FILE__) . ' file to access your web site.
Пример #23
0
	$response = $client ->track($request);

    if ($response -> HighestSeverity != 'FAILURE' && $response -> HighestSeverity != 'ERROR'){
		if($response->HighestSeverity != 'SUCCESS'){
			echo '<table border="1">';
			echo '<tr><th>Track Reply</th><th>&nbsp;</th></tr>';
			trackDetails($response->Notifications, '');
			echo '</table>';
		}else{
	    	if ($response->CompletedTrackDetails->HighestSeverity != 'SUCCESS'){
				echo '<table border="1">';
			    echo '<tr><th>Shipment Level Tracking Details</th><th>&nbsp;</th></tr>';
			    trackDetails($response->CompletedTrackDetails, '');
				echo '</table>';
			}else{
				echo '<table border="1">';
			    echo '<tr><th>Package Level Tracking Details</th><th>&nbsp;</th></tr>';
			    trackDetails($response->CompletedTrackDetails->TrackDetails, '');
				echo '</table>';
			}
		}
        printSuccess($client, $response);
    }else{
        printError($client, $response);
    } 
    
    writeToLog($client);    // Write to log file   
} catch (SoapFault $exception) {
    printFault($exception, $client);
}
?>
Пример #24
0
#!/bin/php
<?php 
/*
 * This file is part of fgrosse/gitlab-api.
 *
 * Copyright © Friedrich Große <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
use Gitlab\Client\GitlabGuzzleClient;
use Gitlab\Client\HttpGitlabClient;
include __DIR__ . '/../vendor/autoload.php';
include __DIR__ . '/cli_helper.php';
$baseUrl = getParameter('base-url', $argv);
$token = getParameter('token', $argv);
$project = getParameter('project', $argv);
try {
    $guzzleClient = GitlabGuzzleClient::factory(['base_url' => $baseUrl, 'api_token' => $token]);
    $client = new HttpGitlabClient($guzzleClient);
    $mergeRequests = $client->listMergeRequests($project, $state = 'closed', $order = 'updated_at', $sort = 'asc', $page = 1, $perPage = 5);
    foreach ($mergeRequests as $mergeRequest) {
        echo $mergeRequest . PHP_EOL;
    }
} catch (Exception $exception) {
    printError('An Exception of type ' . get_class($exception) . ' occurred:');
    printError($exception->getMessage());
    exit(1);
}
Пример #25
0
 /**
  * output error
  *
  * @param $message
  */
 function _outputError($message)
 {
     printError($this->name, $message);
 }
Пример #26
0
        require dirname(__FILE__) . '/include/html/menu.php';
        require dirname(__FILE__) . '/include/html/form/installation.php';
    }
    exit - 1;
}
// --------------- CONFIGURATION ---------------
if (!isset($_GET['admin'])) {
    if (isset($error) && $error == true) {
        printError('Login error');
    }
    require dirname(__FILE__) . '/include/html/menu.php';
    require dirname(__FILE__) . '/include/html/form/configuration.php';
} else {
    if (!isset($_SESSION['admin_id'])) {
        if (isset($error) && $error == true) {
            printError('Login error');
        }
        require dirname(__FILE__) . '/include/html/menu.php';
        require dirname(__FILE__) . '/include/html/form/login.php';
    } else {
        ?>
      <nav class="navbar navbar-default">
        <p class="navbar-text">Signed as <?php 
        echo $_SESSION['admin_id'];
        ?>
 / 
          <a class="navbar-link" href="index.php?logout" title="Logout ?">logout ?</a>
        </p>
      </nav>
      
  <?php 
Пример #27
0
}
?>
                            </select>
                        </div>
                        <div class="small-3 large-3 columns">
                            <input type="number" name="menge" placeholder="Menge" />
                        </div>
                        <div class="small-3 large-3 columns">
                            <input type="submit" name="erfassen" value="Bestellen" class="button postfix" />
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <?php 
if (isset($_POST['erfassen'])) {
    // Bestellung erfassen
    $sql = "call lieferantenbestellung(?, ?);";
    $stmt = $db->prepare($sql);
    $stmt->bindValue(1, (int) $_POST['artikel'], PDO::PARAM_INT);
    $stmt->bindValue(2, (int) $_POST['menge'], PDO::PARAM_INT);
    $stmt->execute();
    if (!$stmt) {
        printError("Die Prozedur 'lieferantenbestellung' besteht nicht!");
    } else {
        printSuccess("Die Bestellung wurde erfasst!");
    }
}
?>
    </div>
</div>
Пример #28
0
        }
        print "<a href=\"ViewComment.php?comment_table={$comment_table}&storyId=" . $follow_row["story_id"] . "&commentId=" . $follow_row["id"] . "&filter={$filter}&display={$display}\">" . $follow_row["subject"] . "</a> by " . getUserName($follow_row["writer"], $link) . " on " . $follow_row["date"] . "<br>\n";
        if ($follow_row["childs"] > 0) {
            display_follow_up($follow_row["id"], $level + 1, $display, $filter, $link, $comment_table);
        }
    }
}
$scriptName = "ViewStory.php";
include "PHPprinter.php";
$startTime = getMicroTime();
// Check parameters
$storyId = $HTTP_POST_VARS['storyId'];
if ($storyId == null) {
    $storyId = $HTTP_GET_VARS['storyId'];
    if ($storyId == null) {
        printError($scriptName, $startTime, "Viewing story", "You must provide a story identifier!<br>");
        exit;
    }
}
getDatabaseLink($link);
$result = mysql_query("SELECT * FROM stories WHERE id={$storyId}") or die("ERROR: Query failed");
if (mysql_num_rows($result) == 0) {
    $result = mysql_query("SELECT * FROM old_stories WHERE id={$storyId}") or die("ERROR: Query failed");
    $comment_table = "old_comments";
} else {
    $comment_table = "comments";
}
if (mysql_num_rows($result) == 0) {
    die("<h3>ERROR: Sorry, but this story does not exist.</h3><br>\n");
}
$row = mysql_fetch_array($result);
Пример #29
0
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <body>
    <?php 
$scriptName = "ViewUserInfo.php";
include "PHPprinter.php";
$startTime = getMicroTime();
$userId = $HTTP_POST_VARS['userId'];
if ($userId == null) {
    $userId = $HTTP_GET_VARS['userId'];
    if ($userId == null) {
        printError($scriptName, $startTime, "Viewing user information", "You must provide an item identifier!<br>");
        exit;
    }
}
getDatabaseLink($link);
begin($link);
$userResult = mysql_query("SELECT * FROM users WHERE users.id={$userId}", $link) or die("ERROR: Query failed");
if (mysql_num_rows($userResult) == 0) {
    commit($link);
    die("<h3>ERROR: Sorry, but this user does not exist.</h3><br>\n");
}
printHTMLheader("RUBiS: View user information");
// Get general information about the user
$userRow = mysql_fetch_array($userResult);
$firstname = $userRow["firstname"];
$lastname = $userRow["lastname"];
$nickname = $userRow["nickname"];
$email = $userRow["email"];
$creationDate = $userRow["creation_date"];
$rating = $userRow["rating"];
Пример #30
0
            break;
            // Do nothing
        // Do nothing
        default:
            printError("Nothing was done...");
    }
    // ==================================================
    // Special cases
    // Process an individual EDT
} elseif (array_key_exists('processEDT', $_GET) && $_GET['processEDT']) {
    $b = new Billing();
    $t = new Treatment();
    if ($b->processEDT($_GET['processEDT'])) {
        header('Location: index.php?billing&success=b');
    } else {
        printError("Failed to process EDT record.");
    }
    // For first run of this HMS (index.php)
} elseif ($_SERVER['QUERY_STRING'] == 'insertEmployees') {
    $db = new Database();
    if ($db->query("SELECT sin FROM Employees")) {
        echo "<p class='notice'>This employee already exists.</p>";
    } else {
        $employee = array('ename' => 'Emp1', 'sin' => 1337, 'address' => '1 Hello Wrld.');
        $job = array('jname' => 'OB', 'jtype' => 'C');
        if ($db->insert('Employees', $employee)) {
            echo "<p class='success'>Employee inserted</p>";
        } else {
            echo "<p class='error'>Could not insert employee</p>";
        }
        if ($db->insert('Jobs', $job)) {