add all files

This commit is contained in:
Rucus
2026-02-17 09:29:34 -06:00
parent b8c8d67c67
commit 782d203799
21925 changed files with 2433086 additions and 0 deletions

Binary file not shown.

View File

@@ -0,0 +1,33 @@
<?php
function checkLogin($levels)
{
if(!$_SESSION['logged_in'])
{
$access = FALSE;
}
else {
$kt = split(' ', $levels);
$query = mysql_query('SELECT Level_access FROM users WHERE ID = "'.mysql_real_escape_string($_SESSION['user_id']).'"');
$row = mysql_fetch_assoc($query);
$access = FALSE;
while(list($key,$val)=each($kt))
{
if($val==$row['Level_access'])
{//if the user level matches one of the allowed levels
$access = TRUE;
}
}
}
if($access==FALSE)
{
header("Location: login.php");
}
else {
//do nothing: continue
}
}
?>

45
lasuca/inc/adminstuff.php Normal file
View File

@@ -0,0 +1,45 @@
<?php
if(isset($_POST['add']))
{
include 'inc/dbconfig.php';
include 'inc/opendb.php';
$username = $_POST['username'];
$password = $_POST['password'];
$query = "INSERT INTO tbl_auth_user (user_id, user_password) VALUES ('$username', PASSWORD('$password'))";
mysql_query($query) or die('Error, insert query failed');
$query = "FLUSH PRIVILEGES";
mysql_query($query) or die('Error, insert query failed');
include 'inc/closedb.php';
echo "The new grower has been added!";
}
else
{
?>
<form method="post">
<table width="400" border="0" cellspacing="1" cellpadding="2">
<u>Use the form below to add a new grower login.</u>
<tr>
<td width="100">Username</td>
<td><input name="username" type="text" id="username"></td>
</tr>
<tr>
<td width="100">Password</td>
<td><input name="password" type="text" id="password"></td>
</tr>
<tr>
<td width="100">&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td width="100">&nbsp;</td>
<td><input name="add" type="submit" id="add" value="Add New User"></td>
</tr>
</table>
</form>
<?php
}
?>

173
lasuca/inc/auth.php Normal file
View File

@@ -0,0 +1,173 @@
<?php
// phpcs:ignoreFile
/**
* Authentication helpers for grower accounts.
*/
function auth_find_member(string $username): ?array
{
global $conn;
$sql = 'SELECT username, growerid, password, password_hash, email, phone,
growername, last_login_at, password_last_changed
FROM members
WHERE username = ?
LIMIT 1';
$stmt = $conn->prepare($sql);
if ($stmt === false) {
return null;
}
$stmt->bind_param('s', $username);
$stmt->execute();
$result = $stmt->get_result();
$member = $result !== false ? $result->fetch_assoc() : null;
$stmt->close();
return $member ?: null;
}
function auth_verify_password(array $member, string $password): bool
{
if (!empty($member['password_hash'])) {
return password_verify($password, $member['password_hash']);
}
return hash_equals((string) $member['password'], $password);
}
function auth_upgrade_legacy_password(string $username, string $password): void
{
global $conn;
$hash = password_hash($password, PASSWORD_DEFAULT);
$sql = 'UPDATE members
SET password_hash = ?, password_last_changed = NOW()
WHERE username = ?
LIMIT 1';
$stmt = $conn->prepare($sql);
if ($stmt === false) {
return;
}
$stmt->bind_param('ss', $hash, $username);
$stmt->execute();
$stmt->close();
}
function auth_record_login(string $username): void
{
global $conn;
$sql = 'UPDATE members SET last_login_at = NOW() WHERE username = ? LIMIT 1';
$stmt = $conn->prepare($sql);
if ($stmt === false) {
return;
}
$stmt->bind_param('s', $username);
$stmt->execute();
$stmt->close();
}
function auth_attempt_login(string $username, string $password): ?array
{
$member = auth_find_member($username);
if ($member === null) {
return null;
}
if (!auth_verify_password($member, $password)) {
return null;
}
if (empty($member['password_hash'])) {
auth_upgrade_legacy_password($username, $password);
$member = auth_find_member($username) ?: $member;
}
auth_record_login($username);
return $member;
}
function auth_update_profile(string $username, ?string $email, ?string $growerName, ?string $phone): bool
{
global $conn;
$sql = "UPDATE members
SET email = NULLIF(?, ''), growername = NULLIF(?, ''), phone = NULLIF(?, ''), profile_updated_at = NOW()
WHERE username = ?
LIMIT 1";
$stmt = $conn->prepare($sql);
if ($stmt === false) {
return false;
}
$stmt->bind_param('ssss', $email, $growerName, $phone, $username);
$success = $stmt->execute();
$stmt->close();
return (bool) $success;
}
function auth_set_password(string $username, string $password): bool
{
global $conn;
$hash = password_hash($password, PASSWORD_DEFAULT);
$sql = 'UPDATE members
SET password_hash = ?, password = "", password_last_changed = NOW()
WHERE username = ?
LIMIT 1';
$stmt = $conn->prepare($sql);
if ($stmt === false) {
return false;
}
$stmt->bind_param('ss', $hash, $username);
$success = $stmt->execute();
$stmt->close();
return (bool) $success;
}
function auth_change_password(string $username, string $currentPassword, string $newPassword, string $confirmPassword): array
{
if ($newPassword === '' || $confirmPassword === '') {
return [false, 'Please enter and confirm the new password.'];
}
if ($newPassword !== $confirmPassword) {
return [false, 'New password and confirmation do not match.'];
}
if (strlen($newPassword) < 8) {
return [false, 'New password must be at least 8 characters long.'];
}
$member = auth_find_member($username);
if ($member === null || !auth_verify_password($member, $currentPassword)) {
return [false, 'Current password is incorrect.'];
}
if (!auth_set_password($username, $newPassword)) {
return [false, 'Unable to update the password. Please try again.'];
}
return [true, 'Password updated successfully.'];
}
?>

7
lasuca/inc/closedb.php Normal file
View File

@@ -0,0 +1,7 @@
<?php
// phpcs:ignoreFile
if (function_exists('mysql_close')) {
mysql_close($conn);
}
?>

31
lasuca/inc/confirm.php Normal file
View File

