function GetFromYandex($bssid) { $bssid = str_replace(":", "", $bssid); $bssid = str_replace("-", "", $bssid); $data = cURL_Get("http://mobile.maps.yandex.net/cellid_location/?clid=1866854&lac=-1&cellid=-1&operatorid=null&countrycode=null&signalstrength=-1&wifinetworks={$bssid}:-65&app"); $result = ''; $latitude = getStringBetween($data, ' latitude="', '"'); $longitude = getStringBetween($data, ' longitude="', '"'); if ($latitude != '' && $longitude != '') { $result = $latitude . ';' . $longitude; } return $result; }
public function parseLoop($loopLabel, $toParse) { $loopContent = getStringBetween('{loop-' . $loopLabel . '}', '{/loop-' . $loopLabel . '}', $this->Template); $finalRes = ''; foreach ($toParse as $k => $a) { $lc = $loopContent; foreach ($a as $k => $v) { $lc = str_replace('{-' . $k . '-}', $v, $lc); } $finalRes .= $lc; } $this->Template = str_replace('{loop-' . $loopLabel . '}', '', str_replace('{/loop-' . $loopLabel . '}', '', $this->Template)); $this->Template = str_replace($loopContent, $finalRes, $this->Template); }
function GetFromYandex($bssid) { $tries = 3; $bssid = str_replace(":", "", $bssid); $bssid = str_replace("-", "", $bssid); while (!($data = cURL_Get("https://mobile.maps.yandex.net/cellid_location/?clid=1866854&lac=-1&cellid=-1&operatorid=null&countrycode=null&signalstrength=-1&wifinetworks={$bssid}:0&app")) && $tries > 0) { $tries--; sleep(2); } $result = ''; if (!$data) { return $result; } $latitude = getStringBetween($data, ' latitude="', '"'); $longitude = getStringBetween($data, ' longitude="', '"'); if ($latitude != '' && $longitude != '') { $result = $latitude . ';' . $longitude . ';yandex'; } return $result; }
public function getVideoSourceFromIframe($iframePlayerLink, $server = 'hd') { $strSources = ''; switch ($server) { case 'hd': $strSources = str_replace('http://www.dramacool.com/embeddramanox.php?id=', '', $iframePlayerLink); //$strSources = $htmlAll->find('source', 0)->src; break; case 'standard': //mobile //mobile case 'mobile': if (strpos($iframePlayerLink, 'embeddramanox')) { $strSources = str_replace('http://www.dramacool.com/embeddramanox.php?id=', '', $iframePlayerLink); $strSources = base64_encode($strSources); } elseif (strpos($iframePlayerLink, 'videoupload.us')) { $playerSource = getFileContent($iframePlayerLink); $strSources = getStringBetween($playerSource, "file: '", "',", false); if ($strSources) { $strSources = base64_encode($strSources); } } break; case 'cool': //$strSources = getStringBetween($playerSource, "file: '", "',", false); //$strSources = base64_encode($strSources); $strSources = ''; break; case 'mp4': /*$strSources = getStringBetween($playerSource, "clip:", "?start=0", false); $strSources = preg_replace('/\s+/', '', $strSources); $strSources = str_replace("{url:'", '', $strSources); $strSources = base64_encode($strSources); */ $strSources = ''; break; case 'server1': //$strSources = getStringBetween($playerSource, "file: '", "',", false); //$strSources = base64_encode($strSources); $strSources = ''; break; default: break; } return $strSources; }
function convetHandPtReg($file_path, $id_player, $nick_original) { $array_nickname = $this->All_model->getallnickname(); $file_read = file_get_contents($file_path); //echo $file_read; $new_file = ""; $date_old = ""; $qtd_hand = 0; if (strpos($file_read, "PokerStars") !== false) { $p = true; $hand_old = false; $arr_file_read = explode("PokerStars", $file_read); //echo count($arr_file_read).' '; //print_r($arr_file_read); //ok ate aqui tenho hands for ($m = 1; $m < count($arr_file_read); $m++) { $num_hand = 0; //echo $arr_file_read[$m].' '; //echo $m; if ($arr_file_read[$m] != "") { if (strpos($arr_file_read[$m], "Seat 9") === false) { //vou ler a primeira linha só //echo $arr_file_read[$m]. ' '; $str = strtok($arr_file_read[$m], "\r\n"); //echo $str.' '; if (strpos($str, "Hold'em No Limit") !== false) { //limit hand //NLxx if ($p) { $limit = getStringBetween($str, "(", ")"); $limit = str_replace(chr(0xe2) . chr(0x82) . chr(0xac), "", $limit); $limit = str_replace(chr(128), '', $limit); $limit = str_replace("EUR", "", $limit); $limit = str_replace(" ", "", $limit); //echo $limit.' '; $limit = findlimithand($limit); //echo $limit; //id limit DB $limit_temp = $this->All_model->getlimitbyname($limit); $limit_final = $limit_temp->id_limit; } //data $date_new = str_replace("/", "-", getStringBetween($str, "- ", " ")); //só vou guardar 1 ano de hands //echo $date_new.' '; //echo strtotime($date_new).' '; //echo strtotime("now -1 year").' '; if (strtotime($date_new) > strtotime("now -1 year")) { //numero da hand $num_hand = getStringBetween($str, "#", ":"); //meter na DB $sql_data = array('numhands' => $num_hand, 'playerHH' => $id_player); $result = $this->All_model->inserthandPtReg($sql_data, $num_hand); if (!$result) { log_message('error', 'Não conseguiu inserir a hand na DB ou duplicate'); } else { //alterar o nick do player $new_nick = $array_nickname[rand(0, 299)]; $new_hand = str_replace($nick_original, $new_nick, $arr_file_read[$m]); //Criar o novo string da hand e meter na varíavel $new_file .= "PokerStars" . $new_hand; //echo $new_file; $qtd_hand++; } } else { //echo 'aaaaaa'; $hand_old = true; } $p = false; } else { //echo 'bbbbbbbbb'; $hand_old = true; } } else { $hand_old = true; } } if ($hand_old) { break; } } //echo $new_file; //acabei de ler o ficheiro //meter na DB (TBL_QTDHANDS e TBL_FILECONVERT) + na pasta de partilha para os gajos //TBL_QTDHANDS //antes de inserir ver se já existe algo do género na DB if (!$hand_old && $new_file != "") { $array_numhand = $this->All_model->numhands($id_player, $limit_final, $date_new); if ($array_numhand) { //update $new_numhand = $array_numhand[0] + $qtd_hand; $sql_data = array('id_player' => $id_player, 'id_limit' => $limit_final, 'date' => $date_new, 'qtd' => $new_numhand); $result = $this->All_model->updatenumhands($sql_data, $array_numhand[1]); if (!$result) { log_message('error', 'Não conseguiu fazer o update de num hands (workfiles linha 274'); } } else { //insert $sql_data = array('id_player' => $id_player, 'id_limit' => $limit_final, 'date' => $date_new, 'qtd' => $qtd_hand); $result = $this->All_model->insertnumhands($sql_data); if (!$result) { log_message('error', 'Não conseguiu inserir o numero de hands (workfiles linha 287'); } } //TBL_FILECONVERT $today = todaysplit(); //criar a pasta caso não existe if (!file_exists(VAR_PATHCONVERTED_PT_SH . "/" . $limit)) { mkdir(VAR_PATHCONVERTED_PT_SH . "/" . $limit, 0777, true); } if (!file_exists(VAR_PATHCONVERTED_PT_SH . "/" . $limit . "/" . $today[0])) { mkdir(VAR_PATHCONVERTED_PT_SH . "/" . $limit . "/" . $today[0], 0777, true); } if (!file_exists(VAR_PATHCONVERTED_PT_SH . "/" . $limit . "/" . $today[0] . "/" . $today[1])) { mkdir(VAR_PATHCONVERTED_PT_SH . "/" . $limit . "/" . $today[0] . "/" . $today[1], 0777, true); } if (!file_exists(VAR_PATHCONVERTED_PT_SH . "/" . $limit . "/" . $today[0] . "/" . $today[1] . "/" . $today[2])) { mkdir(VAR_PATHCONVERTED_PT_SH . "/" . $limit . "/" . $today[0] . "/" . $today[1] . "/" . $today[2], 0777, true); } //criar o ficheiro de hands $namefile = $this->All_model->getlastnamefile($limit_final, $today[0], $today[1], $today[2]); $myfile = fopen(VAR_PATHCONVERTED_PT_SH . "/" . $limit . "/" . $today[0] . "/" . $today[1] . "/" . $today[2] . "/" . $namefile . ".txt", "w"); fwrite($myfile, $new_file); fclose($myfile); //meter na DB $sql_data = array('num_hands' => $qtd_hand, 'id_limit' => $limit_final, 'year' => $today[0], 'month' => $today[1], 'day' => $today[2], 'namefile' => $namefile, 'room' => 'PT', 'type' => 'SH', 'id_player' => $id_player); $result = $this->All_model->insertfileshands($sql_data); if (!$result) { log_message('error', 'Não conseguiu inserir o numnero do ficheiro (workfiles linha 287'); } } //exec ("chmod 777 -R ".VAR_PATHCONVERTED); } }
$end = (new DateTime($year . '-12-31'))->modify('last day of this month'); } else { $start = (new DateTime($syear . '-' . $smonth . '-01'))->modify('first day of this month'); $end = (new DateTime($year . '-' . $month . '-31'))->modify('last day of this month'); } $interval = DateInterval::createFromDateString('1 month'); $period = new DatePeriod($start, $interval, $end); $head = array("Breeds Name"); foreach ($period as $dt) { array_push($head, $dt->format("F") . " " . $dt->format("Y")); } fputcsv($output, $head); $breedsres = $con->query("SELECT * FROM dog_breeds ORDER BY breeds_id"); while ($breeds = $breedsres->fetch_assoc()) { $breeds_id = $breeds["breeds_id"]; $inneroutput = array(getStringBetween($breeds["breeds_name"])); foreach ($period as $dt) { $year = $dt->format("Y"); $month = $dt->format("n"); $findcount = $con->query("SELECT count(donate.donate_id) FROM donate " . "JOIN user_dog ON donate.dog_id = user_dog.dog_id " . "WHERE user_dog.breeds_id = '{$breeds_id}' " . "AND YEAR(donate.donate_date) = '{$year}' " . "AND MONTH(donate.donate_date) = '{$month}' " . "AND donate.donate_status IN(1,2) "); if ($findcount->num_rows > 0) { $count = $findcount->fetch_array(); array_push($inneroutput, $count[0]); } else { array_push($inneroutput, 0); } } fputcsv($output, $inneroutput); } function getStringBetween($str, $from = "(", $to = ")") {
function PhotoManager() { $Array = array(); $Proprétaire = "rien-"; $Fichier = "../BD/photoManager.txt"; if ($PHOTO = file_get_contents($Fichier)) { $handle = fopen("../BD/photoManager.txt", 'r'); if ($handle) { while (($line = fgets($handle)) !== false) { $Array[] = $line; } fclose($handle); } } $findWho = false; for ($i = 0; $i < count($Array) && !$findWho; $i++) { if (!$findWho && $_SESSION['connected'] == substr($Array[$i], 0, strpos($Array[$i], '/')) && $_SESSION['imageSelect'] == "../images/" . getStringBetween($Array[$i], '_', '¯')) { $Proprétaire = substr($Array[$i], 0, strpos($Array[$i], '/')); $findWho = true; } } return $Proprétaire; }
$userprofile2 = $html2->find('div[id=user-profile-left]', 0); $name2 = $userprofile2->find('h3', 0); $username2 = $userprofile2->find('h4', 0); $country2 = $userprofile2->find('p', 0); $joiningtime2 = $userprofile2->find('p', 1); $worldrank2 = $userprofile2->find('p', 2); $institution2 = $userprofile2->find('p', 3); $thought2 = $userprofile2->find('p', 4); $profilepic2 = $userprofile2->find('img', 0); $value2 = $profilepic2->src; $userstats2 = $html2->find('dl', 0); $probcount2 = $userstats2->find('dd', 0)->plaintext; $subcount2 = $userstats2->find('dd', 1)->plaintext; $probtable2 = $html2->find('table[class=table table-condensed]', 0); $rank_string2 = $worldrank2->plaintext; $rank_val2 = getStringBetween($rank_string2, $from, $to); //Rank of coder2 $rank_total = $rank_val1 + $rank_val2; //Total of rank of coder1 and coder2 $rank_percent1 = ROUND($rank_val1 * 100 / $rank_total); $rank_percent2 = ROUND($rank_val2 * 100 / $rank_total); $prob_total = $probcount1 + $probcount2; //Total of problem count of both coders $prob_percent1 = ROUND($probcount1 * 100 / $prob_total); $prob_percent2 = ROUND($probcount2 * 100 / $prob_total); $sub_total = $subcount1 + $subcount2; $sub_percent1 = ROUND($subcount1 * 100 / $sub_total); $sub_percent2 = ROUND($subcount2 * 100 / $sub_total); ?> </div> </div>
$sub2 = substr($dpname2, strpos($dpname2, $from2) + strlen($from2), strlen($dpname2)); return substr($sub2, 0, strpos($sub2, $to2)); } $NAME2 = getStringBetween1($dpname2, $from2, $to2); /* Code for separating MPID from Expression Viewer */ $str = $_POST['txt']; $from = "~"; $to = "!"; function getStringBetween($str, $from, $to) { $sub = substr($str, strpos($str, $from) + strlen($from), strlen($str)); return substr($sub, 0, strpos($sub, $to)); } $x = 1; do { $result1 = getStringBetween($str, $from, $to); $result2 = str_replace($result1, "", $str); $str = str_replace("~!", "", $result2); $x++; } while ($x <= 50); $area2 = $str; //echo $modelid;echo $ST;echo $frequency;echo $area2; //Code for Inserting All above parsed data into Expression Table $sql = 'INSERT INTO HISTORIZATION.ANALYTICAL_EXPRESSION(`ID`,`START_TIME`,`FREQUENCY`,`FORMULA`) VALUES ("' . $modelid . '","' . $ST . '","' . $frequency . '","' . $area2 . '")'; $retval = mysql_query($sql, $conn); if (!$retval) { die('Could not enter data: ' . mysql_error()); } //create csv $f = fopen("DumpData/expression.csv", 'w'); $get = mysql_query("SELECT * FROM HISTORIZATION.ANALYTICAL_EXPRESSION") or die(mysql_error());
$lon = (double) $_GET['lon']; } if (isset($_GET['rad'])) { $_GET['rad'] = str_replace(',', '.', $_GET['rad']); $rad = (double) $_GET['rad']; } if (!file_exists($page . '.html')) { $page = '404'; } $hfile = file_get_contents($page . '.html'); $title = getStringBetween($hfile, '<title>', '</title>'); if ($title == '') { $title = '3WiFi: Свободная база точек доступа'; } $head = getStringBetween($hfile, '<head>', '</head>'); $content = getStringBetween($hfile, '<body>', '</body>'); $content = str_replace('%content%', $content, file_get_contents('index.html')); $content = str_replace('%title%', $title, $content); $content = str_replace('%head%', $head, $content); $mb = 'menubtn'; $mbs = $mb . ' mbsel'; $content = str_replace('%chk_docs%', $page == 'home' || $page == 'faq' || $page == 'apidoc' || $page == 'rules' ? $mbs : $mb, $content); $content = str_replace('%chk_map%', $page == 'map' ? $mbs : $mb, $content); $content = str_replace('%chk_find%', $page == 'find' ? $mbs : $mb, $content); $content = str_replace('%chk_tool%', $page == 'ranges' || $page == 'devmac' || $page == 'wpspin' ? $mbs : $mb, $content); $content = str_replace('%chk_load%', $page == 'upload' ? $mbs : $mb, $content); $content = str_replace('%chk_st%', $page == 'stat' || $page == 'graph' ? $mbs : $mb, $content); $content = str_replace('%chk_user%', $page == 'user' ? $mbs : $mb, $content); $sm = 'submbtn'; $sms = $sm . ' smsel'; $content = str_replace('%chk_home%', $page == 'home' ? $sms : $sm, $content);
function getStringBetween($str, $from, $to) { $sub = substr($str, strpos($str, $from) + strlen($from), strlen($str)); return substr($sub, 0, strpos($sub, $to)); } $str = $time; $str = str_replace("P", "", $str); $from = "T"; $to = "H"; $hours = getStringBetween($str, $from, $to); $from = "H"; $to = "M"; $mins = getStringBetween($str, $from, $to); $from = "M"; $to = "S"; $secs = getStringBetween($str, $from, $to); $hours = $hours * 3600; $mins = $mins * 60; $total = $hours + $mins + $secs; /* $match_arr = array ( "title"=>"/<meta name=\"title\" content=\"(.*)\">/", "description"=>"/<meta name=\"description\" content=\"(.*)\">/", "tags" =>"/<meta name=\"keywords\" content=\"(.*)\">/", "embed_code" => "/<meta name=\"keywords\" content=\"(.*)\">/", "duration" => "/<span class=\"video-time\">([0-9\:]+)<\/span>/" ); $vid_array = array(); foreach($match_arr as $title=> $match)