/** * * Registro en DB * */ function saveData() { static $result = array(); $codigo = rand(100000, 10000000); try { $ubicacion = new Ubicacion(); $ubicacion->codigo = $codigo; $ubicacion->usuario_id = Auth::user()->id; $ubicacion->categoria_id = Input::get('categoria'); $ubicacion->tipo_acceso_id = Input::get('tipo'); $ubicacion->x = Input::get('x'); $ubicacion->y = Input::get('y'); $ubicacion->nombre = Input::get('nombre'); $ubicacion->descripcion = Input::get('descripcion'); $ubicacion->etiquetas = Input::get('etiquetas'); $ubicacion->contacto = Input::get('contacto'); $ubicacion->estado = 1; $ubicacion->vigencia = Input::get('date') . " " . Input::get('time'); $ubicacion->usuario_creacion = Auth::user()->id; $ubicacion->save(); $result['flag'] = true; $result['msg'] = $ubicacion->id; } catch (Exception $err) { //return $err->getCode() . " / " . $err->getMessage(); if ($err->getCode() == 23000 and strpos($err->getMessage(), "Duplicate entry") !== false) { saveData(); } else { $result['flag'] = false; $result['msg'] = "Ocurrio un problema. (ID: {$codigo})"; } } return $result; }
public function addPage($site, $name, $page) { $data = \H::getJSONData("{$site}Pages"); var_dump($data); $name = strtolower($name); $pages[$name] = $page; saveData("{$site}Pages", json_encode($pages)); return true; }
public function login($username, $password) { $this->post($this->server); $response = $this->post($this->server . "/login.php", array("email" => $username, "pass" => $password, "charset_test" => "%E2%82%AC%2C%C2%B4%2C%E2%82%AC%2C%C2%B4%2C%E6%B0%B4%2C%D0%94%2C%D0%84", "m_ts" => $this->getCookie("m_ts"), "li" => $this->getCookie("li"))); $parts = parse_url($response[1]['url']); if ($parts['path'] == "/login.php" && isset($parts['query']) && preg_match("/\\&email\\=/", $parts['query'])) { return false; } else { saveData("network_facebook_user", $this->getCookie("c_user")); return true; } }
public function addPage($site, $name, $page) { $data = getData("{$site}Pages"); $name = strtolower($name); if ($data) { $pages = json_decode($data, true); $pages = !is_array($pages) ? array() : $pages; } else { $pages = array(); } $pages[$name] = $page; saveData("{$site}Pages", json_encode($pages)); return true; }
/** * Save JSON as a value of App's Data Storage */ public static function saveJSONData($key, $values) { $a = getData($key); $a = json_decode($a, true); $a = is_array($a) ? $a : array(); $new = array_merge_recursive($a, $values); foreach ($values as $k => $v) { if ($v === false) { unset($new[$k]); } } $new = json_encode($new); saveData($key, $new); return true; }
function main() { for ($i = 1;; $i++) { sleep(1000); $baseUri = "http://www.dianping.com/search/category/2/45/g146p" . $i; $urls = getItems($baseUri); $urls = removeRepeit($urls); if ($urls <= 0) { break; } for ($j = 0; $j < count($urls); $j++) { $result = getItemdetails($urls[$j]); saveData($result); } } }
function getLinks($page) { global $destination, $id, $from_city, $pisah; $id = 0; $source = scraperWiki::scrape($page); $html = new simple_html_dom(); $html->load($source); $id = $id + 1; $ticketvalues = $html->find("td[@class='ticketvalue']"); $from_city = $ticketvalues[0]->plaintext; $destination = $ticketvalues[5]->plaintext; $pisah = $ticketvalues[2]->plaintext; $railway = array("id" => $id, "from_city" => $from_city, "destination" => $destination, "pisah" => $pisah); // Save the record. saveData(array("from_city", "destination", "pisah"), $railway); }
public function KeyAdd($master, $password, $key, $value) { if ($this->MasterExists($master)) { require_once APP_DIR . "/src/Inc/Crypto.php"; $items = getData("master_" . $master . "_items"); $pass_salt = getData("master_" . $master . "_password_salt"); $items = $items == null ? array() : json_decode($items, true); $items[$key] = $value; $items = json_encode($items); $key = $this->master_salt . $password . $pass_salt; Crypto::$KEY_BYTE_SIZE = mb_strlen($key, '8bit'); $items = Crypto::encrypt(base64_encode($items), $key); $items = base64_encode($items); saveData("master_" . $master . "_items", $items); return true; } else { return false; } }
} if (!empty($_POST['submitted'])) { $data = elements(array('name', 'surname', 'email', 'password', 'password_confirm'), $_POST); $allGood = true; foreach ($data as $value) { if ($value === null || empty($value)) { $allGood = false; break; } } if (strcmp($data['password'], $data['password_confirm']) != 0) { $allGood = false; } if ($allGood) { // put data into database or whatever needs to be done saveData($data); header('Location: login.php'); exit; } else { echo "There was a problem with your registration, please try again.. "; } } //zadnji koristeni ID je trenutno u fajlu function saveData($data) { //dohvati ID $id = getIdentificator("identifikatori.txt", 'id_korisnika'); //spremi u bazu $handle = fopen("korisnici.txt", "a"); if ($handle) { fwrite($handle, $id . ';' . htmlentities($data['name']) . ';' . htmlentities($data['surname']) . ';' . htmlentities($data['email']) . ';' . sha1($data['password']) . "\n");
function dispatch() { $cmd = $_POST["cmd"]; $cid = $_POST["cid"]; $uid = $_POST["uid"]; $data = $_POST["data"]; if (!matchCredentials($uid, $cid)) { echo "Not allowed"; //exit(); } else { switch ($cmd) { case "load": return loadData($uid, $cid); break; case "save": $result = saveData($uid, $cid, $data); do_action("gnlms_user_course_data_saved", $uid, $cid, $data); return $result; break; default: echo "42"; break; } } }
} else { echo " \r"; $out['down']++; } } echo "\n============ STATS ==============\n"; echo "Proxies tested:\t" . $out['tested'] . "\n"; echo "Online:\t" . $out['up'] . "\n"; echo "Offline:\t" . $out['down'] . "\n"; echo "HTTP only\t" . $out['https_forbidden'] . "\n"; echo "Altered JS\t" . $out['altered_js'] . "\n"; echo "Altered HTML\t" . $out['altered_html'] . "\n"; echo "IP not hidden\t" . $out['nonaltered_ip'] . "\n"; echo "Runtime\t" . round((time() - $start) / 60) . " Minutes\n"; if (is_array($p)) { saveData($basedir . $session . "/bad_proxies_{$type}.txt", implode("\n", $p)); } /**************************************************************************/ /* scanProxy function by Christian Haschek christian@haschek.at */ /* It's intended to be used with php5-cli .. don't put it on a web server */ /* */ /* Requests a specific file ($url) via a proxy ($proxy) */ /* if first parameter is set to false it will retrieve */ /* $url without a proxy. CURL extension for PHP is required. */ /* */ /* @param $proxy (string) is the proxy server used (eg 127.0.0.1:8123) */ /* @param $url (string) is the URL of the requested file or site */ /* @param $socks (bool) true: SOCKS proxy, false: HTTP proxy */ /* @param $timeout (int) timeout for the request in seconds */ /* @return (string) the content of requested url */ /**************************************************************************/
function scrapeHTML($param, $type) { $html = scraperWiki::scrape("http://www.butxaca.com/"); $dom = new simple_html_dom(); $dom->load($html); foreach ($dom->find("table.eventtable TR") as $data) { $tds = $data->find("td"); $td = 0; foreach ($tds as $cell) { switch ($i) { case 0: $horas[] = $cell->plaintext . PHP_EOL; break; case 2: $titles[] = $cell->find('a.enllasEsdeveniment span.titol')->innertext . PHP_EOL; break; } $i++; // Set the date. $dates[] = date("m.d.y"); } } // Build up record to store. $flight_data = array("date" => $dates, "hora" => $horas, "time" => $titles); // Save the record. saveData(array("date"), $flight_data); exit; // Iterate over table rows and get flight details. foreach ($dom->find("TR[@HEIGHT='25']") as $data) { // Flight details. $tds = $data->find("td"); $airline = removeSpaces($tds[0]->plaintext); $flight_type = $type; $flight_num = removeSpaces($tds[1]->plaintext); $destination = removeSpaces($tds[2]->plaintext); $time = removeSpaces($tds[3]->plaintext); $gate = removeSpaces($tds[4]->plaintext); $remarks = removeSpaces($tds[5]->plaintext); // Skip header row. Cheesy, but effective. if ($airline == "Airline") { continue; } // Set the date. $date = date("m.d.y"); // Build up record to store. $flight_data = array("date" => $date, "airline" => $airline, "flight_type" => $flight_type, "flight_num" => $flight_num, "destination" => $destination, "time" => $time, "gate" => $gate, "remarks" => $remarks); // Save the record. saveData(array("date", "airline", "flight_num"), $flight_data); } }
foreach ($nextPage->find('a') as $element) { $MyString = $element->href; $MyString = htmlspecialchars_decode($MyString); // print "Próxima página: " . $MyString . "\n"; } } } //************************programa principal************************// require 'scraperwiki/simple_html_dom.php'; $dom = new simple_html_dom(); //*Pegar os memberId dos avaliadores pelo sql e passar para a função*// avaliaVendedor("blowitoutahere"); print "MyString = " . $MyString . "\n"; //limitando em percorrer 3 páginas for ($pag = 0; $pag < 3; $pag++) { $html = scraperWiki::scrape($MyString); $dom->load($html); foreach ($dom->find("table.FbOuterYukon") as $data) { $tds = $data->find("td"); for ($i = 4; $i <= 197; $i += 8) { $record = array('data_autocount' => $i, 'data_Feedback' => $tds[$i + 1]->plaintext, 'data_MemberID_AND_FeedbackScore' => $tds[$i + 2]->plaintext, 'data_Date-Time' => $tds[$i + 3]->plaintext, 'data_Item_Weight_Price_ItemNumber' => $tds[$i + 5]->plaintext, 'data_Price' => $tds[$i + 6]->plaintext); // Salva o record na tabela // Salvar o $MyStringVendedor também. saveData(array("Data_autocount", "data_Feedback", "data_MemberID_AND_FeedbackScore"), $record); } getLinks($data); } proxPaginaVendedor($dom); } print_r(scraperwiki::show_tables()); print_r(scraperwiki::sqliteexecute("select * from membersLinks")); //print_r(scraperwiki::sqliteexecute("select * from allFeedBacks"));
for ($i = 4; $i <= 197; $i += 8) { // Negative row class is <tr class="fbOuterAddComm"><td class="fbOuterAddComm"> // If negrow then only save specified fields // if($tds[$i+6]->plaintext !=" ") // Feedback from supplier $record = array('Data_autocount' => $i, 'data_blank' => $tds[$i]->plaintext, 'data_Feedback' => $tds[$i + 1]->plaintext, 'data_MemberID_AND_FeedbackScore' => $tds[$i + 2]->plaintext, 'data_Date-Time' => $tds[$i + 3]->plaintext, 'data_blank2' => $tds[$i + 4]->plaintext, 'data_Item_Weight_Price_ItemNumber' => $tds[$i + 5]->plaintext, 'data_Price' => $tds[$i + 6]->plaintext, 'data_ViewItemLink' => $tds[$i + 7]->plaintext); // else // { // $record = array( // 'Data_autocount' =>$i, // 'data_blank' => $tds[$i]->plaintext, // 'data_Feedback' => $tds[$i+1]->plaintext, // 'data_MemberID_AND_FeedbackScore' => $tds[$i+2]->plaintext, // 'data_Date-Time' => $tds[$i+3]->plaintext, // 'data_blank2' => $tds[$i+4]->plaintext, // 'data_Item_Weight_Price_ItemNumber' => $tds[$i+5]->plaintext // ); // //$i -= 1; // } //print_r($record); for ($d = 1; $d <= 10; $d++) { //print_r($d); // Save the record. saveData(array("Data_autocount"), $record); } } // for ($i=4; $i<=197; $i+= 8) } // foreach($dom->find("table.FbOuterYukon") as $data){ } // for ($paqes=1; $i<=3; $i+= 1) // Save to magic SQL record
public function liveChange($type = "") { $codes = array("reload" => "window.location = window.location;", "reset" => "1"); if (isset($codes[$type])) { saveData("election_ajax_script", $codes[$type]); } else { return false; } }
function scrapeHTML($param, $type) { $html = scraperWiki::scrape(BASE_URL . "?type={$param}"); $dom = new simple_html_dom(); $dom->load($html); // Iterate over table rows and get flight details. foreach ($dom->find("TR[@HEIGHT='25']") as $data) { // Flight details. $tds = $data->find("td"); $airline = removeSpaces($tds[0]->plaintext); $flight_type = $type; $flight_num = removeSpaces($tds[1]->plaintext); $destination = removeSpaces($tds[2]->plaintext); $time = removeSpaces($tds[3]->plaintext); $gate = removeSpaces($tds[4]->plaintext); $remarks = removeSpaces($tds[5]->plaintext); // Skip header row. Cheesy, but effective. if ($airline == "Airline") { continue; } // Set the date. $date = date("m.d.y"); // Build up record to store. $flight_data = array("date" => $date, "airline" => $airline, "flight_type" => $flight_type, "flight_num" => $flight_num, "destination" => $destination, "time" => $time, "gate" => $gate, "remarks" => $remarks); // Save the record. saveData(array("date", "airline", "flight_type", "flight_num"), $flight_data); } $dom->clear(); }
// Now get the ID again... $query_getID = "SELECT userID FROM userdata WHERE emailAddress='{$currentUser}'"; $result_getID = mysql_query($query_getID, $cxn) or die("Couldn't execute query 1"); $userIDr = mysql_fetch_assoc($result_getID); $userID = $userIDr['userID']; } if (isset($_POST['userID'])) { $userID = $_POST['userID']; } if ($userID == 0) { header('Location: signup.php'); } // save data if neccessary $errors = 0; if (isset($_POST['saveTrue'])) { saveData($cxn, $userID); // reset current user (allows you to change your email address) $currentUser = safe($_POST['postEmail']); } //reads the name of the file the user submitted for uploading //$image=$_FILES['image']['name']; //if it is not empty if (isset($_FILES['image']['name']) && $_FILES['image']['name'] != '') { //get the original name of the file from the clients machine $filename = stripslashes($_FILES['image']['name']); //get the extension of the file in a lower case format $extension = getExtension($filename); $extension = strtolower($extension); //if it is not a known extension, we will suppose it is an error and will not upload the file, //otherwise we will do more tests if ($extension != "jpg") {
$db_PREFIX = @$_SESSION['db_PREFIX']; } } //加载网址配置 loadWebConfig(); $isMakeHtml = false; //默认生成HTML为关闭 if (@$_REQUEST['isMakeHtml'] == '1' || @$_REQUEST['isMakeHtml'] == 'true') { $isMakeHtml = true; } $templateName = @$_REQUEST['templateName']; //模板名称 //保存数据处理页 switch (@$_REQUEST['act']) { case 'savedata': saveData(@$_REQUEST['stype']); die; //保存数据 break; //'站长统计 | 今日IP[653] | 今日PV[9865] | 当前在线[65]') //'站长统计 | 今日IP[653] | 今日PV[9865] | 当前在线[65]') case 'webstat': webStat($adminDir . '/Data/Stat/'); die; //网站统计 break; case 'saveSiteMap': $isMakeHtml = true; saveSiteMap(); die; //保存sitemap.xml
<?php // For DB connectivity require "connection.php"; if (!is_dir("uploads")) { mkdir("uploads"); } $location = "uploads/" . basename($_FILES['uploadedfile']['name']); if (move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $location)) { saveData($location); header("location: http://ridashboard.midnightjabber.com/"); die; } else { if (copy($_FILES['uploadedfile']['tmp_name'], $location)) { //header("location: listfiles.php"); } else { // File uplaod failed echo "You totally Failed, click <a href=\"../index.php\"> to try again"; } } function saveData($location) { global $_FILE, $_POST; // Get connection to the DB $link = getConnection(); // Generate global unique Game ID $guid = getGUID(); // Insert Game Data for the Player $query = "INSERT INTO Uploads VALUES('" . (string) $guid . "', '" . (string) $_POST['name'] . "', '" . (string) $_POST['description'] . "', 'Aspect', '" . (string) $location . "');"; $res = mysqli_query($link, $query); echo (string) mysqli_error($link);
<?php require "../../../../load.php"; if (isset($_POST['appId']) && isset($_POST['key']) && isset($_POST['value']) && H::csrf()) { $app = $_POST['appId']; $key = $_POST['key']; $val = $_POST['value']; if (!saveData($key, $val, $app)) { echo "bad"; } else { echo "good"; } } else { echo "fieldsMissing"; }
saveData("female_candidates", serialize($candidates)); } } if (isset($_POST['add_male_candidates']) || isset($_POST['add_female_candidates'])) { $data = array(); $i = isset($_POST['add_male_candidates']) ? 0 : 50; foreach ($_POST['candidates'] as $candidate_name) { $data[$i] = $candidate_name; $i++; } if (isset($_POST['add_female_candidates'])) { // Girls saveData("female_candidates", serialize($data)); } else { // Boys saveData("male_candidates", serialize($data)); } } ?> <div class="content-full"> <h2>Boys</h2> <p>Use the below form to change details of the <b>Boys</b> Candidates</p> <?php if ($ELEC->isElection("male")) { $candidates = unserialize(getData("male_candidates")); echo "<form method='POST'>"; foreach ($candidates as $id => $candidate) { echo "<div class='item'>"; echo "<input type='text' size='30' name='candidates[{$id}]' value='{$candidate}' />"; echo "</div>"; }
<?php include_once 'auth_connect.php'; include_once 'data_connect.php'; include_once 'functions.php'; sec_session_start(); if (login_check($mysqli) == true) { echo saveData($_POST["data_sending"], $mysqli, $mysqli_content); } else { echo false; }
require 'conn.php'; require 'jssdk.php'; $action = ''; if (isset($_GET['a'])) { $action = $_GET['a']; } if ($action == 'share') { //TODO fetch wechat info $id = saveData('share'); //conn.php echo $id; //end } if ($action == 'visit') { //TODO fetch wechat info $id = saveData(); //conn.php echo $id; //end } if ($action == 'count') { //TODO fetch wechat info echo countShared(), '---'; //conn.php //end } else { if ($action == 'getsharedata') { //TODO fetch wechat info $data = getSharedData(); $tr = ''; foreach ($data as $item) {
<?php // Request of all parameters $action = $_REQUEST['action']; if ($action == 'save') { saveData(); // Salva os dados } else { $error = ""; $msg = ""; $target = "../podcast/"; $fileElementName = 'fileToUpload'; if (!empty($_FILES[$fileElementName]['error'])) { switch ($_FILES[$fileElementName]['error']) { case '1': $error = 'The uploaded file exceeds the upload_max_filesize directive in php.ini'; break; case '2': $error = 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form'; break; case '3': $error = 'The uploaded file was only partially uploaded'; break; case '4': $error = 'No file was uploaded.'; break; case '6': $error = 'Missing a temporary folder'; break; case '7': $error = 'Failed to write file to disk';
function scrapeHTML($param, $type) { $html = scraperWiki::scrape("http://www.norwegian.no/fly/lavpris/?D_City=CPH&A_City=DUB&TripType=2&D_Day=1&D_Month=201104&R_Day=1&R_Month=201104&AdultCount=1&ChildCount=0&InfantCount=0"); $dom = new simple_html_dom(); $dom->load($html); // Iterate over table rows and get flight details. foreach ($dom->find("TR[@HEIGHT='25']") as $data) { // Flight details. $tds = $data->find("div"); $airline = removeSpaces($tds[0]->plaintext); $flight_type = $type; $flight_num = removeSpaces($tds[1]->plaintext); $destination = removeSpaces($tds[2]->plaintext); $time = removeSpaces($tds[3]->plaintext); $gate = removeSpaces($tds[4]->plaintext); $remarks = removeSpaces($tds[5]->plaintext); // Skip header row. Cheesy, but effective. if ($airline == "Airline") { continue; } // Set the date. $date = date("m.d.y"); // Build up record to store. $flight_data = array("date" => $date, "airline" => $airline, "flight_type" => $flight_type, "flight_num" => $flight_num, "destination" => $destination, "time" => $time, "gate" => $gate, "remarks" => $remarks); // Save the record. saveData(array("date", "airline", "flight_type", "flight_num"), $flight_data); } $dom->clear(); }
function insertSatteliteRows($persons, $data, $type) { $data['quantity'] = $data['quantity'] / count($persons); $data['price'] = $data['price'] / count($persons); if (isset($data['total_weight'])) { $data['total_weight'] = $data['total_weight'] / count($persons); } foreach ($persons as $v) { $data = array_merge($data, $v); saveData('purchase_total_' . $type, $data); } }
<?php if (isset($_POST['date'])) { $date = $_POST['date']; $dates = getData("written_dates"); if ($dates == null) { $dates = array(); } else { $dates = json_decode($dates, true); } if (array_search($date, $dates) === false) { $dates[] = $date; echo saveData("written_dates", json_encode(array_values($dates))); } else { echo "1"; } }
/** * Creates a new short link. * @param $currentLinks array The array containing the current links (see above). * @param $url string The URL of the long link. * @param $link string The preferred short URL. If this short URL is not available, an other short * URL will be generated. Same if this arg is set to NULL. * * @return string The key of the new URL, or false if an error happened (ex: if the URL is not valid). */ function addLink($currentLinks, $url, $link = NULL) { if ($url != NULL) { // Very permissive control on URLs // Protection against unwanted additionnals headers $url = str_replace("\n", NULL, $url); $url = str_replace("\r", NULL, $url); $url = rawurldecode($url); // Avoid the remplacement of "+" by a space. "+" is needed by some URLs (like ZeroBin URLs). $link = urldecode($link); // The anchor must be URL-encoded // What link? $shortURL = NULL; if ($link != NULL) { /* * Summary: * If a link is requested: * - it is free? Take it. * - it isn't? If a link to this URL already exists, we take this one; else we generate a random one. * If no link is requested, a random link is generated, except if a link already exists. */ // Cleaning link, because a "#" is interpreted as an anchor by the browser, and the URL can't be loaded if this happens. $link = str_replace('#', NULL, $link); if (!isLinkFree($currentLinks, $link)) { // If the requested link is taken, we generate an other link. $search = searchUrlInLinks($currentLinks, $url); if ($search !== false) { $shortURL = $search; } else { do { $shortURL = generateHash(mt_rand()); } while (!isLinkFree($currentLinks, $shortURL)); } } else { $shortURL = $link; // The link requested is free, all is OK. } } else { $search = searchUrlInLinks($currentLinks, $url); if ($search !== false) { $shortURL = $search; } else { do { $shortURL = generateHash(mt_rand()); } while (!isLinkFree($currentLinks, $shortURL)); } } // Saving // Nota: a link may have multiple authors. if (!isset($currentLinks[$shortURL])) { $currentLinks[$shortURL] = array('url' => $url, 'views' => 0, 'ip' => array(hashIP($_SERVER['REMOTE_ADDR']))); } else { if (!in_array(hashIP($_SERVER['REMOTE_ADDR']), $currentLinks[$shortURL]['ip'])) { $currentLinks[$shortURL]['ip'][] = hashIP($_SERVER['REMOTE_ADDR']); } } saveData($currentLinks); return $shortURL; } else { return false; } }
*/ include 'ArrayUtil.php'; session_start(); if (!isset($_SESSION['user_id'])) { header('Location: index.php'); exit; } if (!empty($_POST['submitted'])) { $data = element('name', $_POST); $allGood = true; if (empty($data)) { $allGood = false; } if ($allGood) { // put data into database or whatever needs to be done saveData(htmlentities($data)); header('Location: upload.php'); exit; } else { echo "There was a problem, please try again.. "; } } //zadnji koristeni ID je trenutno u fajlu function saveData($data) { $identificators = array(); //dohvati ID $id = getIdentificator("identifikatori.txt", 'id_galerije'); //spremi u bazu $handle = fopen("galerije.txt", "a"); $line = $id . ';';
/** * Process the formfields, if set. Takes fields pgnratingcomment<id>, pgnratingvote<id>, * pgnratingsend<id> */ function processForm($sourceId) { if (value("pgnratingsend" . $sourceId) == "1") { return saveData(value("pgnrating" . $sourceId, "NUMERIC"), value("pgnratingcomment" . $sourceId, "", ""), $sourceId); } return false; }