@@ -0,0 +1,31 @@
<?php
require_once('db.php');
include('functions.php');
$query = mysql_query("SELECT * FROM users WHERE ID = '".mysql_real_escape_string($_GET['ID'])."'");
if(mysql_num_rows($query)==1)
{
$row = mysql_fetch_assoc($query);
if($row['Temp_pass']==$_GET['new'] && $row['Temp_pass_active']==1)
{
$update = mysql_query("UPDATE users SET Password = '".md5(mysql_real_escape_string($_GET['new']))."', Temp_pass_active=0 WHERE ID = '".mysql_real_escape_string($_GET['ID'])."'");
$msg = 'Your new password has been confirmed. You may login using it.';
}
else
{
$error = 'The new password is already confirmed or is incorrect';
}
}
else {
$error = 'You are trying to confirm a new password for an unexisting member';
}
if(isset($error))
{
echo $error;
}
else {
echo $msg;
}
?>

8
lasuca/inc/dbconfig.php Normal file
View File

@@ -0,0 +1,8 @@
<?php
// phpcs:ignoreFile
$dbhost = '192.168.0.10';
$dbuser = 'scdb';
$dbpass = 'lasucasugar';
$dbname = 'scdb';
?>

6
lasuca/inc/dbinfo.php Normal file
View File

@@ -0,0 +1,6 @@
<?php
$host="192.168.0.10";
$username="corey";
$password="41945549";
$database="controls";
?>

View File

@@ -0,0 +1,51 @@
<?PHP
//dirLISt v 0.1.1 configuration file
//= = = = = = = = = = = = = = = = = = = = = = = = = =
//U S E R C O N F I G U R A T I O N
//= = = = = = = = = = = = = = = = = = = = = = = = = =
//Listing mode. 0:HTTP directory Listing 1:FTP directory listing
$listing_mode = 0;
//FTP credentials
$ftp_host = '';
$ftp_username = '';
$ftp_password = '';
//Directory to browse ***INCLUDING TRAILING SLASH***. Leave it as "./" if you want to browse the directory this file is in fot HTTP listing or leave it blank for browsing the root directory for FTP listing.
$dir_to_browse = "./"; //default[HTTP] = "./" or default[FTP] = ""
//Files and/or folders to exclude from listing. This main file (lister) is automatically excluded.
$exclude = array('.','..','.ftpquota','.htaccess', 'dirLIST_files');
//Files to exclude based on extension (eg: '.jpg' or '.PHP') and weather to be case sensative. 1:Enable 0:Disable
$exclude_ext = array('.php');
$case_sensative_ext = 0; //default = 1
//Statistics/legend/load time. 1:Enable 0:Disable
$statistics = 0; //default = 1
$legend = 0; //default = 1
$load_time = 0; //default = 1
//Show folder size? Disabling this will greatly improve performance if there are several hundred folders/files. However, size of folders wont show. Also note that if the listing mode is FTP, enabling folder size will very likeyly cause a script timeout. 1:Enable 0:Disable
$show_folder_size_http = 1; //default = 1
$show_folder_size_ftp = 0; //default = 0
//Alternating row colors. EG: "#CCCCCC"
$color_1 = "#66CC33"; //default = #E8F8FF
$color_2 = "#99CC33"; //default = #66CC33
$folder_color = "#CCCCCC"; //default = #CCCCCC
//Table formatting
$top_row_bg_color = "#669966"; // default = #006699
$top_row_font_color = "#FFFFFF"; //default = #FFFFFF
$width_of_files_column = "450"; //value in pixles. default = 450
$width_of_sizes_column = "100"; //value in pixles. default = 100
$width_of_dates_column = "100"; //value in pixles. default = 100
$cell_spacing = "3"; //value in pixles. default = 5
$cell_padding = "2"; //value in pixles. default = 5
//= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
//U S E R C O N F I G U R A T I O N - D O N E
//= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
?>

View File

@@ -0,0 +1,99 @@
<?PHP
// phpcs:ignoreFile
//dirLIST v 0.1.1 functions file
function get_dir_content($path)
{
$content = array();
$dh = opendir($path);
while (false !== ($item = readdir($dh)))
{
array_push($content, $item);
}
return $content;
}
function folder_size($path)
{
global $listing_mode;
$total_size = 0;
if($listing_mode == 0) //HTTP
{
//determine operating system PHP is running on
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN')
{
$content = get_dir_content($path);
//remove . and ..
array_shift($content);
array_shift($content);
foreach($content as $key => $val)
{
$content_path = $path."/".$val;
if(is_dir($content_path))
{
$total_size += folder_size($content_path."/");
}
else
{
$total_size += filesize($content_path);
}
}
return ($total_size);
}
else
{
$folder_size = `du -s $path`;
$size_array = explode("\t", $folder_size);
return $size_array[0]*1024;
}
}
elseif($listing_mode == 1) //FTP
{
global $ftp_stream;
$dir_content = ftp_rawlist($ftp_stream, $path);
$ignore = array(".", "..");
foreach($dir_content as $key => $val)
{
$current = parse_rawurl($val);
if(substr($current[0], 0, 1) == "d" and !in_array($current[8], $ignore))
{
$dir_size = folder_size($path."/".$current[8]);
$total_size += $dir_size;
}
else
{
$total_size += $current[4];
}
}
return ($total_size);
}
}
function parse_rawurl($val)
{
$current = preg_split("/[\s]+/",$val,9);
return $current;
}
function letter_size($byte_size)
{
$file_size = $byte_size/1024;
if($file_size >= 1048576)
$file_size = sprintf("%01.2f", $file_size/1048576)." GB";
elseif ($file_size >= 1024)
$file_size = sprintf("%01.2f", $file_size/1024)." MB";
else
$file_size = sprintf("%01.1f", $file_size)." KB";
return $file_size;
}
function display_error_message($message)
{
return "
<table width=\"100%\" cellpadding=\"5\" cellspacing=\"1\" class=\"table_border\">
<tr><td bgcolor=\"#FFBBBD\">$message</td></tr>
</table>";
}
?>

View File

@@ -0,0 +1,54 @@
<?php
/**
* Calculates the 15-minute average for east and west total ground values.
* Requires dbinfo.php for database credentials.
*/
require 'dbinfo.php';
$con = mysqli_connect($host, $username, $password, $database);
if (! $con) {
echo '0';
return;
}
$query = "SELECT
(
(
(SELECT easttotground FROM easttotalground ORDER BY id DESC LIMIT 1) -
(SELECT easttotground FROM easttotalground ORDER BY id DESC LIMIT 899, 1)
) * 4
) AS eastavg,
(
(
(SELECT westtotground FROM westtotalground ORDER BY id DESC LIMIT 1) -
(SELECT westtotground FROM westtotalground ORDER BY id DESC LIMIT 899, 1)
) * 4
) AS westavg,
(
(
(SELECT easttotground FROM easttotalground ORDER BY id DESC LIMIT 1) -
(SELECT easttotground FROM easttotalground ORDER BY id DESC LIMIT 899, 1)
) * 4
+
(
(SELECT westtotground FROM westtotalground ORDER BY id DESC LIMIT 1) -
(SELECT westtotground FROM westtotalground ORDER BY id DESC LIMIT 899, 1)
) * 4
) AS totalavg";
$result = mysqli_query($con, $query);
$include4 = ($result !== false)
? mysqli_fetch_array($result, MYSQLI_ASSOC)
: null;
mysqli_close($con);
$eastAverage = is_array($include4) && isset($include4['totalavg'])
? $include4['totalavg']
: 0;
echo round($eastAverage);
?>

