doupdate.php

来自「Linux嵌入式设计配套光盘,学习嵌入式设计可参考」· PHP 代码 · 共 45 行

PHP
45
字号
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN"><html><!-- ------------------------------------------------------------ --><!--  DoUpdate.php                        --><!--  Copyright (C) 2005 Robert W Smith (bsmith@linuxtoys.org)  --><!--                                --><!--   This program is distributed under the terms of the GNU   --><!--   GPL.   See the file COPYING file.              --><!-- ------------------------------------------------------------ --><head><title>Laddie Alarm System</title></head><body><?php  // Suppress Postgres error messages  error_reporting(error_reporting() & 0xFFFD);  // connect to the LAD-D application   $connection = pg_connect("localhost", "8888", "bsmith");  if ($connection == "") {     printf("$s%s%s", "Unable to connect to Laddie Alarm application.<br>",      "Please verify that the application is running.<br>");    exit();  }  // This app processes an input form to clear or test an alarm.  $id     = htmlentities($_GET['id']);  $col    = htmlentities($_GET['col']);  $nvalue   = htmlentities($_GET['nvalue']);  if ($id >=0 && $id <= 5 && $col == "alarm") {    $command = "UPDATE Zone SET $col=$nvalue WHERE id=$id";    $result = pg_exec($connection, $command);    if ($result == "") {       exit();    }    pg_freeresult($result);  }  printf("Ladd application update complete.");  pg_close($connection);?></body></html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?