Fourth pass at adding key files

This commit is contained in:
dsainty
2024-06-17 22:30:36 +10:00
parent 08eb7b7da2
commit 67ccdbcc34
132 changed files with 11416 additions and 0 deletions

View File

@ -0,0 +1,6 @@
AuthUserFile /home/slowtwitch/forum.slowtwitch.com/cgi-bin/admin/.htpasswd
AuthGroupFile /dev/null
AuthType Basic
AuthName "Training Log Administration"
require valid-user

View File

@ -0,0 +1,63 @@
-- MySQL dump 10.11
--
-- Host: 192.168.1.10 Database: training
-- ------------------------------------------------------
-- Server version 5.0.45-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `ugomo_workout_challenge`
--
DROP TABLE IF EXISTS `ugomo_workout_challenge`;
CREATE TABLE `ugomo_workout_challenge` (
`challenge_id` int(11) NOT NULL auto_increment,
`created_by` varchar(16) NOT NULL,
`challenge_type` int(1) NOT NULL,
`challenge_name` varchar(100) NOT NULL,
`start_date` date NOT NULL,
`end_date` date NOT NULL,
`challenge_value` float NOT NULL,
`unit` int(1) NOT NULL default '0',
`meassure` int(1) NOT NULL default '0',
`sport` varchar(100) default NULL,
`notes` text,
`min_time` int(11) NOT NULL default '0',
`min_distance` float NOT NULL default '0',
`min_distance_unit` int(1) NOT NULL default '0',
PRIMARY KEY (`challenge_id`),
KEY `created_by` (`created_by`),
KEY `meassure` (`meassure`),
KEY `challenge_type` (`challenge_type`)
) ENGINE=MyISAM AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `ugomo_workout_challenge`
--
LOCK TABLES `ugomo_workout_challenge` WRITE;
/*!40000 ALTER TABLE `ugomo_workout_challenge` DISABLE KEYS */;
INSERT INTO `ugomo_workout_challenge` VALUES (2,'devashish_paul',2,'100 runs in 100 days Challenge','2008-12-15','2009-03-24',100,1,1,'run','Feb 16, Day 64 : Allan Faulds closing in on 1000K\r\n\r\nAll the rules are here: http://forum.slowtwitch.com/gforum.cgi?post=2127749',1800,0,1),(5,'tigerchik',2,'January Swim Challenge','2009-01-01','2009-01-31',31,1,1,'swim','Nice work, Fishtwitch! To February we go :D\n\nlove\ntc',0,0,1),(7,'tigerchik',2,'February FISHTWITCH','2009-02-01','2009-02-28',28,1,1,'swim','February 17, and it looks like everyone is doing great... I just can\'t catch up to TryPT and trijerett!\n\nAnyone seeing faster splits yet? Hope so.\ntc',0,0,1),(4,'mrtrik',2,'8 Week Bike Challenge','2008-12-22','2009-02-16',56,1,1,'bike','The idea of the challenge is not to ride 56 times, but to go and ride 7 hrs / week, for 8 weeks. Only 30 minute or longer rides will be counted. The ultimate goal is to ride 56 hrs. Do it however you want... as long as it\'s at least 30 mins session. You can do ten 30 minute sessions in one day. Or one 5 hr session, it\'s all the same. Time in the seat is what matters. Intensity is up to you, get out of it what you will. ',1800,0,1),(9,'Slowman',4,'Duathlon Nationals Challenge','2009-02-15','2009-04-15',2000,1,1,'points','This theme of this Challenge is \"aerobic points\" accumulated during these two months, which can be accrued running, cycling, swimming, or nordic skiing. You get no bump for intensity, and this is by design: just do the work, you\'ll get ready for the race. You\'ll find a sticky thread on the Forum for talking smack, calling out, rick-rolling or whatever it is you need to say. The Challenge is to accumulate 2000 points prior to April 15, which will get you very ready for the race. That\'s the equivalent of running 8+ miles a day, every day, without a break. But some of you will exceed that total. Just don\'t overdo it.',0,0,1),(8,'gavnunns',2,'Run 365 times in 2009','2009-01-01','2009-12-31',365,1,1,'run','Day 47 - Run safe!\r\n\r\nSame rules as Devs challenge just taken a little bit further ;)\r\n\r\nRules can be found here - http://forum.slowtwitch.com/gforum.cgi?do=post_view_flat;post=2127749;page=1;sb=post_latest_reply;so=ASC;mh=25;',1800,0,1);
/*!40000 ALTER TABLE `ugomo_workout_challenge` ENABLE KEYS */;
UNLOCK TABLES;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2009-02-17 15:34:58