View File

@@ -0,0 +1,49 @@
<?php
// mysql connection script ...
$dbhost = 'localhost';
$dbuser = 'admin';
$dbpass = 't#23iavs#';
$conn = mysql_connect($dbhost, $dbuser, $dbpass) or die ('Error connecting to mysql');
$dbname = 'scdb';
mysql_select_db($dbname);
// tab delimited file
$file = "Lab Worksheet.xls";
// open file
$handle = fopen($file, "r");
$x = 0;
echo "<table border=1>";
// loop through results with fgetcsv() function
while(($data = fgetcsv($handle, 1000, "\t")) !== FALSE) {
// populate field vars just to make it easier to work with ..
// you could access the $data[] array directly in the sql if you want
$field1 = $data[0];
$field2 = $data[1];
$field3 = $data[2];
$field4 = $data[2];
// etc ...
// build your sql statement
$sql = "insert into table set
testid='1',
category='foo',
field1='".$field1."',
field2='".$field2."',
field3='".$field3."'";
//if($x >0) $result = mysql_query($sql);
if($x >0) echo "<tr><td>$field1</td><td>$field2</td><td>$field3</td></tr>";
$x++;
}
echo "</table>";
// close file
fclose($handle);
?>

View File

@@ -0,0 +1,49 @@
<?php
require_once('db.php');
include('functions.php');
if(isset($_POST['Submit']))
{
if($_POST['email']!='' && valid_email($_POST['email'])==TRUE)
{
$getUser = mysql_query('SELECT ID, Username, Temp_pass, Email FROM users WHERE Email = "'.mysql_real_escape_string($_POST['email']).'"');
if(mysql_num_rows($getUser)==1)
{
$temp_pass = random_string('alnum', 12);
$row = mysql_fetch_assoc($getUser);
$query = mysql_query("UPDATE users SET Temp_pass='".$temp_pass."', Temp_pass_active=1 WHERE `Email`='".mysql_real_escape_string($row['Email'])."'");
$headers = 'From: webmaster@ourdomainhere.com' . "\r\n" .
'Reply-To: webmaster@ourdomainhere.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$subject = "Password Reset Request";
$message = "Dear ".$row['Username'].", Someone (presumably you), has requested a password reset. We have generated a new password for you to access our website: $temp_pass . To confirm this change and activate your new password please follow this link to our website: http://www.ourdomainhere.com/confirm_password.php?ID=".$row['ID']."&new=".$temp_pass.". Don't forget to update your profile as well after confirming this change and create a new password. If you did not initiate this request, simply disregard this email, and we're sorry for bothering you.";
if(mail($row['Email'], $subject, $message, $headers))
{
$msg = 'Password reset request sent. Please check your email for instructions.';
}
else {
$error = 'Failed sending email';
}
}
else {
$error = 'There is no member to match your email.';
}
}
else {
$error = 'Invalid email !';
}
}
?>
<?php if(isset($error)){ echo $error;}?>
<?php if(isset($msg)){ echo $msg;} else {//if we have a mesage we don't need this form again.?>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
<input type="text" id="email" name="email" size="32" value="" />
<input type="submit" name="Submit" value="Submit" />
</form>
<? } ?>

View File

@@ -0,0 +1,12 @@
<?php
// phpcs:ignoreFile
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
if (empty($_SESSION['myusername'])) {
header('Location: grower-login.php');
exit();
}
?>

View File

@@ -0,0 +1,60 @@
<?php
// phpcs:ignoreFile
require_once __DIR__ . '/grower-session.php';
require_once __DIR__ . '/inc/dbconfig.php';
require_once __DIR__ . '/inc/opendb.php';
require_once __DIR__ . '/inc/auth.php';
require_once __DIR__ . '/inc/grower_helpers.php';
$username = isset($_SESSION['myusername']) ? $_SESSION['myusername'] : '';
$growerId = isset($_SESSION['growerid']) ? $_SESSION['growerid'] : '';
$member = $username !== '' ? auth_find_member($username) : null;
$memberData = grower_member_defaults($member);
$recentFiles = grower_recent_files($username, 6);
require_once __DIR__ . '/inc/closedb.php';
?>
<div class="grower-dashboard-intro">
<h2>Welcome back, <?php echo htmlspecialchars($username, ENT_QUOTES, 'UTF-8'); ?></h2>
<div class="grower-dashboard-actions">
<a class="dashboard-button" href="/grower-account.php">Manage Account</a>
<a class="dashboard-button" href="/growers/<?php echo rawurlencode($username); ?>/loads.php">Load Data</a>
<a class="dashboard-button" href="/grower-files.php">File Browser</a>
</div>
</div>
<div class="grower-dashboard-cards">
<div class="grower-card">
<h3>Your Details</h3>
<dl class="grower-summary-grid">
<dt>Grower ID</dt>
<dd><?php echo htmlspecialchars((string) $growerId, ENT_QUOTES, 'UTF-8'); ?></dd>
<dt>Last Login</dt>
<dd><?php echo htmlspecialchars(grower_format_datetime($memberData['last_login_at']), ENT_QUOTES, 'UTF-8'); ?></dd>
<dt>Password Changed</dt>
<dd><?php echo htmlspecialchars(grower_format_datetime($memberData['password_last_changed']), ENT_QUOTES, 'UTF-8'); ?></dd>
<dt>Contact Email</dt>
<dd><?php echo $memberData['email'] !== '' ? htmlspecialchars($memberData['email'], ENT_QUOTES, 'UTF-8') : 'Not on file'; ?></dd>
<dt>Phone</dt>
<dd><?php echo $memberData['phone'] !== '' ? htmlspecialchars($memberData['phone'], ENT_QUOTES, 'UTF-8') : 'Not on file'; ?></dd>
</dl>
<p style="margin-top: 12px;"><a href="/grower-account.php">Update contact details</a></p>
</div>
<div class="grower-card">
<h3>Recent Files</h3>
<?php if (!empty($recentFiles)): ?>
<ul class="recent-activity-list">
<?php foreach ($recentFiles as $file): ?>
<li>
<a href="<?php echo htmlspecialchars($file['path'], ENT_QUOTES, 'UTF-8'); ?>" target="_blank"><?php echo htmlspecialchars($file['name'], ENT_QUOTES, 'UTF-8'); ?></a>
<span class="activity-date"><?php echo htmlspecialchars(grower_format_datetime(date('Y-m-d H:i:s', $file['modified'])), ENT_QUOTES, 'UTF-8'); ?></span>
</li>
<?php endforeach; ?>
</ul>
<?php else: ?>
<p class="recent-activity-empty">We haven't spotted any files in your folder yet.</p>
<?php endif; ?>
<p style="margin-top: 12px;"><a href="/grower-files.php">Browse all files</a></p>
</div>
</div>

