function validate_ad_data($form_id) { return validate_form_data(1); return $error; }
<?php /** * The Account > Edit Profile template. * * Displays the user account page. * * @package WPSC * @since WPSC 3.8.10 */ ?> <form method="post"> <?php echo validate_form_data(); ?> <table> <?php wpsc_display_form_fields(); ?> <tr> <td></td> <td> <input type="hidden" value="true" name="submitwpcheckout_profile" /> <input type="submit" value="<?php _e('Save Profile', 'wp-e-commerce'); ?>
function update_log_row($athlete_id, $details, $post_data) { $columns = array(); $columns = validate_form_data($details, $post_data); $session_id = $columns['session_id']; // Find out who owns this session and check that this user // has permission to edit the owner's log $session_owner = get_session_owner($session_id); if ($athlete_id == $session_owner) { } elseif ($athlete_id != $session_owner && check_share_permission($session_owner, "edit log {$athlete_id}")) { $athlete_id = $session_owner; } else { echo "You do not have permission to edit this athlete's log<br>"; return false; } # Build insert query $query = "UPDATE log SET "; #foreach ($details as $column){ foreach (array_keys($columns) as $column) { $entry = $columns[$column]; $query = "{$query} {$column} = '{$entry}' ,"; } # remove final comma from query $query = substr($query, 0, strlen($query) - 1); $query = "{$query} WHERE athlete_id = {$athlete_id} AND session_id = {$session_id} "; #echo "DEBUG Entry update query:<br>$query"; # Update session using build UPDATE query $result = do_sql($query) or die('Query failed: ' . pg_last_error()); ## END OF FUNCTION }
$scores['totalscore'] = ($scores['shooterscore'] * 2 + $scores['drivescore'] * 2 + $scores['intakescore'] * 1.5 + $scores['liftscore'] * 0.25 + $scores['robotscore'] * 1 + $scores['autonscore'] * 0.75 + $scores['driverscore'] * 1.25 + $scores['qualifiersscore'] * 1 + $scores['skillsscore'] * 1) * 125 / 1075; } } return $scores; } try { $conn = new PDO("mysql:host={$servername};dbname={$dbname}", $username, $password); // set the PDO error mode to exception $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); $submitter = $_SESSION['id']; if (!hash_equals($_SESSION['token'], $_POST['token'])) { header("Location: index.php?" . http_build_query(array("security" => "true"))); die; } $data = $_POST; $data = validate_form_data($data); $check_if_robot_exists = $conn->prepare("SELECT * FROM robots WHERE teamnum=:teamnumber"); $check_if_robot_exists->bindParam(":teamnumber", $data['teamnum']); $check_if_robot_exists->execute(); $robot_check = $check_if_robot_exists->setFetchMode(PDO::FETCH_ASSOC); $robot_check = $check_if_robot_exists->fetchAll(); $check_if_score_exists = $conn->prepare("SELECT * FROM scores WHERE teamnum=:teamnumber"); $check_if_score_exists->bindParam(":teamnumber", $data['teamnum']); $check_if_score_exists->execute(); $score_check = $check_if_score_exists->setFetchMode(PDO::FETCH_ASSOC); $score_check = $check_if_score_exists->fetchAll(); $add_robot = null; $add_scores = null; if (count($robot_check) === 1) { $add_robot = $conn->prepare("UPDATE robots SET teamname=:teamname, schoolname=:teamschool, robottype=:robottype," . " shootertype=:shootertype, shooterdist=:shooterdist, shooterspd=:shooterspeed, shooterpos=:shooterpos, " . "shooterballsshot=:ballsshot, shooterballshit=:ballshit, drivespeed=:drivespeed," . " drivepushingpwr=:drivepush, drivemaneuverability=:drivemaneuver, intakespeed=:intakespd," . " intakeconsistency=:intakeconsist, intakecapacity=:intakecapacity, liftlow=:liftlow, lifthigh=:lifthigh," . " liftmaxweight=:liftmaxweight, liftspeed=:liftspd, liftreliability=:liftrely, robotheight=:robotheight," . " robotshooterheight=:shooterheight, robotweight=:robotweight, robotbuildquality=:robotbuild, " . "autonpointsscored=:autonscore, autonpointsattempted=:autonattempt, autonreliability=:autonrely," . " driverskill=:driverskill, driverstrategy=:driverstrat, driverruleknowledge=:driverrule, " . "qualifiersmatchesplayed=:qualmatches, qualifierswp=:qualwp, qualifierssp=:qualsp, skillsrobot=:skillrobot, " . "skillsprogramming=:skillprog, notes=:notes, submitter=:submitter WHERE teamnum=:teamnum;"); } else {