Esempio n. 1
0
 /**
  * Edit action.
  *
  * @return string Edit form output.
  */
 public function edit()
 {
     $article = FormUtil::getPassedValue('article', array(), 'POST');
     $id = FormUtil::getPassedValue('id', null, 'GET');
     $submit = FormUtil::getPassedValue('submit', null, 'GET');
     if (!$id && !$submit) {
         // create action
         $article = array('title' => $title, 'body' => $body);
         // or if using Doctrine/DBObject something like this:
         $article = new Example_Model_Article();
         $article->setTitle($title);
         $article->setBody($body);
         $article->save();
     } elseif ($id && !$submit) {
         // starting edit action (display item to be edited).
         $article = dbcall("where id = {$id}...");
     }
     // handle submit (validate and commit as appropriate).
     if ($submit) {
         // Do our validations
         $articleValid = $this->validateArticle($article);
         // a method of this class which validates articles.
         // validate any hooks
         $validators = new Zikula_Collection_HookValidationProviders();
         $hook = new Zikula_ValidationHook('example.ui_hooks.general.validate_edit', $article['id'], $this, $validators);
         $this->notifyHooks($hook);
         if (!$validators->hasErrors() && !$articleValid) {
             // commit to the database
             $article->save();
             $url = new Zikula_ModUrl('Example', 'user', 'edit', 'en', array('id' => $id));
             // notify any hooks they may now commit the as the original form has been committed.
             $hook = new Zikula_ProcessHook('example.ui_hooks.general.process_edit', $id, $url);
             $this->notifyHooks($hook);
         }
     }
     $this->view->assign('article', $article);
     $this->view->fetch('example_user_edit.tpl');
     // note the called template should execute
     // {notifydisplayhooks eventname='example.ui_hooks.general.form_edit' subject=$article id=$article[id]}
 }
Esempio n. 2
0
include 'config.php';
function dbcall($a, $b, $c, $d)
{
    include 'config.php';
    $query = "UPDATE arduinosettings SET preset='{$a}', minval='{$b}', maxval='{$c}' WHERE plantnumber='{$d}'";
    $insertSite = mysql_query($query, $db_con) or die(mysql_error());
}
$Plant = $_POST['Plant'];
$minval = $_POST['minval'];
$maxval = $_POST['maxval'];
$val = $_POST['val'];
$plantnumber = $_POST['plantnumber'];
$pump = $_POST['pump'];
$wlevel = $_POST['wlevel'];
if ($val >= 0 && $val <= 3) {
    dbcall($val, $minval, $maxval, $plantnumber);
}
if ($val == 4) {
    $result = mysql_query("SELECT * FROM arduinosettings", $db_con);
    $dbplants = mysql_num_rows($result);
    if ($plantnumber > $dbplants) {
        $addamount = $plantnumber - $dbplants;
        for ($i = 1; $i <= $addamount; $i++) {
            $index = $dbplants + $i;
            mysql_query("INSERT INTO arduinosettings (plantnumber)\nVALUES ('{$index}')");
        }
    }
    if ($plantnumber < $dbplants) {
        $removeamount = $dbplants - $plantnumber;
        for ($i = 0; $i < $removeamount; $i++) {
            $index = $dbplants - $i;
Esempio n. 3
0
    $gender = $_POST['gender'];
    $sql = "insert INTO dbo.contactinfo values('{$rno}','{$name}','{$email}','{$gender}')";
    $query = sqlsrv_query($conn, $sql);
    if ($query === false) {
        exit("<pre>" . print_r(sqlsrv_errors(), true));
    }
    #while ($row = sqlsrv_fetch_array($query))
    # {  echo "<p>Hello, $row[ascore]!</p>";
    #}
    sqlsrv_free_stmt($query);
    sqlsrv_close($conn);
}
if ($rno) {
    echo 'Your Id ' . $rno . '!' . $seubid;
}
dbcall();
?>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Word Guess</title>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" type="text/css" href="css/main.css">
<script src="js/wordGuessdemo.js"></script>
<script src="js/admin.js"></script>