View File

@@ -0,0 +1,119 @@
<?php
// phpcs:ignoreFile
function grower_format_datetime($value)
{
if ($value === null || $value === '' || $value === '0000-00-00 00:00:00') {
return 'Never';
}
$timestamp = strtotime((string) $value);
if ($timestamp === false) {
return (string) $value;
}
return date('F j, Y g:i A', $timestamp);
}
function grower_member_defaults($member)
{
$defaults = array(
'email' => '',
'phone' => '',
'growername' => '',
'last_login_at' => '',
'password_last_changed' => ''
);
if (!is_array($member)) {
return $defaults;
}
return array_merge($defaults, $member);
}
function grower_recent_files($username, $limit = 6)
{
if ($username === '') {
return array();
}
$rootDir = dirname(__DIR__);
$baseDir = $rootDir . '/growers/' . $username;
if (!is_dir($baseDir)) {
return array();
}
$files = array();
$directoryIterator = new RecursiveDirectoryIterator($baseDir, FilesystemIterator::SKIP_DOTS);
$iterator = new RecursiveIteratorIterator($directoryIterator, RecursiveIteratorIterator::LEAVES_ONLY);
foreach ($iterator as $fileInfo) {
if (!$fileInfo->isFile()) {
continue;
}
$basename = $fileInfo->getBasename();
$extension = strtolower($fileInfo->getExtension());
if ($extension !== 'pdf') {
continue;
}
if (strtolower($basename) === 'index.php') {
continue;
}
$pathName = $fileInfo->getPathname();
$relative = substr($pathName, strlen($rootDir));
$files[] = array(
'name' => $basename,
'path' => '/' . ltrim(str_replace(DIRECTORY_SEPARATOR, '/', $relative), '/'),
'modified' => $fileInfo->getMTime()
);
}
if (empty($files)) {
return array();
}
usort($files, function ($a, $b) {
if ($a['modified'] === $b['modified']) {
return strcmp($a['path'], $b['path']);
}
return ($a['modified'] > $b['modified']) ? -1 : 1;
});
if ($limit > 0 && count($files) > $limit) {
$files = array_slice($files, 0, $limit);
}
return $files;
}
function grower_format_filesize($bytes)
{
if (!is_numeric($bytes) || $bytes < 0) {
return '0 B';
}
$units = array('B', 'KB', 'MB', 'GB', 'TB', 'PB');
$value = (float) $bytes;
$power = 0;
while ($value >= 1024 && $power < count($units) - 1) {
$value /= 1024;
$power++;
}
if ($power === 0) {
return number_format($value, 0) . ' ' . $units[$power];
}
return number_format($value, 2) . ' ' . $units[$power];
}

17
lasuca/inc/infomenu.php Normal file
View File

@@ -0,0 +1,17 @@
<ul id="nav2">
<li><a href="millinfo.php?p=handling">Cane Handling</a></li>
<li><a href="millinfo.php?p=mills">Milling Equipment</a></li>
<li><a href="millinfo.php?p=steam">Steam Plant</a></li>
<li><a href="millinfo.php?p=storage">Bagasse Storage</a></li>
<li><a href="millinfo.php?p=clarification">Clarification</a>
<li><a href="millinfo.php?p=evaporation">Evaporation</a></li>
<li><a href="millinfo.php?p=vacuum">Vacuum and Condensing</a></li>
<li><a href="millinfo.php?p=supplytanks">Pan Supply Tanks</a></li>
<li><a href="millinfo.php?p=crystalizers">Crystallizers</a></li>
<li><a href="millinfo.php?p=centrifugals">Centrifugals</a>
<li><a href="millinfo.php?p=finalstorage">Final Storage</a></li>
<li><a href="millinfo.php?p=misc">Miscellaneous</a></li>
<li><a href="millinfo.php?p=videos">LASUCA Videos</a></li>
</ul>

17
lasuca/inc/items.php Normal file
View File

@@ -0,0 +1,17 @@
<?php
$con=mysqli_connect('192.168.0.10', 'corey', '41945549', 'controls');
$query="SELECT ID, Name, ROUND(Value, 0) AS Value, ROUND(Value, 1) AS RoundedValue1, ROUND(Value, 2) AS RoundedValue, Timestamp FROM items ORDER BY ID ASC";
$result=mysqli_query($con, $query);
mysqli_close($con);
while ($row=mysqli_fetch_array($result, MYSQLI_ASSOC)) {
$value[$row['Name']] = $row['Value'];
$rounded[$row['Name']] = $row['RoundedValue'];
$time[$row['Name']] = $row['Timestamp'];
$ID[$row['ID']] = $row['Value'];
$roundedid[$row['ID']] = $row['RoundedValue'];
$rounded1[$row['ID']] = $row['RoundedValue1'];
$rounded1[$row['Name']] = $row['RoundedValue1'];
}
?>

29
lasuca/inc/loginpage.php Normal file
View File

@@ -0,0 +1,29 @@
<table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<tr>
<form name="form1" method="post" action="">
<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="3"><strong>Member Login </strong></td>
</tr>
<tr>
<td width="78">Grower ID</td>
<td width="6">:</td>
<td width="294"><input name="myusername" type="text" id="myusername"></td>
</tr>
<tr>
<td>Password</td>
<td>:</td>
<td><input name="mypassword" type="password" id="mypassword"></td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td><input type="submit" name="Submit" value="Login"></td>
</tr>
</table>
</td>
</form>
</tr>
</table>

7
lasuca/inc/menu.php Normal file
View File

