<!-- // Adgala, Rohan Karthik Account: jadrn002 // CS545, Fall 2015 // Project #3 --> <?php include 'helpers.php'; include 'p3.php'; include 'file_upload.php'; check_post_only(); $params = process_parameters(); fileUpload(); store_data_in_db($params); include 'confirmation.php'; ?>
function store_data_in_db() { ### NOT A DUP process_parameters(); validate_data($_POST); $db = get_db_handle(); $params = $_POST; // insert parent info $parent_fname = $params['fname']; $parent_mname = $params['mname']; $parent_lname = $params['lname']; $parent_address = $params['address']; $parent_address1 = $params['address1']; $parent_hphone = $params['home_area_phone'] . $params['home_prefix_phone'] . $params['home_phone']; $parent_cphone = $params['cell_area_phone'] . $params['cell_prefix_phone'] . $params['cell_phone']; $parent_city = $params['city']; $parent_state = $params['state']; $parent_zip = $params['zip']; $parent_email = $params['email']; $sql = "INSERT INTO parent (first_name, middle_name, last_name, address1, address2, city, state, zip, primary_phone, secondary_phone, email)" . "VALUES('{$parent_fname}','{$parent_mname}','{$parent_lname}','{$parent_address}','{$parent_address1}','{$parent_city}', '{$parent_state}','{$parent_zip}', '{$parent_hphone}', '{$parent_cphone}', '{$parent_email}' );"; mysqli_query($db, $sql); $how_many = mysqli_affected_rows($db); if ($how_many == 1) { } else { $msg = "A critical error occurred in parent insertion. <br />"; write_form_error_page($msg); exit; } //echo $sql; // insert child info $parent_id = 0; $parent_phone = $params['home_area_phone'] . $params['home_prefix_phone'] . $params['home_phone']; $sql = "SELECT id from `parent` where primary_phone='{$parent_phone}';"; $result = mysqli_query($db, $sql); if (mysqli_num_rows($result) > 0) { $row = mysqli_fetch_array($result); $parent_id = $row[0]; } $child_relation = $params['relation']; $child_fname = $params['cfname']; $child_lname = $params['clname']; $child_mname = $params['cmname']; $child_bday = $params['bday']; $child_gender = $params['gender'][0]; $child_ifile = $params['cfname'] . "_" . $_FILES['fileUpload']['name']; $child_nickname = $params['goesby']; $child_conditions = $params['conditions']; $child_diet = $params['diet']; $child_emname = $params['emeContactname']; $child_emphone = $params['area_phone'] . $params['prefix_phone'] . $params['phone']; $sql = "INSERT INTO child(parent_id, relation, first_name, middle_name, last_name, nickname, image_filename, gender, birthdate, conditions, diet, emergency_name, emergency_phone) " . "VALUES ('{$parent_id}','{$child_relation}','{$child_fname}','{$child_mname}','{$child_lname}','{$child_nickname}','{$child_ifile}','{$child_gender}',STR_TO_DATE('{$child_bday}','%d/%m/%Y'),'{$child_conditions}','{$child_diet}','{$child_emname}','{$child_emphone}');"; mysqli_query($db, $sql); $how_many = mysqli_affected_rows($db); if ($how_many == 1) { } else { $msg = "A critical error occurred in child insertion. <br />"; write_form_error_page($msg); exit; } // echo $sql; // insert enrollment $child_id = 0; $sql = "SELECT id from `child` where parent_id = '{$parent_id}' and first_name = '{$child_fname}'"; $result = mysqli_query($db, $sql); if (mysqli_num_rows($result) > 0) { $row = mysqli_fetch_array($result); $child_id = $row[0]; } $enrollment = 0; $program = $_POST['program']; for ($i = 0; $i < count($program); $i++) { $program_id = get_program_id($program[$i]); $sql = "INSERT INTO `enrollment`(`program_id`, `child_id`) VALUES ({$program_id}, {$child_id});"; mysqli_query($db, $sql); $how_many = mysqli_affected_rows($db); // echo $sql; if ($how_many == 1) { } else { $msg = "A critical error occurred in enrollment insertion."; write_form_error_page($msg); exit; } } mysqli_close($db); }
} } } } if (!isset($la) || !isset($lb) || !isset($lc)) { usage(); } $a = $la; $b = $lb; $c = $lc; } echo "Quadratic calculator sample\n"; $a = null; $b = null; $c = null; process_parameters($a, $b, $c); if ($a == 0) { if ($b == 0) { if ($c == 0) { echo "Any x is suitable.\n"; } else { echo "No x is solution.\n"; } } else { echo "x = " . -$c / $b . "\n"; } } else { $D = $b * $b - 4 * $a * $c; if ($D < 0) { echo "No x is solution.\n"; } else {
/* */ /* This program is free software. You can redistribute it and/or modify */ /* it under the terms of the GNU General Public License as published by */ /* the Free Software Foundation; either version 2 of the License. */ /************************************************************************/ /************************************************************************/ /* The purpose of this PHP Script is simple. Set the $polroot setting */ /* to the location of your Multicache.dat file you wish to convert. */ /* This file is what the newest UO Clients use to store Multi info as */ /* you walk past it. This script will convert it to a cfg file that can */ /* be read back into pol, to build each house. This cfg is formated to */ /* work with my version of AddSet and CreateSet v2.0 and Higher (to be */ /* released in May or June of 2005). */ /************************************************************************/ $polroot = null; process_parameters($polroot); // Check for pol.log from pol root and process it if it exists. echo "Checking for {$polroot}/Multicache.dat......\r\n\r\n"; if (file_exists("{$polroot}/Multicache.dat")) { $plf = file("{$polroot}/Multicache.dat") or die("Could Not Access {$polroot}/Multicache.dat"); ProcessCacheLog($plf); } fgets(STDIN); function ProcessCacheLog($lftp) { global $polroot; echo "File found, processing Multicache.dat.\r\n"; echo "Please be patient......\r\n\r\n"; $reccheck = array(); if (file_exists("{$polroot}/multicache.cfg")) { $lrf = file("{$polroot}/multicache.cfg");