function _validateFields($password) { //Check Perms first $rider = new RDrider($this->conn, $this->units); if (!$rider->checkPerms($this->f_riderID, $password)) { return "Invalid password"; } //Allow for length w/o hours if (preg_match('/^[^:]*:[^:]*$/', $this->f_time)) { $this->f_time = "00:" . $this->f_time; } return ""; }
<td class="tbLogHeader">Max Dist<br><?php echo $units->distanceString(); ?> </td> <td class="tbLogHeader">Time</td> <td class="tbLogHeader">Avg<br><?php echo $units->velocityString(); ?> </td> <td class="tbLogHeader">Best Avg<br><?php echo $units->velocityString(); ?> </td> </tr> <?php $riders = new RDrider(DBConnect(), $units); $results = $riders->queryAllStats($currentQuery->getWhereStatement()); $riderCount = 0; $orides = 0; $otime = 0; $odist = 0; $omAvgSpeed = 0; $omDist = 0; $oaDist = 0; while ($riders->parseNextRow($results)) { $riderCount++; echo "<tr>\n"; echo " <td class=\"tbLogHeader\">" . fixFieldForHTML($riders->f_firstName . " " . $riders->f_lastName, 0) . "</td>\n"; echo " <td class=\"tbLogBody\">" . $riders->c_numRides . "</td>\n"; echo " <td class=\"tbLogBody\">" . number_format($riders->c_totalDist, 2) . "</td>\n"; echo " <td class=\"tbLogBody\">" . number_format($riders->c_aDist, 2) . "</td>\n";
function _validateFields($password) { //Check Perms first $rider = new RDrider($this->conn, $this->units); if (!$rider->checkPerms($this->f_riderID, $password)) { return "Invalid password"; } //Allow for length w/o hours if (preg_match('/^([^:]*):([^:]*)$/', $this->f_time, $matches)) { //Do a computation to try and decide if they //left off hours or seconds. Assume hours //left off and see if average speed is reasonable $seconds = $matches[2] + $matches[1] * 60; $avg = $this->f_distance * 3600.0 / $seconds; if ($avg > C_MAX_SPEED) { $this->f_time = $this->f_time . ":00"; } else { $this->f_time = "00:" . $this->f_time; } } return ""; }
(at your option) any later version. Ride Dammit! is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Ride Dammit!; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ //Stupid PHP includes: chdir(".."); require "RD/RDdbclasses.php"; $getVars = $HTTP_GET_VARS; $rider = new RDrider(DBConnect(), $units); //Check for form submit and handle it here if ($HTTP_POST_VARS["submit"]) { //Fill in the info they submitted. $rider->f_firstName = unFixQuotes($HTTP_POST_VARS["firstName"]); $rider->f_lastName = unFixQuotes($HTTP_POST_VARS["lastName"]); $pword = unFixQuotes($HTTP_POST_VARS["password"]); $verify = unFixQuotes($HTTP_POST_VARS["verify"]); $code = unFixQuotes($HTTP_POST_VARS["code"]); //Check for code word if (md5($code) != $RD_authCodeMD5) { $errMsg = "Invalid Code! No permission to create an account."; } //Check for password mismatch if (!$errMsg && $pword != $verify) { $errMsg = "Passwords do not match! Please enter them again.";
//Fill in the info they submitted. $ride->f_riderID = (int) $HTTP_POST_VARS["rider"]; $ride->f_date = unFixQuotes($HTTP_POST_VARS["date"]) . " " . unFixQuotes($HTTP_POST_VARS["hour"]); $ride->f_distance = (double) $HTTP_POST_VARS["distance"]; $ride->f_maxSpeed = (double) $HTTP_POST_VARS["maxSpeed"]; $ride->f_time = unFixQuotes($HTTP_POST_VARS["time"]); $ride->f_locationID = (int) $HTTP_POST_VARS["location"]; $ride->f_temperature = (double) $HTTP_POST_VARS["temperature"]; $ride->f_wind = unFixQuotes($HTTP_POST_VARS["wind"]); $ride->f_sky = unFixQuotes($HTTP_POST_VARS["sky"]); $ride->f_effortLevel = unFixQuotes($HTTP_POST_VARS["effort"]); $ride->f_bikeID = (int) $HTTP_POST_VARS["bike"]; $ride->f_notes = unFixQuotes($HTTP_POST_VARS["notes"]); //Check for password $fixedPassword = unFixQuotes($HTTP_POST_VARS["password"]); $riderTest = new RDrider(DBConnect(), $units); if (!$riderTest->checkPerms($ride->f_riderID, $fixedPassword)) { $errMsg = "Invalid Password"; } if (!$errMsg && $HTTP_POST_VARS["bike"] == 0) { //New Bike, create it $newBike = new RDbike(DBConnect()); $newBike->f_bike = unFixQuotes($HTTP_POST_VARS["newBike"]); $newBike->f_computerSetting = (int) $HTTP_POST_VARS["computerSetting"]; $newBike->f_riderID = $ride->f_riderID; $errMsg = $newBike->insertNew(); $ride->f_bikeID = $newBike->f_bikeID; } if (!$errMsg && $HTTP_POST_VARS["location"] == 0) { $newLocation = new RDlocation(DBConnect()); $newLocation->f_location = unFixQuotes($HTTP_POST_VARS["newLocation"]);
function update($password) { //Check Perms first $rider = new RDrider($this->conn, $this->units); if (!$rider->checkPerms($this->f_riderID, $password)) { return "Invalid password"; } $result = normalQuery($this->conn, "update rides set " . "date=\"" . addSlashes($this->f_date) . "\", distance=" . $this->units->settingToKM((double) $this->f_distance) . ", maxSpeed=" . $this->units->settingToKM((double) $this->f_maxSpeed) . ", time=\"" . addSlashes($this->f_time) . "\", locationID=" . (int) $this->f_locationID . ", temperature=" . $this->units->settingToCelsius((double) $this->f_temperature) . ", wind=\"" . addSlashes($this->f_wind) . "\", sky=\"" . addSlashes($this->f_sky) . "\", effortLevel=\"" . addSlashes($this->f_effortLevel) . "\", bikeID=" . (int) $this->f_bikeID . ", notes=\"" . addSlashes($this->f_notes) . "\" where rideID=" . (int) $this->f_rideID . " and riderID=" . (int) $this->f_riderID); $rows = mysql_affected_rows($this->conn); if (!$rows) { return "Error updating, perhaps rider changed?"; } }
<?php $pageTitle = S_PERSON . " Stats"; include "header.inc.html"; ?> <H2><?php echo S_PERSON; ?> Stats for the Last 12 Months</H2> <p> </p> <TABLE class="tbLog" width="820" cellspacing="2px" cellpadding="2px"> <?php $riders = new RDrider(DBConnect(), $units); $results = $riders->queryAllStats(""); $alternator = ""; while ($riders->parseNextRow($results)) { echo "<TR>\n"; echo "<td width=400 height=300 class=\"tbLogBody" . $alternator . "\">"; echo "<img src=\"graphs/" . $riders->f_riderID . "dist.png\" width=400 height=300></td>\n"; echo "<td width=20 height=300 > </td>\n"; echo "<td width=400 heigth=300 class=\"tbLogBody" . $alternator . "\">"; echo "<img src=\"graphs/" . $riders->f_riderID . "time.png\" width=400 height=300></td>\n"; echo "</TR>\n"; if ($alternator == "") { $alternator = "2"; } else { $alternator = ""; }