@@ -0,0 +1,7 @@
<ul id="nav">
<li><a href="index.php">Home</a></li>
<li><a href="millinfo.php?p=handling">Factory Information</a></li>
<li><a href="production.php">Production</a></li>
<li><a href="login.php">Grower Login</a></li>
<li><a href="contact.php">Contact &amp; Personnel</a></li>
</ul>

7
lasuca/inc/menu2.php Normal file
View File

@@ -0,0 +1,7 @@
<ul id="nav">
<li><a href="index.php">Home</a></li>
<li><a href="millinfo.php?p=handling">Factory Information</a></li>
<li><a href="production.php">Production</a></li>
<li><a href="../../logout.php">Grower Logout</a></li>
<li><a href="contact.php">Contact &amp; Personnel</a></li>
</ul>

7
lasuca/inc/menu3.php Normal file
View File

@@ -0,0 +1,7 @@
<ul id="nav">
<li><a href="../../index.php">Home</a></li>
<li><a href="../../millinfo.php?p=handling">Factory Information</a></li>
<li><a href="../../production.php">Production</a></li>
<li><a href="../../logout.php">Grower Logout</a></li>
<li><a href="../../contact.php">Contact &amp; Personnel</a></li>
</ul>

5
lasuca/inc/news.php Normal file
View File

@@ -0,0 +1,5 @@
The quota for Thursday, October 4 2012 is 75%

156
lasuca/inc/opendb.php Normal file
View File

@@ -0,0 +1,156 @@
<?php
// phpcs:ignoreFile
$conn = new mysqli($dbhost, $dbuser, $dbpass, $dbname);
if ($conn->connect_errno) {
die('Error connecting to MySQL: ' . $conn->connect_error);
}
$conn->set_charset('utf8mb4');
if (!defined('MYSQL_ASSOC')) {
define('MYSQL_ASSOC', MYSQLI_ASSOC);
}
if (!defined('MYSQL_NUM')) {
define('MYSQL_NUM', MYSQLI_NUM);
}
if (!defined('MYSQL_BOTH')) {
define('MYSQL_BOTH', MYSQLI_BOTH);
}
if (!function_exists('mysql_query')) {
function mysql_query($query)
{
global $conn;
return mysqli_query($conn, $query);
}
}
if (!function_exists('mysql_fetch_assoc')) {
function mysql_fetch_assoc($result)
{
return mysqli_fetch_assoc($result);
}
}
if (!function_exists('mysql_fetch_array')) {
function mysql_fetch_array($result, $result_type = MYSQL_BOTH)
{
return mysqli_fetch_array($result, $result_type);
}
}
if (!function_exists('mysql_fetch_row')) {
function mysql_fetch_row($result)
{
return mysqli_fetch_row($result);
}
}
if (!function_exists('mysql_fetch_object')) {
function mysql_fetch_object($result)
{
return mysqli_fetch_object($result);
}
}
if (!function_exists('mysql_num_rows')) {
function mysql_num_rows($result)
{
return mysqli_num_rows($result);
}
}
if (!function_exists('mysql_numrows')) {
function mysql_numrows($result)
{
return mysql_num_rows($result);
}
}
if (!function_exists('mysql_real_escape_string')) {
function mysql_real_escape_string($string)
{
global $conn;
return mysqli_real_escape_string($conn, $string);
}
}
if (!function_exists('mysql_insert_id')) {
function mysql_insert_id()
{
global $conn;
return mysqli_insert_id($conn);
}
}
if (!function_exists('mysql_error')) {
function mysql_error()
{
global $conn;
return mysqli_error($conn);
}
}
if (!function_exists('mysql_affected_rows')) {
function mysql_affected_rows()
{
global $conn;
return mysqli_affected_rows($conn);
}
}
if (!function_exists('mysql_data_seek')) {
function mysql_data_seek($result, $row_number)
{
return mysqli_data_seek($result, $row_number);
}
}
if (!function_exists('mysql_result')) {
function mysql_result($result, $row, $column = 0)
{
if (!mysqli_data_seek($result, $row)) {
return null;
}
$data = mysqli_fetch_array($result, MYSQL_BOTH);
if ($data === null) {
return null;
}
return $data[$column] ?? null;
}
}
if (!function_exists('mysql_free_result')) {
function mysql_free_result($result)
{
return mysqli_free_result($result);
}
}
if (!function_exists('mysql_close')) {
function mysql_close($connection = null)
{
global $conn;
$link = $connection ?: $conn;
if ($link instanceof mysqli) {
return mysqli_close($link);
}
return false;
}
}
?>

137
lasuca/inc/original.php Normal file
View File

