Folder reorganize 1
This commit is contained in:
48
OLD/searchtables/index.php
Normal file
48
OLD/searchtables/index.php
Normal file
@@ -0,0 +1,48 @@
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Search</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" type="text/css" href="style.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<table style="margin: 0px auto;" class="stat">
|
||||
<tr>
|
||||
<th>LASUCA CONTROLS SEARCH</th>
|
||||
<th><a href="../overview.php">BACK TO OVERVIEW</a></th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
<form action="test.php" method="GET">
|
||||
<input type="text" placeholder="2016-10-06 05:00:00..." name="query" />
|
||||
<input type="submit" value="Search" />
|
||||
</form>
|
||||
</th>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th colspan="2">
|
||||
The format for the search input needs to be very specific. It should be entered as follows...
|
||||
<br>
|
||||
<br>
|
||||
To search for a specfic date, the format would be <font color="red"><u>2016-10-02</u></font>. This is year, month, day respectively. This specific search would return all of the results for October 2nd.
|
||||
<br>
|
||||
<br>
|
||||
To search for a specific hour, the format would be <font color="red"><u>2016-10-02 15</u></font>. This is year, month, day, hour respectively. This specific search would return all of the results for October 2nd for the entire 3PM timespan.
|
||||
<br>
|
||||
<br>
|
||||
To search for a specific minute, the format would be <font color="red"><u>2016-10-02 15:30</u></font>. This is year, month, day, hour, minute respectively. This specific search would return all of the results for October 2nd for the entire 3:30PM timespan.
|
||||
<br>
|
||||
<br>
|
||||
All searches need to be based on a 24 hour clock.
|
||||
|
||||
<th>
|
||||
|
||||
</tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
141
OLD/searchtables/results.php
Normal file
141
OLD/searchtables/results.php
Normal file
@@ -0,0 +1,141 @@
|
||||
<head>
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
|
||||
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<?php
|
||||
$username="corey";
|
||||
$password="41945549";
|
||||
$database="controls";
|
||||
|
||||
mysql_connect('192.168.0.14',$username,$password);
|
||||
@mysql_select_db($database) or die( "Unable to select database");
|
||||
$term = mysql_real_escape_string($_REQUEST['term']);
|
||||
$query = "(SELECT * FROM tables WHERE Z_TIMESTAMP LIKE '%".$term."%' ORDER BY id DESC)";
|
||||
|
||||
$result=mysql_query($query);
|
||||
|
||||
mysql_close();
|
||||
|
||||
?>
|
||||
|
||||
<table style="margin: 0px auto;" class="stat">
|
||||
<tr>
|
||||
<th><a href="search.php">RESET SEARCH</a></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Search Results</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><a href="edit" id="edit">Toggle Columns On/Off</a></th>
|
||||
</tr>
|
||||
|
||||
|
||||
<table id="table" style="margin: 0px auto;" class="stat">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>neoutput</th>
|
||||
<th>nesetpoint</th>
|
||||
<th>nescale</th>
|
||||
<th>seoutput</th>
|
||||
<th>sescale</th>
|
||||
<th>sesetpoint</th>
|
||||
<th>woutput</th>
|
||||
<th>wscale</th>
|
||||
<th>wsetpoint</th>
|
||||
<th>tdoutput</th>
|
||||
<th>tdalarm</th>
|
||||
<th>nam</th>
|
||||
<th>sam</th>
|
||||
<th>wam</th>
|
||||
<th>tdratio</th>
|
||||
<th>tdsetpoint</th>
|
||||
<th>tdinput</th>
|
||||
<th>tdmg</th>
|
||||
<th>nesetpoint3</th>
|
||||
<th>nespswitch</th>
|
||||
<th>wsetpoint3</th>
|
||||
<th>wspswitch</th>
|
||||
<th>mcctons</th>
|
||||
<th>tdratios</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
while($row=mysql_fetch_assoc($result))
|
||||
{
|
||||
echo "<tr>";
|
||||
echo "<td>".$row [ 'neoutput' ]."</td>";
|
||||
echo "<td>".$row [ 'nesetpoint' ]."</td>";
|
||||
echo "<td>".$row [ 'nescale' ]."</td>";
|
||||
echo "<td>".$row [ 'seoutput' ]."</td>";
|
||||
echo "<td>".$row [ 'sescale' ]."</td>";
|
||||
echo "<td>".$row [ 'sesetpoint' ]."</td>";
|
||||
echo "<td>".$row [ 'woutput' ]."</td>";
|
||||
echo "<td>".$row [ 'wscale' ]."</td>";
|
||||
echo "<td>".$row [ 'wsetpoint' ]."</td>";
|
||||
echo "<td>".$row [ 'tdoutput' ]."</td>";
|
||||
echo "<td>".$row [ 'tdalarm' ]."</td>";
|
||||
echo "<td>".$row [ 'nam' ]."</td>";
|
||||
echo "<td>".$row [ 'sam' ]."</td>";
|
||||
echo "<td>".$row [ 'wam' ]."</td>";
|
||||
echo "<td>".$row [ 'tdratio' ]."</td>";
|
||||
echo "<td>".$row [ 'tdsetpoint' ]."</td>";
|
||||
echo "<td>".$row [ 'tdinput' ]."</td>";
|
||||
echo "<td>".$row [ 'tdmg' ]."</td>";
|
||||
echo "<td>".$row [ 'nesetpoint3' ]."</td>";
|
||||
echo "<td>".$row [ 'nespswitch' ]."</td>";
|
||||
echo "<td>".$row [ 'wsetpoint3' ]."</td>";
|
||||
echo "<td>".$row [ 'wspswitch' ]."</td>";
|
||||
echo "<td>".$row [ 'mcctons' ]."</td>";
|
||||
echo "<td>".$row [ 'tdratios' ]."</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</table>
|
||||
<script type="text/javascript">
|
||||
$('#edit').click(function() {
|
||||
var headers = $('#table th').map(function() {
|
||||
var th = $(this);
|
||||
return {
|
||||
text: th.text(),
|
||||
shown: th.css('display') != 'none'
|
||||
};
|
||||
});
|
||||
|
||||
var h = ['<div id=tableEditor><button id=done>Done</button><table><thead>'];
|
||||
$.each(headers, function() {
|
||||
h.push('<tr><th><input type=checkbox',
|
||||
(this.shown ? ' checked ' : ' '),
|
||||
'/> ',
|
||||
this.text,
|
||||
'</th></tr>');
|
||||
});
|
||||
h.push('</thead></table></div>');
|
||||
$('body').append(h.join(''));
|
||||
|
||||
$('#done').click(function() {
|
||||
var showHeaders = $('#tableEditor input').map(function() { return this.checked; });
|
||||
$.each(showHeaders, function(i, show) {
|
||||
var cssIndex = i + 1;
|
||||
var tags = $('#table th:nth-child(' + cssIndex + '), #table td:nth-child(' + cssIndex + ')');
|
||||
if (show)
|
||||
tags.show();
|
||||
else
|
||||
tags.hide();
|
||||
});
|
||||
|
||||
$('#tableEditor').remove();
|
||||
return false;
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
26
OLD/searchtables/search.php
Normal file
26
OLD/searchtables/search.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<head>
|
||||
<link rel="stylesheet" href="styles.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<table >
|
||||
<tr>
|
||||
<th>Controls Data Search</th>
|
||||
</tr>
|
||||
</table>
|
||||
<table >
|
||||
<tr>
|
||||
<td>
|
||||
<form action="results.php">
|
||||
<input type="text" placeholder="2016-10-06 05:00:00..." name="term" />
|
||||
<input type="submit" value="Search" />
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<table style="margin: 0px auto;" class="stat">
|
||||
|
||||
</table>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
126
OLD/searchtables/style.css
Normal file
126
OLD/searchtables/style.css
Normal file
@@ -0,0 +1,126 @@
|
||||
body {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
#font {
|
||||
font: normal 16px/1 "Lucida Console", Monaco;
|
||||
color: rgba(255,255,255,1);
|
||||
display: inline;
|
||||
float: left;
|
||||
}
|
||||
#tableEditor {
|
||||
position: absolute;
|
||||
left: 20px; top: 20px;
|
||||
padding: 5px;
|
||||
border: 1px solid #000;
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 600px;
|
||||
}
|
||||
|
||||
th, td {
|
||||
padding: .5em 1em;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
thead th {
|
||||
white-space: nowrap;
|
||||
border-bottom: 1px solid #ccc;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
th:first-child,
|
||||
td:first-child {
|
||||
text-align: left;
|
||||
}
|
||||
tr:nth-child(even) {
|
||||
background: #ccc;
|
||||
color: blck;
|
||||
}
|
||||
tr:nth-child(odd) {
|
||||
background: #FFF;
|
||||
color: black;
|
||||
}
|
||||
tbody th, td {
|
||||
border-bottom: 1px solid #e6e6e6;
|
||||
}
|
||||
|
||||
.enhanced th,
|
||||
.enhanced td {
|
||||
display: none;
|
||||
}
|
||||
.enhanced th.essential,
|
||||
.enhanced td.essential {
|
||||
display: table-cell;
|
||||
}
|
||||
@media screen and (min-width: 500px) {
|
||||
.enhanced th.optional,
|
||||
.enhanced td.optional {
|
||||
display: table-cell;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (min-width: 800px) {
|
||||
.enhanced th,
|
||||
.enhanced td {
|
||||
display: table-cell;
|
||||
}
|
||||
}
|
||||
.table-menu-wrapper {
|
||||
position: absolute;
|
||||
top: -3em;
|
||||
right: 0;
|
||||
}
|
||||
.table-menu {
|
||||
position: absolute;
|
||||
right: 0;
|
||||
left: auto;
|
||||
background-color: #fff;
|
||||
padding: 10px;
|
||||
border: 1px solid #ccc;
|
||||
font-size: 1.2em;
|
||||
width: 12em;
|
||||
}
|
||||
.table-menu-hidden {
|
||||
left: -999em;
|
||||
right: auto;
|
||||
}
|
||||
.table-wrapper {
|
||||
position: relative;
|
||||
margin: 5em 5%;
|
||||
}
|
||||
table.stat th, table.stat td {
|
||||
font-size : 77%;
|
||||
font-family : "Myriad Web",Verdana,Helvetica,Arial,sans-serif;
|
||||
width: 100%;
|
||||
|
||||
}
|
||||
.hidden { display: none }
|
||||
|
||||
form {
|
||||
width:100%;
|
||||
display: inline-block;
|
||||
text-align: center;
|
||||
margin:0px auto;
|
||||
background-color: grey;
|
||||
border:0px solid #dbdbdb;
|
||||
}
|
||||
.search {
|
||||
padding:8px 15px;
|
||||
background:rgba(50, 50, 50, 0.2);
|
||||
border:0px solid #dbdbdb;
|
||||
}
|
||||
.button {
|
||||
position:relative;
|
||||
padding:6px 15px;
|
||||
left:-8px;
|
||||
border:2px solid #207cca;
|
||||
background-color:#207cca;
|
||||
color:#fafafa;
|
||||
}
|
||||
.button:hover {
|
||||
background-color:#fafafa;
|
||||
color:#207cca;
|
||||
}
|
||||
167
OLD/searchtables/test.php
Normal file
167
OLD/searchtables/test.php
Normal file
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
mysql_connect("192.168.0.14", "corey", "41945549") or die("Error connecting to database: ".mysql_error());
|
||||
|
||||
mysql_select_db("controls") or die(mysql_error());
|
||||
|
||||
?>
|
||||
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<head>
|
||||
<title>Search results</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<link rel="stylesheet" type="text/css" href="style.css"/>
|
||||
|
||||
|
||||
</head>
|
||||
<body>
|
||||
<table style="margin: 0px auto;" class="stat">
|
||||
<tr>
|
||||
<th><a href="index.php">RESET SEARCH</a></th>
|
||||
<th><a href="../overview.php">BACK TO OVERVIEW</a></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2">Search Results</th>
|
||||
</tr>
|
||||
<!--
|
||||
<tr>
|
||||
<th><a href="edit" id="edit">Toggle Columns On/Off</a></th>
|
||||
</tr>
|
||||
-->
|
||||
</table>
|
||||
<table id="table" style="margin: 0px auto;" class="stat">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Timestamp</th>
|
||||
<th>PPH/Ton</th>
|
||||
<th>Prev Tons</th>
|
||||
<th>Prev Run</th>
|
||||
<th>MCC Spd</th>
|
||||
<th>K1 Spd</th>
|
||||
<th>K2 Spd</th>
|
||||
<th>K3 Spd</th>
|
||||
<th>M1 Spd</th>
|
||||
<th>M2 Spd</th>
|
||||
<th>M3 Spd</th>
|
||||
<th>M4 Spd</th>
|
||||
<th>M5 Spd</th>
|
||||
<th>M6 Spd</th>
|
||||
<th>M1 Lvl</th>
|
||||
<th>M2 Lvl</th>
|
||||
<th>M3 Lvl</th>
|
||||
<th>M4 Lvl</th>
|
||||
<th>M5 Lvl</th>
|
||||
<th>M6 Lvl</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$query = $_GET['query'];
|
||||
// gets value sent over search form
|
||||
|
||||
$min_length = 3;
|
||||
// you can set minimum length of the query if you want
|
||||
|
||||
if(strlen($query) >= $min_length){ // if query length is more or equal minimum length then
|
||||
|
||||
$query = htmlspecialchars($query);
|
||||
// changes characters used in html to their equivalents, for example: < to >
|
||||
|
||||
$query = mysql_real_escape_string($query);
|
||||
// makes sure nobody uses SQL injection
|
||||
|
||||
$raw_results = mysql_query("SELECT * FROM milling
|
||||
WHERE (`Z_TIMESTAMP` LIKE '%".$query."%')") or die(mysql_error());
|
||||
|
||||
// * means that it selects all fields, you can also write: `id`, `title`, `text`
|
||||
// articles is the name of our table
|
||||
|
||||
// '%$query%' is what we're looking for, % means anything, for example if $query is Hello
|
||||
// it will match "hello", "Hello man", "gogohello", if you want exact match use `title`='$query'
|
||||
// or if you want to match just full word so "gogohello" is out use '% $query %' ...OR ... '$query %' ... OR ... '% $query'
|
||||
|
||||
if(mysql_num_rows($raw_results) > 0){ // if one or more resultss are returned do following
|
||||
|
||||
|
||||
|
||||
while($results = mysql_fetch_array($raw_results)){
|
||||
// $results = mysql_fetch_array($raw_results) puts data from database into array, while it's valid it does the loop
|
||||
|
||||
|
||||
echo "<tr>";
|
||||
echo "<td>".$results [ 'Z_TIMESTAMP' ]."</td>";
|
||||
echo "<td>".$results [ 'LBSPERHR' ]."</td>";
|
||||
echo "<td>".$results [ 'PREVTONS' ]."</td>";
|
||||
echo "<td>".$results [ 'PREVTIME' ]."</td>";
|
||||
echo "<td>".$results [ 'MAINSPD' ]."</td>";
|
||||
echo "<td>".$results [ 'KNIFE1SPD' ]."</td>";
|
||||
echo "<td>".$results [ 'KNIFE2SPD' ]."</td>";
|
||||
echo "<td>".$results [ 'KNIFE3SPD' ]."</td>";
|
||||
echo "<td>".$results [ 'MILL1SPD' ]."</td>";
|
||||
echo "<td>".$results [ 'MILL2SPD' ]."</td>";
|
||||
echo "<td>".$results [ 'MILL3SPD' ]."</td>";
|
||||
echo "<td>".$results [ 'MILL4SPD' ]."</td>";
|
||||
echo "<td>".$results [ 'MILL5SPD' ]."</td>";
|
||||
echo "<td>".$results [ 'MILL6SPD' ]."</td>";
|
||||
echo "<td>".$results [ 'MILL1LVL' ]."</td>";
|
||||
echo "<td>".$results [ 'MILL2LVL' ]."</td>";
|
||||
echo "<td>".$results [ 'MILL3LVL' ]."</td>";
|
||||
echo "<td>".$results [ 'MILL4LVL' ]."</td>";
|
||||
echo "<td>".$results [ 'MILL5LVL' ]."</td>";
|
||||
echo "<td>".$results [ 'MILL6LVL' ]."</td>";
|
||||
echo "</tr>";
|
||||
// posts results gotten from database(title and text) you can also show id ($results['id'])
|
||||
}
|
||||
|
||||
}
|
||||
else{ // if there is no matching resultss do following
|
||||
echo "No results";
|
||||
}
|
||||
|
||||
}
|
||||
else{ // if query length is less than minimum
|
||||
echo "Minimum length is ".$min_length;
|
||||
}
|
||||
?>
|
||||
|
||||
</body>
|
||||
<script type="text/javascript">
|
||||
$('#edit').click(function() {
|
||||
var headers = $('#table th').map(function() {
|
||||
var th = $(this);
|
||||
return {
|
||||
text: th.text(),
|
||||
shown: th.css('display') != 'none'
|
||||
};
|
||||
});
|
||||
|
||||
var h = ['<div id=tableEditor><button id=done>Done</button><table><thead>'];
|
||||
$.each(headers, function() {
|
||||
h.push('<tr><th><input type=checkbox',
|
||||
(this.shown ? ' checked ' : ' '),
|
||||
'/> ',
|
||||
this.text,
|
||||
'</th></tr>');
|
||||
});
|
||||
h.push('</thead></table></div>');
|
||||
$('body').append(h.join(''));
|
||||
|
||||
$('#done').click(function() {
|
||||
var showHeaders = $('#tableEditor input').map(function() { return this.checked; });
|
||||
$.each(showHeaders, function(i, show) {
|
||||
var cssIndex = i + 1;
|
||||
var tags = $('#table th:nth-child(' + cssIndex + '), #table td:nth-child(' + cssIndex + ')');
|
||||
if (show)
|
||||
tags.show();
|
||||
else
|
||||
tags.hide();
|
||||
});
|
||||
|
||||
$('#tableEditor').remove();
|
||||
return false;
|
||||
});
|
||||
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
</html>
|
||||
Reference in New Issue
Block a user