} updateLocation($user); } else { if (have_option('n', 'nickname')) { $nickname = get_option_value('n', 'nickname'); $user = User::getKV('nickname', $nickname); if (empty($user)) { throw new Exception("Can't find user with nickname '{$nickname}'"); } updateLocation($user); } else { if (have_option('a', 'all')) { $user = new User(); if ($user->find()) { while ($user->fetch()) { updateLocation($user); } } } else { show_help(); exit(1); } } } } catch (Exception $e) { print $e->getMessage() . "\n"; exit(1); } function updateLocation($user) { $profile = $user->getProfile();
case $_GET['update']: $locationForm->success("Updated successfully"); break; case $_GET['add']: $locationForm->success("Added new item successfully"); break; case $_GET['delete']: $locationForm->success("Deleted item successfully"); break; } if ($_GET['action'] == editLocation && $_SESSION['access'] >= 50 || $_GET['action'] == showLocation) { //get the new location type corresponding to the ID $location = new Location($_GET['locationID']); //if this is an update then update the room if (isset($_POST['updateLocation'])) { updateLocation($location); } else { displayLocations($location); } } else { if ($_GET['action'] == editLocationType && $_SESSION['access'] >= 50 || $_GET['action'] == showLocationType) { //get the new location type corresponding to the ID $locationType = new LocationType($_GET['locationTypeID']); //if this is an update then update the room if (isset($_POST['updateLocationType'])) { updateLocationType($locationType); } else { displayLocationType($locationType); } } else { if ($_GET['action'] == editRoomType && $_SESSION['access'] >= 50 || $_GET['action'] == showRoomType) {
<?php session_name('TF2MM'); session_start(); //$_SESSION gets set right here, if a previous page created session vars require_once './config.php'; require_once 'classes.php'; lastseen($_SESSION['id']); updateLocation($_SESSION['id'], $_SERVER['REMOTE_ADDR']);
include ('../lib/functions.php'); if(isset($_GET['mySessionID'])){ $mySessionID=$_GET['mySessionID']; $playerName=$_GET['playerName']; $phoneNumber=$_GET['phoneNumber']; $location=$_GET['location']; $flashPhone=$_GET['flashPhone']; if($_GET['action']=='new'){ newCall($mySessionID,$phoneNumber,$playerName,$flashPhone); }elseif($_GET['action']=='update'){ updateLocation($location,$mySessionID); } }else{ $r = "Required parameters missing"; } ?> </head> <body> <? if($r!=""){ echo $r; } ?> </body> </html>
require_once 'includes/misc_functions.inc.php'; $error = array(); $success = array(); /* TODO: most of this file is repetitive. Make it more like Chilli Settings, with arrays defining options and labels, and validation types, then do generic loop */ if (isset($_POST['submit'])) { $newLocationName = \Grase\Clean::text($_POST['locationname']); $newSupportContact = \Grase\Clean::text($_POST['supportcontact']); $newSupportLink = \Grase\Clean::text($_POST['supportlink']); $newMBOptions = clean_numberarray($_POST['mboptions']); $newTimeOptions = clean_numberarray($_POST['timeoptions']); $newBandwidthOptions = clean_numberarray($_POST['bwoptions']); $newLocale = \Grase\Clean::text($_POST['locale']); $newWebsiteName = \Grase\Clean::text($_POST['websitename']); $newWebsiteLink = \Grase\Clean::text($_POST['websitelink']); // Check for changed items updateLocation($newLocationName); updateSupportContactSetting($newSupportContact); updateSupportLinkSetting($newSupportLink); updateLocaleSetting($newLocale); updateWebsiteName($newWebsiteName); updateWebsiteLink($newWebsiteLink); // New functions to file, dont do messy way like above. Value will always be valid, as the cleaning functions should make it a valid value. We should still check the value fits how we want it to (i.e. isn't empty). We don't need to check for error up update as when we have errors we'll never come back here $new2timeoptions = checkGroupsTimeDropdowns($newTimeOptions); if ($new2timeoptions != $newTimeOptions) { $error[] = T_("Some time options are still in use by current groups and have been added back in"); } $new2mboptions = checkGroupsDataDropdowns($newMBOptions); if ($new2mboptions != $newMBOptions) { $error[] = T_("Some data options are still in use by current groups and have been added back in"); } $new2bwoptions = checkGroupsBandwidthDropdowns($newBandwidthOptions);
<?php //error_reporting(0); //Configure DATABASE require_once 'blip_4815162342_108.php'; $conn = db_connect(); //Start Script //Input variables from Angular $location = json_decode(file_get_contents("php://input")); $locID = (int) $location->id; $locName = $location->name; $locLat = (double) $location->lat; $locLng = (double) $location->lng; $locCity = $location->city; $locDes = $location->des; $locCat = (int) $location->cat; $locPic = $location->pic; $locPhone = $location->phone; $locWeb = $location->web; $locHour = $location->hours; $locNat = (int) $location->nat; $update = updateLocation($locID, $locName, $locLat, $locLng, $locCity, $locDes, $locCat, $locPic, $locPhone, $locWeb, $locHour, $locNat); function updateLocation($locID, $locName, $locLat, $locLng, $locCity, $locDes, $locCat, $locPic, $locPhone, $locWeb, $locHour, $locNat) { global $conn; $updateQuery = mysqli_query($conn, "CALL UpdateLocation({$locID}, '{$locName}', {$locLat}, {$locLng}, '{$locCity}', '{$locDes}', {$locCat}, '{$locPic}', '{$locPhone}', '{$locWeb}', '{$locHour}', {$locNat})") or die("Query fail: " . mysqli_error($conn)); } mysqli_close($conn);
function parseData($counterPosition) { global $cookie1, $cookie2, $cookie3, $cookie4, $cookie5; # Store a timestamp of our start point $startTime = mktime(); # Variable used for post backs $dropdowndsAndSearchText = '&ctl00%24ContentPlaceHolder1%24ddlRegion=0&ctl00%24ContentPlaceHolder1%24ddlAlphabet=0&ctl00%24ContentPlaceHolder1%24txtKeywords='; # Get our first set of data $info = ''; $result = ''; getBaseData($info, $result); # We need this for our next two post backs $url = $info['url']; // write here the url of your form # Our base HTML from the healthunit site $html = str_get_html($result); # Require for our Next PostBack(s) $viewstate = $html->find('#__VIEWSTATE'); $viewstate = $viewstate[0]->attr['value']; $validation = $html->find('#__EVENTVALIDATION'); $validation = $validation[0]->attr['value']; # Our looping variable & break variable $break = false; $i = 0; foreach($html->find('#ctl00_ContentPlaceHolder1_tblSearchResults') as $el) { # Our primary loop foreach($el->find('tr') as $row) { # Counter Position Check if ($i < $counterPosition) { $i++; continue; } # TimeCheck # If were over 25minutes - then we break out and restart if ($startTime + 60 * 25 < mktime()) { $break = true; break; } echo 'in our process'; # Increment our counter $i++; # Start processing our records $location = strip_tags($row->childNodes(0)->innertext); //estID is parameter of a tag $location_link = $row->childNodes(0)->find('a'); $location_id = $location_link[0]->attr['estid']; $location_linkid = $location_link[0]->attr['id']; $address = $row->childNodes(1)->innertext; $city = $row->childNodes(2)->innertext; $date = $row->childNodes(4)->innertext; //njs - 10-27-10 - column changes $critical = $row->childNodes(5)->innertext; //njs - 10-27-10 - column changes $noncritical = $row->childNodes(6)->innertext; //njs - 10-27-10 - column changes echo 'location ' . $location . '<br>'; echo 'location link id'.$location_linkid.'<br />'; echo 'location link ' . $location_link . '<br />'; echo 'location id ' . $location_id . '<br>'; echo 'address ' . $address . '<br>'; echo 'city ' . $city . '<br>'; echo 'date ' . $date . '<br>'; echo 'critical ' . $critical . '<br>'; echo 'noncritical ' . $noncritical . '<br>'; if ($date != '') { $inspected = date('Y-m-d', strtotime($date)); //njs - 10-28-10 //reset closures if reinspections have occurred boolReInspection($location_id, $inspected); } else { $inspected = '0000-00-00'; } $location_id = updateLocation($location, $address, $city, $inspected, $critical, $noncritical); //njs - 10-28-10 //update inspection was returning false positives on infractions //changed to only check inspection date //$update_inspect = boolUpdateInspection($location_id, $inspected, $critical, $noncritical); $update_inspect = boolUpdateInspection($location_id, $inspected); if ($update_inspect) { try { # Get any of the inspection information $ch = curl_init(); // Initiating the Curl Handler curl_setopt($ch, CURLOPT_URL,$url); // Url a donde se va a postear. curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11'); //I set the user Agent. In this case is Firefox 2 browser curl_setopt($ch, CURLOPT_FAILONERROR, 1); //finish in case of error curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirections curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // Return the result page in a variable curl_setopt($ch, CURLOPT_TIMEOUT, 30); //timeout. curl_setopt($ch, CURLOPT_POST, 1); // I set the POST Method curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie3); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie4); $post = '__EVENTTARGET='.str_replace('_','%24',$location_linkid); $post.= '&__EVENTARGUMENT=&__VIEWSTATE='.urlencode($viewstate); $post.= '&__EVENTVALIDATION='.urlencode($validation); $post.= $dropdowndsAndSearchText; curl_setopt($ch, CURLOPT_POSTFIELDS, $post); //change it with your own field name and value $result2 = curl_exec($ch); // Execute and send the data. $info = curl_getinfo($ch); curl_close($ch); # Parse the results & loop through each inspection date $html2 = str_get_html($result2); $viewstate2 = $html2->find('#__VIEWSTATE'); $viewstate2 = $viewstate2[0]->attr['value']; $validation2 = $html2->find('#__EVENTVALIDATION'); $validation2 = $validation2[0]->attr['value']; $divLocation2 = strpos($result2, '<div id="ctl00_ContentPlaceHolder1_pnlViolations"'); $pos2 = substr($result2, $divLocation2, strpos($result2, '</div>', $divLocation2) - $divLocation2); $html2->clear(); unset($html2); $htmldata2 = str_get_html('<html><body>'.$pos2.'</body></html>'); $skip2 = false; } catch (Exception $e) { error_log('Error processing document ' . $e->getMessage()); die('Error processing document ' . $e->getMessage()); } echo '<br/>process rows '.date('h:i:s'); foreach($htmldata2->find('tr') as $row2) { # Skip the header row if (!$skip2) { $skip2 = true; continue; } # Grab our data $inspectionLink = $row2->childNodes(0)->find('a'); if ($inspectionLink[0]->innertext != '') { $inspectionDate = date('Y-m-d', strtotime($inspectionLink[0]->innertext)); } else { $inspectionDate = '0000-00-00'; } $estid = $inspectionLink[0]->attr['estid']; $inspectionId = $inspectionLink[0]->attr['inspectionid']; $inspectionLinkId = $inspectionLink[0]->attr['id']; $inspectionType = $row2->childNodes(2)->innertext; // rtraction djm - Nov.2 2010 - blank row added $critical = $row2->childNodes(3)->innertext; // rtraction djm - Nov.2 2010 - blank row added $nonCritical = $row2->childNodes(4)->innertext; // rtraction djm - Nov.2 2010 - blank row added # Testing echo 'Inspecd:'.$inspectionDate.'<br />'; echo 'ESTID:'.$estid.'<br />'; echo 'InspecId:'.$inspectionId.'<br />'; echo 'InspecT:'.$inspectionType.'<br />'; echo 'Critical:'.$critical.'<br />'; echo 'NonCritical:'.$nonCritical.'<br />'; echo '<br />'; # Grab the text $ch = curl_init(); // Initiating the Curl Handler curl_setopt($ch, CURLOPT_URL,$url); // Url a donde se va a postear. curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11'); //I set the user Agent. In this case is Firefox 2 browser curl_setopt($ch, CURLOPT_FAILONERROR, 1); //finish in case of error curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirections curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // Return the result page in a variable curl_setopt($ch, CURLOPT_TIMEOUT, 30); //timeout. curl_setopt($ch, CURLOPT_POST, 1); // I set the POST Method curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie4); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie5); $post = '__EVENTTARGET='.str_replace('_','%24',$inspectionLinkId); $post.= '&__EVENTARGUMENT=&__VIEWSTATE='.urlencode($viewstate2); $post.= '&__EVENTVALIDATION='.urlencode($validation2); $post.= $dropdowndsAndSearchText; curl_setopt($ch, CURLOPT_POSTFIELDS, $post); //change it with your own field name and value $result3 = curl_exec($ch); // Execute and send the data. $info = curl_getinfo($ch); curl_close($ch); # Parse the results & loop through each item $divLocation3 = strpos($result3, '<div id="ctl00_ContentPlaceHolder1_pnlViolationDetails"'); $pos3 = substr($result3, $divLocation3, strpos($result3, '</div>', $divLocation3) - $divLocation3); $htmldata3 = str_get_html('<html><body>'.$pos3.'</body></html>'); $skip3 = false; foreach($htmldata3->find('tr') as $row3) { # Skip any header rows if ($row3->class == "inspectionTableHeader") { continue; } # Grab our data for all normal rows if (isset($row3->childNodes(2)->innertext)) { //severity can be critical, noncritical, satisfactory $severity = strip_tags($row3->childNodes(0)->innertext); $desc = $row3->childNodes(1)->innertext; $resultText = $row3->childNodes(2)->innertext; # Testing echo 'Severity:'.$severity.'<br />'; echo 'Desc:'.$desc.'<br />'; echo 'Res:'.$resultText.'<br />'; echo '<br />'; $details = ''; $category = ''; if ($desc != '') { $desc = strip_tags($desc); $failPos = stripos($desc, 'Fail'); $category = substr($desc, 0, $failPos); $details = substr($desc, $failPos, strlen($desc)); } # Update details in db updateInspection($location_id, $inspectionDate, $severity, $resultText, $details, $category, $inspected); } else { // Do we have an order 13? $text = $row3->childNodes(0)->innertext; if (strpos(strtolower($text), 'section 13 order served') !== FALSE) { echo 'Order 13 Served!<br />'; // We found an Order 13 - so lets capture that information updateInspection($location_id, $inspectionDate, 'Closed', 'No', strip_tags($text), 'Order 13 Served', $inspected); } else if (strpos(strtolower($text), 'section 13 order revoked') !== FALSE) { echo 'Order 13 Revoked!<br />'; // We found an Order 13 - so lets capture that information updateInspection($location_id, $inspectionDate, 'Closed', 'No', strip_tags($text), 'Order 13 Revoked', $inspected); } else { echo 'No infractions - record note!<br />'; // We record a simple note as there was no infractions updateInspection($location_id, $inspectionDate, 'Note', 'No', ' ', strip_tags($text), $inspected); } } } $htmldata3->clear(); unset($htmldata3); # Only process one inspection ///break; Process all inspections - Aug. 5, 2010 - rtraction djm } $htmldata2->clear(); unset($htmldata2); } } # We've hit our timelimit above so we want to break out if ($break) { break; } } $html->clear(); unset($html); // updated log table if (!$break) { updateLog(); } else { # We hit a time block above and broke out of our loops # We're starting the process again but jumping ahead parseData($i); } }
updateTrialTime($conn, $transactionId, $trialTime); } else { if ($dataType == "updateFixedTime") { $transactionId = trim($_GET["transactionId"]); $fixedTime = trim($_GET["fixedTime"]); updateFixedTime($conn, $transactionId, $fixedTime); } else { if ($dataType == "updateFee") { $transactionId = trim($_GET["transactionId"]); $fee = trim($_GET["fee"]); updateFee($conn, $transactionId, $fee); } else { if ($dataType == "updateLocation") { $transactionId = trim($_GET["transactionId"]); $location = trim($_GET["location"]); updateLocation($conn, $transactionId, $location); } else { if ($dataType == "updateFollower") { $transactionId = trim($_GET["transactionId"]); $follower = trim($_GET["follower"]); updateFollower($conn, $transactionId, $follower); } } } } } } } } } }
deleteDepartment(); break; case "insertEmployee": addEmployee(); break; case "updateEmployee": updateEmployee(); break; case "deleteEmployee": deleteEmployee(); break; case "insertLocation": addLocation(); break; case "updateLocation": updateLocation(); break; case "deleteLocation": deleteLocation(); break; } displayHeader(); // Show HTML header displayNavigation(); // Show Navigation // Functions that generate content to browser switch (getCurrentAction()) { case "jobs": displayAllJobs(); break; case "addJob":