@@ -0,0 +1,137 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Industry</title>
<link rel="stylesheet" type="text/css" href="style/industry.css" />
<meta http-equiv="Content-type" content="text/html; charset=UTF-8" />
</head>
<body>
<?php include("inc/menu.php"); ?>
<div id="main">
<a name="top" class="nodisplay"></a>
<div id="header_<?php echo(rand(2,6)); ?>"> </div>
<div id="header">
<div class="gear"> </div>
<h1 class="shad"><em>LASUCA</em></h1>
<h1><em>LASUCA</em></h1>
</div>
<div id="body">
<div id="sidebar">
<h3>Recent Photos</h3>
<a href="#" class="flickr-thumbnail">
<img src="http://images.google.com/images?q=tbn:jmuZz1c1ton1GM:http://home.earthlink.net/~mountfuturama/smFryWallpaper1.jpg" alt="" width="70" height="55" />
</a>
<a href="#" class="flickr-thumbnail">
<img src="http://images.google.com/images?q=tbn:Mb4nSTF51ebxaM:http://www.mathsci.appstate.edu/~sjg/futurama/stringtheory.jpg" alt="" width="70" height="55" />
</a>
<a href="#" class="flickr-thumbnail">
<img src="http://images.google.com/images?q=tbn:nHvOr_XTjxErFM:http://www.nyder.com/cthulhu/graphics/zoidberg.jpg" alt="" width="70" height="55" />
</a>
<a href="#" class="flickr-thumbnail">
<img src="http://images.google.com/images?q=tbn:s8lm4bLUmUz9sM:http://www.englisch.schule.de/wiesmoor/hermes.jpg" alt="" width="70" height="55" />
</a>
<div style="clear: both;"> </div>
<h3>Healthy Links</h3>
<ul>
<li><a href="http://www.oswd.org">OSWD</a></li>
<li><a href="http://www.duckwizard.com">Duckwizard.com</a></li>
<li><a href="http://en.wikipedia.org/wiki/Futurama">Futurama on Wikipedia</a></li>
<li><a href="http://www.alistapart.com">A List Apart</a></li>
<li><a href="http://validator.w3.org/check/referer">Valid XHTML</a></li>
</ul>
<p style="margin-top: 80px">[1] This paragraph is taken from <a href="http://www.wikipedia.org">Wikipedia</a>'s entry on Futurama.</p>
<p style="margin-top: 160px"><strong>Did You Know?</strong> <br />Latin text such as this is often used as a typesetting aid. The text is meaningless, but seems to have been derived from Cicero's De finibus bonorum et malorum (On the Ends of Goods and Evils).</p>
<p style="margin-top: 300px; _margin-top: 380px">[2] Lorem ipsum dolor sit amet, consectetur cras magna ante. Nunc est bibendum.</p>
</div>
<div id="content">
<h2>Yet Another Fixed Layout</h2>
<div class="meta">
<span class="date">February 22, 3006</span>
<span class="postedBy">Posted by <a href="#">Phillip J. Fry</a></span>
</div>
<p>
Here's another centered, fixed layout. All my designs seem to be variations on this kind of structure; I
<a class="flickr-pullout right" href="#">
<img src="http://images.google.com/images?q=tbn:jmuZz1c1ton1GM:http://home.earthlink.net/~mountfuturama/smFryWallpaper1.jpg" alt="" />
</a>
promise I'll do something different next time. This one has a floaty nav bar on top for quick access to
links, as well as the top of the page. I can see some people being annoyed by this, so fortunately it's
easy to change so that it doesn't stay on top of the window. Just change the <code><span class="csskeyword">position</span>: <span class="cssvalue">fixed</span></code> to <code><span class="csskeyword">position</span>: <span class="cssvalue">absolute</span></code> and ditch the IE hack
(or you could change it to auto margins instead, if you want the header image to flow beneath it). One
thing that I included in this layout is a couple handy classes for your Flickr images. See the example
pullouts in the text as well as the thumbnails in the sidebar. In the interest of filling up space, I may
as well tell you that the sidebar has been done in kind of a funny way to make it vertically stretch over
the entire content div. This is impossible to do in a traditional way (including using 100% height in
CSS, which isn't defined the way it should be). Check it out; I thought I was pretty clever to think of
it! You could use the sidebar for annotations, footnotes, links, photos, or whatever you like.
</p>
<p>
Now I'll steal some text from Wikipedia<small class="super">1</small>! Futurama is an American animated television series created by
Matt Groening (creator of The Simpsons) and David X. Cohen (also a writer for The Simpsons). Set in "New
New York City" in the 31st century, it was introduced on the Fox Network and received airplay between
March 28, 1999 and August 10, 2003. It is currently in syndication on the Adult Swim segment of Cartoon
Network in the United States, on Teletoon in Canada, on Channel 4, Sky One and Sky Two in the UK, and on
Fox8 and Network Ten in Australia.
</p>
<div class="comments">
No comments | <a href="#">Leave a comment</a>
</div>
<h2>Good News, Everyone!</h2>
<div class="meta">
<span class="date">February 22, 3006</span>
<span class="postedBy">Posted by <a href="#">Hubert Farnsworth</a></span>
</div>
<p>
Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Vestibulum accumsan, justo non tristique laoreet,
odio nisi fringilla nibh, vitae blandit eros sapien ac mi. Etiam non nisl euismod massa fringilla sagittis.
<a class="flickr-pullout right" href="#"><img src="http://images.google.com/images?q=tbn:Mb4nSTF51ebxaM:http://www.mathsci.appstate.edu/~sjg/futurama/stringtheory.jpg" alt="Good news, everyone!" /></a>
Nunc vestibulum iaculis purus. Vivamus arcu urna, tristique eu, pharetra et, ullamcorper porta, nibh. Nulla
eget dolor sit amet purus aliquam lacinia. Cras eu quam. In id nisl et orci laoreet vulputate. Phasellus quis
est vel libero euismod mollis. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere
cubilia Curae; Cras magna ante, sodales eget, commodo ac, molestie ut, velit. Cras quis pede sit amet massa
feugiat imperdiet. Nulla dignissim. Curabitur eleifend, lorem quis dictum varius, elit nunc commodo enim,
iaculis mattis dui felis et urna.
</p>
<p>
Aliquam erat volutpat. Maecenas ut mi ut odio gravida tincidunt. Proin urna urna, dapibus sit amet, eleifend
quis, bibendum et, felis. Ut aliquet. Etiam diam erat, interdum ac, vehicula in, vulputate et, libero. Donec
ut dolor quis leo blandit lobortis. Vestibulum sed tellus. Donec vitae lectus. Lorem ipsum dolor sit amet,
consectetuer adipiscing elit. Nullam mollis aliquam nulla. Mauris pulvinar metus quis urna. Praesent eu turpis
aliquam est mollis aliquam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia
Curae; Vestibulum tempor nibh. Nam quis neque.
</p>
<div class="comments">
<a href="#">8 comments</a> | <a href="#">Leave a comment</a>
</div>
<h2>Surrender Your Mysteries to Zoidberg!</h2>
<p>
Quisque convallis tellus<small class="super">2</small>. Etiam aliquam lobortis erat. Donec gravida tortor a massa. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Cum sociis natoque penatibus et
<a href="#" class="flickr-pullout right">
<img src="http://images.google.com/images?q=tbn:nHvOr_XTjxErFM:http://www.nyder.com/cthulhu/graphics/zoidberg.jpg" alt="" />
</a>
magnis dis parturient montes, nascetur ridiculus mus. Aliquam arcu libero, congue in, iaculis sit amet, dapibus non, ligula. Aliquam erat volutpat. Fusce nisl ante, pretium ac, suscipit sed, feugiat a, sem. Donec sollicitudin leo eu nisl. Donec at dui a urna rhoncus viverra. Curabitur arcu. Quisque vulputate, purus ac ultricies consectetuer, justo neque suscipit nisi, eget tempor nulla nisl vitae tellus. Aenean eget erat. Vestibulum imperdiet viverra metus.
</p>
<p>
Nunc adipiscing hendrerit pede. Vestibulum tempor bibendum libero. Duis consectetuer felis laoreet nibh. Pellentesque lacus libero, sagittis ornare, tempor et, porta in, elit. Donec eu leo. Etiam erat. Sed aliquam odio quis risus. Aliquam arcu. Aenean elementum. Curabitur pellentesque ligula ac risus. Morbi sodales vehicula ipsum.
</p>
<div class="comments">
No comments | <a href="#">Leave a comment</a>
</div>
</div>
</div>
<div id="footer">
Copyright &copy; 2006, Your Name Here, Ltd.
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,50 @@
<?php
require_once('db.php');
include('functions.php');
if(isset($_POST['register']))
{
if($_POST['username']!='' && $_POST['password']!='' && $_POST['password']==$_POST['password_confirmed'] && $_POST['email']!='' && valid_email($_POST['email'])==TRUE && checkUnique('Username', $_POST['username'])==TRUE && checkUnique('Email', $_POST['email'])==TRUE)
{
$query = mysql_query("INSERT INTO users (`Username` , `Password`, `Email`, `Random_key`) VALUES ('".mysql_real_escape_string($_POST['username'])."', '".mysql_real_escape_string(md5($_POST['password']))."', '".mysql_real_escape_string($_POST['email'])."', '".random_string('alnum', 32)."')") or die(mysql_error());
$getUser = mysql_query("SELECT ID, Username, Email, Random_key FROM users WHERE Username = '".mysql_real_escape_string($_POST['username'])."'") or die(mysql_error());
if(mysql_num_rows($getUser)==1)
{//there's only one MATRIX :PP
$row = mysql_fetch_assoc($getUser);
$headers = 'From: webmaster@ourdomainhere.com' . "\r\n" .
'Reply-To: webmaster@ourdomainhere.com' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
$subject = "Activation email from ourdomainhere.com";
$message = "Dear ".$row['Username'].", this is your activation link to join our website. In order to confirm your membership please click on the following link: http://www.ourdomainhere.com/confirm.php?ID=".$row['ID']."&amp;key=".$row['Random_key']." Thank you for joining";
if(mail($row['Email'], $subject, $message, $headers))
{//we show the good guy only in one case and the bad one for the rest.
$msg = 'Account created. Please login to the email you provided during registration and confirm your membership.';
}
else {
$error = 'I created the account but failed sending the validation email out. Please inform my boss about this cancer of mine';
}
}
else {
$error = 'You just made possible the old guy (the impossible). Please inform my boss in order to give you the price for this.';
}
}
else {
$error = 'There was an error in your data. Please make sure you filled in all the required data, you provided a valid email address and that the password fields match';
}
}
?>
<?php if(isset($error)){ echo $error;}?>
<?php if(isset($msg)){ echo $msg;} else {//if we have a mesage we don't need this form again.?>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
Username: <input type="text" id="username" name="username" size="32" value="<?php if(isset($_POST['username'])){echo $_POST['username'];}?>" /><br />
Password: <input type="password" id="password" name="password" size="32" value="" /><br />
Re-password: <input type="password" id="password_confirmed" name="password_confirmed" size="32" value="" /><br />
Email: <input type="text" id="email" name="email" size="32" value="<?php if(isset($_POST['email'])){echo $_POST['email'];}?>" /><br />
<input type="submit" name="register" value="register" /><br />
</form>
<? } ?>

View File

@@ -0,0 +1,18 @@
<?php
include("dbinfo.php");
$con=mysqli_connect($host,$username,$password,$database);
$query = "SELECT(((SELECT easttotground FROM easttotalground ORDER BY id DESC LIMIT 1) - (SELECT easttotground FROM easttotalground ORDER BY id DESC LIMIT 29, 1))*120
+
((SELECT westtotground FROM westtotalground ORDER BY id DESC LIMIT 1) - (SELECT westtotground FROM westtotalground ORDER BY id DESC LIMIT 29, 1))*120)
AS stablerate";
$result=mysqli_query($con,$query);
$include4=mysqli_fetch_array($result,MYSQLI_ASSOC);
mysqli_close($con);
?>
<?php echo round($include4['stablerate']); ?>

