<?php session_start(); require 'include.php'; $ID = replace_input($_GET['id']); $Query = mysql_query("Select `Page`,`Time`,`Data`,`Deleted`\n\t\t\t\t\t\tfrom `Pages`\n\t\t\t\t\t\twhere `ID`='{$ID}'\n\t\t\t\t\t\tlimit 1"); list($Page, $Time, $Data, $Deleted) = mysql_fetch_array($Query); if ($Time and !$Deleted) { echo replace_output($Data); }
function run($func, array $structure, array $input) { global $conditions; /* * Run any child regular expressions */ if (!empty($func->childRegExes)) { foreach ($func->childRegExes as $regExp) { $input = run($regExp, $structure, $input); } # foreach } # if if ($func instanceof ScraperDto) { $tmpInput = array(1 => $input[1]); foreach ($func->regExpList as $regExp) { echo 'Running nested RegExp ...: ' . PHP_EOL; $tmpInput = run($regExp, $structure, $tmpInput); } # foreach $input = saveDest($input, $tmpInput[$func->dest], $func->dest); } else { /* * We are still not actually scraping, but * we are asked to run a function .. */ if (!empty($func->out_func)) { /* * We want a new buffer array, because buffers for * functions are local */ $newInput = array(1 => $input[1]); $input = run($structure[$func->out_func], $structure, $input); $func->output = str_replace(chr(3), $input[$func->dest], $func->output); } # if /* * Actually run the regular expression */ $pattern = '%' . (string) $func->expr_regex . '%s'; $tmpInput = replace_input((string) $func->input, $input); $tmpOutput = $func->output; $output = ''; if (preg_match_all($pattern, $tmpInput, $matches, PREG_SET_ORDER) > 0) { if ($func->expr_repeat) { foreach ($matches as $match) { $blahTmp = $tmpOutput; foreach ($match as $matchKey => $matchVal) { $blahTmp = str_replace('\\' . $matchKey, $matchVal, $blahTmp); } # foreach $output .= $blahTmp; } # foreach } else { $blahTmp = $tmpOutput; foreach ($matches[0] as $matchKey => $matchVal) { echo '\\' . $matchKey . PHP_EOL; $blahTmp = str_replace('\\' . $matchKey, $matchVal, $blahTmp); } # foreach $output = $blahTmp; } # else $input = saveDest($input, $output, $func->dest); } else { /* * No match was found */ if ($func->expr_clear) { $input = saveDest($input, '', $func->dest); } # if } # else } # else return $input; }
<?php session_start(); require 'include.php'; require 'paginate.php'; if ($_SESSION['Timezone']) { date_default_timezone_set($_SESSION['Timezone']); } $Page = replace_input($_GET['page']); $Query = "Select `ID`,`Time`,`Data`\n\t\t\tfrom `Pages` \n\t\t\twhere `Page`='{$Page}'\n\t\t\tand `Deleted`='0'\n\t\t\torder by `ID`\n\t\t\tdesc"; list($Results, $Links) = Paginate($Query, 25, $_GET['p'], $_SERVER['QUERY_STRING'], 1); if ($Results) { foreach ($Results as $Result) { list($ID, $Time, $Data) = $Result; echo "<div style='clear:both'></div>"; $Toggle++; if ($Toggle % 2 == 1) { echo "<div style='background-color:#140526;'>"; } else { echo "<div>"; } $Time = date("G:i:s T", $Time); echo "<div class='view'><a href='/view.php?id={$ID}'>{$Time}</a></div>"; $PotentialURL = trim(str_replace(array(' ', '<br>', '<', '>'), ' ', $Data)); if (filter_var($PotentialURL, FILTER_VALIDATE_URL)) { $Data = str_replace($PotentialURL, "<a href='{$PotentialURL}' target='_blank'>{$PotentialURL}</a>", $Data); } else { foreach (explode(" ", str_replace(array(' ', '<br>', '<', '>'), ' ', $Data)) as $URL) { if (filter_var($URL, FILTER_VALIDATE_URL)) { $Data = str_replace($URL, "<a href='{$URL}' target='_blank'>{$URL}</a>", $Data); }
<?php # We need a database. # And a user account, for that matter. #mysql_connect... how do you do that again? #die('wat'); session_start(); require 'include.php'; #die("woah"); if (empty($_SESSION['Timezone'])) { # $XML = #simplexml_load_file("http://ipinfodb.com/ip_query.php?ip={$_SERVER['REMOTE_ADDR']}&timezone=true"); # $_SESSION['Timezone'] = (string)$XML->TimezoneName[0]; } # Now what? # I wanna be able to click on the screen to start typing. #die("hi"); $Page = replace_input($_GET['page']); # I should probably get around to changing page to path. # That way derp can be page. # Maybe even revamp the database for more statistical information. $Derp = replace_input($_GET['p']); if (empty($Derp)) { $Derp = 1; } ob_start(); include "nav.php"; $Nav = ob_get_contents(); ob_end_clean(); require 'template.php'; echo Template('template.html');