View File

@ -0,0 +1,90 @@
<?
$dbhost = '192.168.1.10';
$dbuser = 'slowtwitch';
$dbpass = 'k9volqlAcpq';
$dbname = 'training';
$conn = mysql_connect($dbhost, $dbuser, $dbpass)
or die ('Error connecting to mysql server: ' . mysql_error());
mysql_select_db($dbname)
or die ('Error selecting ' . $dbname . ': ' . mysql_error());
if (isset($_GET["action"]) && isset($_GET["id"])) {
$action = $_GET["action"];
$id = $_GET["id"];
if ($action == "delete" && $id != "") {
$queryCopy = "insert into ugomo_workout_challenge_history (challenge_id, created_by, challenge_type, challenge_name, start_date, end_date, challenge_value, unit, meassure, sport, notes, min_time, min_distance, min_distance_unit) SELECT challenge_id, created_by, challenge_type, challenge_name, start_date, end_date, challenge_value, unit, meassure, sport, notes, min_time, min_distance, min_distance_unit FROM ugomo_workout_challenge WHERE ugomo_workout_challenge.challenge_id = " . $id;
$resultCopy = mysql_query($queryCopy);
$queryDelete = "delete from ugomo_workout_challenge where challenge_id = " . $id;
$resultDelete = mysql_query($queryDelete);
}
header("Location: /tladmin");
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>ST - Training Log Admin</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Style-Type" content="text/css" />
<style>
body { font-face: Verdana; font-size: 14px; }
h1 { font-size: 18px; }
td { padding: 0px 0px 0px 10px; }
table.tabular td { text-align: right; }
tr.headerRow td { font-weight: bold; }
</style>
</head>
<body>
<?
// Users with at least one logged workout
$query = "select user_id, count(*) from ugomo_workout group by user_id order by user_id";
$result = mysql_query($query);
$usersWithOneWorkout = mysql_num_rows($result);
// Total workouts logged
$query = "select count(*) AS total from ugomo_workout";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
$totalWorkoutsLogged = $row["total"];
// Total workouts logged in the last 7 days
$yesterday = date("Y-m-d", strtotime("now") - 86400);
$oneWeekAgo = date("Y-m-d", strtotime("now") - (86400 * 7));
$query = "select count(*) AS total from ugomo_workout where workout_date >= '" . $oneWeekAgo . "' AND workout_date <= '" . $yesterday . "'";
// echo $query . '<br />';
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
$workoutsLoggedLastWeek = $row["total"];
?>
<h1>Challenge Stats</h1>
<table class="tabular">
<tr><td>Users with at least one workout logged:</td><td><?=number_format($usersWithOneWorkout)?></td></tr>
<tr><td>Total workouts logged:</td><td><?=number_format($totalWorkoutsLogged)?></td></tr>
<tr><td>Workouts logged in previous 7 days:</td><td><?=number_format($workoutsLoggedLastWeek)?></td></tr>
</table>
<h1>Challenge Admin</h1>
<table>
<tr class="headerRow"><td>Challenge Name</td><td>Starts</td><td>Ends</td><td>Created By</td><td>&nbsp;</td></tr>
<?
$query = "select challenge_id, created_by, challenge_name, start_date, end_date from ugomo_workout_challenge";
$result = mysql_query($query);
while($row = mysql_fetch_assoc($result)) {
echo '<tr>';
echo '<td>' . $row["challenge_name"] . '</td>';
echo '<td>' . $row["start_date"] . '</td>';
echo '<td>' . $row["end_date"] . '</td>';
echo '<td>' . $row["created_by"] . '</td>';
echo '<td><a href="?action=delete&id=' . $row["challenge_id"] . '" onclick="return confirm(\'Are you sure you want to delete ' . $row["challenge_name"] . '\')">Delete</a></td>';
echo '</tr>' . "\n";
}
?>
</table>