View File

@@ -0,0 +1,26 @@
<?php
// phpcs:ignoreFile
$extraScripts = isset($extraScripts) ? (array) $extraScripts : array();
?>
<footer class="lasuca-footer">
<div class="container">
<div class="row g-3 align-items-center">
<div class="col-md-6">
<strong>Louisiana Sugar Cane Cooperative</strong><br />
6092 Resweber Hwy &middot; St. Martinville, LA 70582
</div>
<div class="col-md-6 text-md-end">
<small>&copy; <?php echo date('Y'); ?> LASUCA. All rights reserved.</small>
</div>
</div>
</div>
</footer>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/js/bootstrap.bundle.min.js"></script>
<?php foreach ($extraScripts as $scriptSrc) { ?>
<script src="<?php echo htmlspecialchars($scriptSrc, ENT_QUOTES, 'UTF-8'); ?>"></script>
<?php } ?>
<script src="/new/js/scripts.js"></script>
</body>
</html>

138
lasuca/inc/theme-header.php Normal file
View File

@@ -0,0 +1,138 @@
<?php
// phpcs:ignoreFile
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
$pageTitle = isset($pageTitle) && trim($pageTitle) !== ''
? $pageTitle
: 'Louisiana Sugar Cane Cooperative';
$metaDescription = isset($metaDescription) && trim($metaDescription) !== ''
? $metaDescription
: 'Louisiana Sugar Cane Cooperative produces raw cane sugar and molasses while supporting member growers across Louisiana.';
$bodyClassAttr = 'lasuca-theme';
if (isset($bodyClass) && trim($bodyClass) !== '') {
$bodyClassAttr .= ' ' . trim($bodyClass);
}
if (strpos($bodyClassAttr, 'theme-dark') === false && strpos($bodyClassAttr, 'theme-light') === false) {
$bodyClassAttr .= ' theme-dark';
}
$extraStyles = isset($extraStyles) ? (array) $extraStyles : array();
$activeNav = isset($activeNav) ? $activeNav : '';
$growerLoggedIn = !empty($_SESSION['myusername']);
$navItems = array(
array(
'key' => 'home',
'label' => 'Home',
'href' => '/home.php',
),
array(
'key' => 'factory',
'label' => 'Factory',
'href' => '/factory-information.php',
),
array(
'key' => 'production',
'label' => 'Production',
'href' => '/production.php',
),
array(
'key' => 'personnel',
'label' => 'Personnel',
'href' => '/personnel.php',
),
array(
'key' => 'contact',
'label' => 'Contact',
'href' => '/contact-us.php',
),
);
$loginItem = array(
'key' => 'login',
'label' => 'Login',
'href' => '/grower-login.php',
);
if ($growerLoggedIn) {
array_splice($navItems, 3, 0, array(
array(
'key' => 'grower',
'label' => 'Grower Portal',
'href' => '/grower-dashboard.php',
)
));
} else {
array_splice($navItems, 3, 0, array($loginItem));
}
if ($growerLoggedIn) {
$navItems[] = array(
'key' => 'logout',
'label' => 'Log Out',
'href' => '/grower-logout.php',
);
}
?>
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8" />
<title><?php echo htmlspecialchars($pageTitle, ENT_QUOTES, 'UTF-8'); ?></title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta
name="description"
content="<?php echo htmlspecialchars($metaDescription, ENT_QUOTES, 'UTF-8'); ?>"
/>
<link rel="icon" type="image/x-icon" href="/images/favicon.ico" />
<link
rel="stylesheet"
href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.3/dist/css/bootstrap.min.css"
/>
<link rel="stylesheet" href="/new/css/styles.css" />
<link rel="stylesheet" href="/new/css/lasuca-theme.css" />
<link rel="stylesheet" href="/new/css/pages.css" />
<?php foreach ($extraStyles as $styleHref) { ?>
<link rel="stylesheet" href="<?php echo htmlspecialchars($styleHref, ENT_QUOTES, 'UTF-8'); ?>" />
<?php } ?>
</head>
<body class="<?php echo htmlspecialchars($bodyClassAttr, ENT_QUOTES, 'UTF-8'); ?>">
<nav class="navbar navbar-expand-lg navbar-dark">
<div class="container">
<a class="navbar-brand" href="/">
<img src="/images/logo2.png" alt="LASUCA logo" />
<span class="brand-text">Producers of Raw Cane Sugar and Black Strap Molasses</span>
</a>
<button
class="navbar-toggler"
type="button"
data-bs-toggle="collapse"
data-bs-target="#mainNav"
aria-controls="mainNav"
aria-expanded="false"
aria-label="Toggle navigation"
>
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="mainNav">
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
<?php foreach ($navItems as $item) {
$isActive = $item['key'] === $activeNav;
?>
<li class="nav-item">
<a
class="nav-link<?php echo $isActive ? ' active' : ''; ?>"
href="<?php echo htmlspecialchars($item['href'], ENT_QUOTES, 'UTF-8'); ?>"
<?php if ($isActive) { ?> aria-current="page"
<?php } ?>
>
<?php echo htmlspecialchars($item['label'], ENT_QUOTES, 'UTF-8'); ?>
</a>
</li>
<?php } ?>
<?php include __DIR__ . '/theme-toggle.php'; ?>
</ul>
</div>
</div>
</nav>

