コード例 #1
0
ファイル: index.php プロジェクト: Coolbots7/CB_SmartHouse
<?php

include "connect.php";
$conn = Connection();
$currentUserName = $_GET["user"];
if (is_null($currentUserName) || $currentUserName == "") {
    $currentUserName = "******";
}
?>

<html>
   <head>
		<title>House Server</title>
		<link href="style.css" rel="stylesheet" type="text/css">
		<style type="text/css"></style>
		<link rel="shortcut icon" type="image/x-icon" href="favicon.ico">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">
		<script src="http://code.jquery.com/jquery-1.11.3.min.js"></script>
		<script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
	</head>
	
	<body style="height:auto;margin:0px;padding:0px;">	
	
		<div class="fixed-nav-bar">
		
			<h2>House Server</h2>
			<h3>Current User: <?php 
echo $currentUserName;
?>
</h3>
コード例 #2
0
ファイル: user_upload.php プロジェクト: jonasbunawan/Catalyst
// Command Line Directives in short form
$shortcmdirective = "u:";
$shortcmdirective .= "p:";
$shortcmdirective .= "h:";
// Command Line Directives in complete form
$longcmdirective = array("file:", "create_table", "dry_run", "help");
// Declaring $count variable to count number of rows processed, $user variable to store users' data onto array, & $rows variable to count number of affected rows
$count = 0;
$rows = 0;
$user = array(array());
// Storing Value of Command Line Directives by using getopt() function for both short and complete options.
$options = getopt($shortcmdirective, $longcmdirective);
// First if conditional statement contains function to display help message when --help is called within application execution.
if (Help(isset($options['help'])) === FALSE) {
    if (isset($options['u']) and isset($options['p']) and isset($options['h'])) {
        $connection = Connection($options['u'], $options['h'], $options['p']);
        if (DatabaseSelection($connection, 'Catalyst') === FALSE) {
            DatabaseCreation($connection, 'Catalyst');
        } elseif (isset($options['create_table'])) {
            $result = mysqli_query($connection, "SHOW TABLES LIKE 'USERS'");
            $SQL = "CREATE TABLE IF NOT EXISTS Users (\n\t\t\t\t\t\tname VARCHAR(30) NOT NULL,\n\t\t\t\t\t\tsurname VARCHAR(30),\n\t\t\t\t\t\temail\tVARCHAR(50) UNIQUE\n\t\t\t\t\t\t)";
            if (mysqli_num_rows($result) > 0) {
                mysqli_query($connection, "DROP TABLE Users");
                echo "\n" . "Users table exists and will be rebuilt shortly" . "\n";
            }
            if ($connection->query($SQL) == TRUE) {
                echo "\n" . "Table Users was created successfully" . "\n";
            } else {
                die("\n" . "Error creating table: " . $connection->error . "\n");
            }
        }
コード例 #3
0
<?php

include "connect.php";
$link = Connection();
$result = mysql_query("SELECT * FROM `lightdata` ORDER BY `dataupdate` DESC", $link);
?>

<html>
   <head>
      <title>Sensor Data</title>
   </head>
<body>
   <h1>Light Sensor readings</h1>

   <table border="1" cellspacing="1" cellpadding="1">
		<tr>
			<td>Id&nbsp;</td>
			<td>Lux Data</td>
			<td>Update</td>
		</tr>

      <?php 
if ($result !== FALSE) {
    while ($row = mysql_fetch_array($result)) {
        printf("<tr><td> &nbsp;%s </td><td> &nbsp;%s&nbsp; </td><td> &nbsp;%s&nbsp; </td></tr>", $row["id"], $row["data"], $row["dataupdate"]);
    }
    mysql_free_result($result);
    mysql_close();
}
?>
コード例 #4
0
ファイル: database.php プロジェクト: sparrow41/training
 public function __construct()
 {
     $this->connection = Connection($databaseLanguage);
     // pg_connect
 }