Beispiel #1
0
 public function showLogin($arr = array('user' => 'Username', 'pass' => 'Password', 'login' => 'Sign in'), $invalid)
 {
     require 'Forms.php';
     # in the same directory as Login.php
     $forms = new Forms('');
     $fcnt = 1;
     # First field
     foreach ($arr as $k => $v) {
         if ($k != 'login') {
             $forms->textBox($v, $k, $fcnt == 1 && isset($_POST["txt_{$k}"]) && !empty($_POST["txt_{$k}"]) ? $_POST["txt_{$k}"] : '', 1, in_array($v, $invalid), '', 1);
             if ($fcnt == 1) {
                 $u = $v;
                 $u2 = $k;
             }
             // End if.
             if ($fcnt == 2) {
                 $p = $v;
                 $p2 = $k;
             }
             // End if.
             $fcnt++;
         }
         // End if.
     }
     // End foreach.
     $forms->submitButton(isset($arr['login']) ? $arr['login'] : '******', 'login', 1);
     echo $forms->closeform();
     unset($forms);
     $focus = '';
     if (count($invalid) || empty($_POST["txt_{$p}"])) {
         $focus = "\n<script>document.forms[0].txt_{$p2}.focus();</script>";
     }
     if ((!count($invalid) || in_array($u, $invalid)) && empty($_POST["txt_{$u2}"])) {
         $focus = "\n<script>document.forms[0].txt_{$u2}.focus();</script>";
         //$focus = "\n<script>\$(document).ready(function(){ \$('.classform input[name=txt_{$u2}]').focus(); });</script>";
     }
     // End if.
     if (!empty($focus)) {
         echo $focus;
     }
     //else  echo '<script>document.forms[0].user.focus();</script>';
 }
Beispiel #2
0
<?php

/*
 * Adds a new subtopic record into the hcd_helpstopics table given a topic ID
 */
//ini_set('display_errors', 1);
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
    require_once '../../../../../includes/classes/Forms.php';
    $forms = new Forms('');
    // , array(), 'txt_stopic'
    $forms->textBox('Enter name of new sub topic', 'stopic', '', 1, 0, '', 1);
    $forms->submitButton('New sub topic', 'stnew', 1);
    unset($forms);
} else {
    require_once '../../../../../includes/classes/Db.php';
    $link = DBCxn::get('../../../../../_db/help.php');
    $r = $link->prepare("INSERT INTO stopics (topicid,stopic,mod_datetime) VALUES(?,?,NOW())");
    $r->execute(array($_GET['topicid'], $_POST['txt_stopic']));
    if ($r->rowCount() == 1) {
        $r2 = $link->prepare("UPDATE topics SET mod_datetime=NOW() WHERE topic_id=?");
        $r2->execute(array($_GET['topicid']));
        if ($r2->rowCount() == 1) {
            header('Location: /apps/help/');
        } else {
            echo "{$_GET['topicid']}";
        }
    } else {
        echo "{$_POST['txt_stopic']}";
    }
}
// End if.