View File

@@ -0,0 +1,9 @@
<?php
// phpcs:ignoreFile
?>
<li class="nav-item theme-toggle-item">
<button class="btn btn-sm btn-outline-light theme-toggle" type="button" data-theme-toggle aria-label="Switch to light mode">
<span class="theme-toggle-icon" data-theme-toggle-icon aria-hidden="true">🌙</span>
<span class="theme-toggle-label" data-theme-toggle-label>Light Mode</span>
</button>
</li>

35
lasuca/inc/tonsin.php Normal file
View File

@@ -0,0 +1,35 @@
<?php
$serverName = "CBM2K12\SQLEXPRESS";
$uid = "cbmclient";
$pwd = "ascbm2k";
$connectionInfo = array( "UID"=>$uid, "PWD"=>$pwd,'ReturnDatesAsStrings'=> true, "CharacterSet" => 'utf-8', "Database"=>"SugarCaneScale" );
/* Connect using SQL Server Authentication. */
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false )
{
echo "Unable to connect.</br>";
die( print_r( sqlsrv_errors(), true));
}
$sql = "SELECT ROUND (Tons,0) AS Tons FROM LoadData WHERE CropDay = ( SELECT Max(CropDay) FROM LoadData)";
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false) {
die( print_r( sqlsrv_errors(), true) );
}
$tonsin = 0;
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) )
{
$tonsin += $row['Tons'];
}
//end
?>
<?php echo $tonsin; ?>
<?
$db = null;
?>

36
lasuca/inc/tonsinprev.php Normal file
View File

@@ -0,0 +1,36 @@
<?php
$serverName = "CBM2K12\SQLEXPRESS";
$uid = "cbmclient";
$pwd = "ascbm2k";
$connectionInfo = array( "UID"=>$uid, "PWD"=>$pwd,'ReturnDatesAsStrings'=> true, "CharacterSet" => 'utf-8', "Database"=>"SugarCaneScale" );
/* Connect using SQL Server Authentication. */
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false )
{
echo "Unable to connect.</br>";
die( print_r( sqlsrv_errors(), true));
}
$sql = "SELECT ROUND (Tons,0) AS Tons FROM LoadData WHERE CropDay = ( SELECT Max(CropDay)-1 FROM LoadData)";
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false) {
die( print_r( sqlsrv_errors(), true) );
}
$tonsin = 0;
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) )
{
$tonsin += $row['Tons'];
}
//end
?>
<?php echo $tonsin; ?>
<?
$db = null;
?>

35
lasuca/inc/tonsintot.php Normal file
View File

@@ -0,0 +1,35 @@
<?php
$serverName = "CBM2K12\SQLEXPRESS";
$uid = "cbmclient";
$pwd = "ascbm2k";
$connectionInfo = array( "UID"=>$uid, "PWD"=>$pwd,'ReturnDatesAsStrings'=> true, "CharacterSet" => 'utf-8', "Database"=>"SugarCaneScale" );
/* Connect using SQL Server Authentication. */
$conn = sqlsrv_connect( $serverName, $connectionInfo);
if( $conn === false )
{
echo "Unable to connect.</br>";
die( print_r( sqlsrv_errors(), true));
}
$sql = "SELECT ROUND (Tons,0) AS Tons FROM LoadData ORDER BY DateIn DESC";
$stmt = sqlsrv_query( $conn, $sql );
if( $stmt === false) {
die( print_r( sqlsrv_errors(), true) );
}
$tonsin = 0;
while( $row = sqlsrv_fetch_array( $stmt, SQLSRV_FETCH_ASSOC) )
{
$tonsin += $row['Tons'];
}
//end
?>
<?php echo $tonsin; ?>
<?
$db = null;
?>

View File

@@ -0,0 +1,15 @@
<?php
include("dbinfo.php");
$con=mysqli_connect($host,$username,$password,$database);
$query = "SELECT ((SELECT westtotground FROM westtotalground ORDER BY id DESC LIMIT 1) - (SELECT westtotground FROM westtotalground ORDER BY id DESC LIMIT 899, 1))*4 AS westavg";
$result=mysqli_query($con,$query);
$include4=mysqli_fetch_array($result,MYSQLI_ASSOC);
mysqli_close($con);
?>
<?php echo round($include4['westavg']); ?>