function DoubleURL(DB_Class $db_checker, $url_table, array $url, $num, array $page_list, array $id_name) { $count = 0; while ($count < $num) { // Проверка очередного уровня url-запроса $id = $count == 1 ? checkURL($db_checker, $url_table, $url[$count]) : checkURL($db_checker, "folder_ref", $url[$count]); if (!$id && $count != 0) { $page = $page_list[$count - 1]; break; } else { $page = $page_list[$count]; $_SESSION["id"][$id_name[$count]] = $id; } $count++; } return $page; }
<?php require 'includes/functions.php'; include 'includes/header.php'; if ($_GET['download']) { // Zip File Name + Path Configuration $imagePath = "bebo_downloads/"; $zipPath = "zips/"; $salt = rand(9000000000, 9999999999); $zip_name = $zipPath . $salt . "_bebo_pictures.zip"; // Split out text input to seperate lines $urlArray = explode("\n", $_POST['lines']); $urlOutcome = checkURL($urlArray); if ($urlOutcome == FALSE) { // Pull images from POST into Array then generate zip file $new_pics = savePics($urlArray, $imagePath); $result = create_zip($new_pics, $zip_name); // Display success / fail message if ($result) { echo "<h1>Success!</h1>\n\t\t\t\t\t<div class=\"descr\">Your file is ready to be downloaded!</div>\n\t\t\t\t\t<p>Go <a href=\"download_images.php?filename=" . $salt . "_bebo_pictures.zip\">here</a> to retrieve it.<br /><br /><b>Note:</b> Once you have downloaded your file, it will be removed from our server immediately for security reasons. If you need to download it again please repeat the process.</p>"; } else { echo "Hmm, something didn't work quite right! Please report it to johnathan [at] weleasewodewick.com"; } // Tidy up pictures deletePics($new_pics); } else { echo "<h1>Error! :o(</h1>\n\t\t\t\t\t <div class=\"descr\">Problem with your URLs</div>\n\t\t\t\t\t <p>Oops ... one of your URL's doesn't look like a bebo.com address. Try copying and pasting from the Bebo App again. Or, if you think this is an error, email what you pasted to johnathan [at] weleasewodewick.com"; } } else { // display form to kick off the process echo "<h1>Process your images</h1>\n\t\t\t\t<div class=\"descr\">Just paste the lines of URL's into the box below, and click submit!</div>\n\t\t\t\t\t<p><b>Note:</b> This script will connect to Bebo's servers and download all the images that you specify - if you put in dozens/hundreds of pictures, expect it to take a few minutes to complete. If the page/script gives you a timeout error, consider doing half, or even quarter of your list at a time</p>\n\t\t\t\t\t<p><font color=\"#FF0000\">300 lines of images generally = a 1-3 minute download time. Zip file size of 13-15MB. In our tests 300+ images equals timeouts.</font></p>\n\t\t\t\t<form action=\"get_images.php?download=yes\" method=\"post\">\n\t\t\t\t<textarea cols=\"65\" rows=\"8\" name=\"lines\"></textarea><br />\n\t\t\t\t<input type=\"submit\">\n\t\t\t";
$paramarray = array(); for ($i = 0; $i < count($matches[1]); $i++) { $key = $matches[1][$i]; $val = $matches[3][$i] ? $matches[3][$i] : ($matches[4][$i] ? $matches[4][$i] : $matches[5][$i]); $paramarray[$key] = $val; } } return $paramarray; } //Parse description. Description in format: [desc img="imagename" url="link"]Description goes here[/desc] $descriptionArray = parseDescNew($description); if (!count($descriptionArray)) { $descriptionArray = parseDescOld($description); } } $folder = checkURL($folder); if (!$folder) { echo "This folder doesn't exsits."; } else { if (trim($setimagearray) != "") { $images = explode(",", $setimagearray); } else { $images = getFileInDir($folder, $orderby, $sort); } if (count($images) > 0) { $imgcount = 0; $firstImage = ''; $transDetails = ''; $captionDetails = ''; $imageArray = array(); $captionArray = array();
*/ $url = "http://rhylton.com.br"; //Adicionar URL do site $texto = "contato"; //Sring no qual você quer verificar Ex: "<!DOCTYPE html>" - src="social.png" $curl = curl_init($url); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); $buscaUrl = curl_exec($curl); $textoUrl = strpos($buscaUrl, $texto); function checkURL() { global $buscaUrl; if ($buscaUrl == false) { $resultURL = "URL INVALIDO!!!"; } else { $resultURL = "URL VALIDO!!"; } return $resultURL; } function checkTXT() { global $textoUrl; if ($textoUrl == false) { $resultTXT = "Essa string não existe :'("; } else { $resultTXT = "String OK :)"; } return $resultTXT; } echo "URL: " . checkURL() . "<br />" . "TEXTO: " . checkTXT();
/** * @param $value * @param $field_check * @param $field_name * @return string */ protected function checkValue($value, $field_check, $field_name) { $callback = $this->getMessageCallback(); $e = ""; if ($e == "" && preg_match("/e/", $field_check)) { if (isset($value) == false || $value == "") { $e = $callback("empty", $field_name, $value); } } if ($e == "" && preg_match("/i/", $field_check)) { if ($value != "" && is_numeric($value) == false) { $e = $callback("int", $field_name, $value); } } if ($e == "" && preg_match("/a/", $field_check)) { if ($value != "" && preg_match("/^([0-9a-zA-Z\\.]+)\$/", $value) == false) { $e = $callback("alphabet", $field_name, $value); } } if ($e == "" && preg_match("/m/", $field_check)) { if ($value != "" && checkMail($value) == false) { $e = $callback("mail", $field_name, $value); } } if ($e == "" && preg_match("/u/", $field_check)) { if ($value != "" && checkURL($value) == false) { $e = $callback("url", $field_name, $value); } } return $e; }
return "404"; } } require_once "header.php"; //Decodifica a URL de Entrada. $url = parse_url("http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); $decode_path = explode("/", $url["path"]); //Valida se o user entrou com uma URI válida. //REGRAS: //A URI deve ter apenas um nível (exemplo: /home/user é inválido). //A pagina deve estar compreendida na relação de redirects da aplicação. //O arquivo com o conteúdo da pagina deve existir. if (count($decode_path) > 2) { $route = "404"; } else { $route = checkURL($decode_path[1]); } //Conecta ao banco de dados. $conn = conectdb(); //Busca o conteúdo a ser carregado na página. $sql = "Select title, text from content where route = :route"; $stmt = $conn->prepare($sql); $stmt->bindValue(':route', $route); if ($stmt->execute()) { $content = $stmt->fetch(PDO::FETCH_ASSOC); } else { echo "Conteúdo não encontrado!"; } ?> <div class="page-header">
{ $url_replace = substr($replacement_url, 0, 7) == 'http://' ? $replacement_url : 'http://' . $replacement_url; } // IF NOT SUBMITTED if((!$_POST['submit_urls'] || ($_POST['submit_urls'] && (!checkURL($url_pattern) || !checkURL($url_replace)))) && (!$_POST['submit_confirm'] || ($_POST['submit_confirm'] && !$_POST['confirm']))): ?> <h2>Step 1: Setup...</h2> <?php if($_POST['submit_urls'] && !checkURL($url_pattern)): ?> <div class="error">Your current URL (<?php echo $url_pattern ?>) is not a valid URL.</div> <?php endif; ?> <?php if($_POST['submit_urls'] && !checkURL($url_replace)): ?> <div class="error">Your current URL (<?php echo $url_replace ?>) is not a valid URL.</div> <?php endif; ?> <p>Enter the URL location of your current install, and the URL location of your new install.</p> <form id="url_form" action="<?php $_SERVER['PHP_SELF']; ?>" method="POST"> <ul> <li> <label for="url_pattern">Your current URL</label> <input type="text" id="url_pattern" name="url_pattern" value="<?php echo $url_pattern; ?>" /> </li> <li> <label for="url_replace">Your replacement(new) URL</label> <input type="text" id="url_replace" name="url_replace" value="<?php echo $url_replace; ?>" />
$ws_params = json_decode(file_get_contents("./params.json"), true); $ws_name = isset($_GET["ws_name"]) ? $_GET["ws_name"] : "api.navitia.io"; if ($ws_name == "undefined") { $ws_name = "api.navitia.io"; } $ress = isset($_GET["ress"]) ? $_GET["ress"] : ""; $ress = checkURL($ress); //on ajoute les autres paramètres qui sont séparés par des "&" foreach ($_GET as $k => $v) { if ($k != "ress" && $k != "ws_name") { if (is_array($v)) { foreach ($v as $array_item) { $ress .= "&" . $k . "[]=" . checkURL($array_item); } } else { $ress .= "&" . $k . "=" . checkURL($v); } } } if (strpos($ress, 'tyr') === 0) { $url = $ws_params["environnements"][$ws_name]["tyr"] . explode("/", $ress)[1]; $key = ""; if ($url == "") { //tyr n'est pas disponible sur cet environnement header("Content-Type: application/json"); echo "{\"error\": \"No tyr URL available\"}"; exit; } } else { $url = $ws_params["environnements"][$ws_name]["url"] . $ress; $key = $ws_params["environnements"][$ws_name]["key"];
} else { return "404"; } } require_once "header.php"; //Decodifica a URL de Entrada. $url = parse_url("http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); $decode_path = explode("/", $url["path"]); //Valida se o user entrou com uma URI válida. //REGRAS: //A URI deve ter apenas um nível (exemplo: /home/user é inválido). //A pagina deve estar compreendida na relação de redirects da aplicação. //O arquivo com o conteúdo da pagina deve existir. if (count($decode_path) > 2) { $pagina = "404"; } else { $pagina = checkURL($decode_path[1]); } ?> <div class="page-header"> <h1> <?php echo strtoupper($pagina); ?> </h1> </div> <?php require_once $pagina . ".php"; require_once "footer.php";