function getHtml($ID) { $viewstate = ""; $eventvalidation = ""; $previouspage = ""; $id = checkinput(intval($ID), 255); $first = getn($viewstate, $eventvalidation, $id); preg_match('/<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="(.+?)"/is', $first, $matches); $viewstate = $matches[1]; preg_match('/<input type="hidden" name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="(.+?)"/is', $first, $matches); $eventvalidation = $matches[1]; preg_match('/<input type="hidden" name="__PREVIOUSPAGE" id="__PREVIOUSPAGE" value="(.+?)"/is', $first, $matches); $previouspage = $matches[1]; $result = getn($viewstate, $eventvalidation, $previouspage, $id); preg_match('/<table cellspacing="1" cellpadding="2" border="0" id="ctl00_ContentPlaceHolder2_HAWBSerachControl1_GridView2" width="100%">(.+?)<\\/table>/is', $result, $catch); $one = $catch[0]; preg_match_all('/<tr align="center"(.+?)<\\/tr>/is', $one, $last); $size = count($last[0]) - 1; preg_match_all('/<font color="#333333">(.+?)<\\/font></is', $last[0][$size], $detail); $two = "目前狀態: " . $detail[1][1] . " " . $detail[1][2]; return array($one, $two); }
<?php require $_SERVER['DOCUMENT_ROOT'] . '/_/inc/init.php'; $query = $db->query('UPDATE Prestamos SET FechaDevuelto = NOW() Where idPrestamo = "' . checkinput($_GET["idPrestamo"]) . '"'); if ($query) { echo 'Contenido devuelto correctamente'; } else { echo ':('; }
<?php //phpinfo(); header("Content-Type: text/json"); error_reporting(E_ALL); ini_set('display_errors', '1'); include "util.php"; $username = checkinput('username'); $token = checkinput('device_token'); $apip = validate_sentinel($token); $dsn = "mysql:host=" . gethostbyname('mysql') . ";port=3306;dbname=wifi_sentinel;charset=utf8"; $usr = '******'; $pwd = 'admin123'; try { $db = new PDO($dsn, $usr, $pwd); } catch (PDOException $e) { die('Connection failed: ' . $e->getMessage()); } $result = $db->query("SELECT COUNT(*) FROM sentinels WHERE device_token='{$token}'"); if ($result) { $num = $result->fetchColumn(); } else { echo "\nPDO::errorInfo():\n"; print_r($db->errorInfo()); $num = 0; } if ($num <= 0) { echo json_encode(array('status' => 'invalid_token')); exit; } $db = NULL;
<?php //phpinfo(); header("Content-Type: text/json"); error_reporting(E_ALL); ini_set('display_errors', '1'); include "util.php"; $username = checkinput('username'); $token = checkinput('device_token'); $expiry = checkinput('expiry'); $apip = validate_sentinel($token); $dsn = "mysql:host=" . gethostbyname('mysql') . ";port=3306;dbname=wifi_sentinel;charset=utf8"; $usr = '******'; $pwd = 'admin123'; try { $db = new PDO($dsn, $usr, $pwd); } catch (PDOException $e) { die('Connection failed: ' . $e->getMessage()); } $result = $db->query("SELECT COUNT(*) FROM sentinels WHERE device_token='{$token}'"); if ($result) { $num = $result->fetchColumn(); } else { echo "\nPDO::errorInfo():\n"; print_r($db->errorInfo()); $num = 0; } if ($num <= 0) { echo json_encode(array('status' => 'invalid_token')); exit; }
<?php require_once "config.inc.php"; include 'sc/lib/spider.inc.php'; $word = ""; $one = ""; if ($_GET['id']) { $id = checkinput(intval($_GET['id']), 255); $word = 'The id you sent: ' . $id; getHtml($id); $one = getHtml($id)[0]; } ?> <!DOCTYPE html> <html lang="zh-TW"> <head> <meta charset="UTF-8"> <title>PHP_crawler</title> <style> body {font-size: 14px;} </style> </head> <body> <h3><?php echo $word; ?> </h3> <p><?php echo $one; ?> </p><p></p>
if ($action == $ACTION_IN_DELETE) { $sql = "DELETE FROM `sentinels` WHERE device_token='{$device_token}'"; if (!$db->query($sql)) { echo "\nPDO::errorInfo():\n"; print_r($db->errorInfo()); echo $sql; } else { echo json_encode(array("status" => "success", "action" => $ACTION_IN_DELETE, "message" => "you are now unregistered")); //64.71.255.204 $db = NULL; exit; } } else { if ($action == $ACTION_IN_CREATE) { $apip = checkinput('apip'); $appdebug = checkinput('debug'); // fixup internal network AP if ($apip == $tg_server_ip) { $apip = $apip_internal; } // it will either be a completely new sentinel // or an additional sentinel on the same public IP // NOTE: multiple APs will appear as the same public IP $stmt = $db->query("SELECT * FROM sentinels WHERE apip='{$apip}' ORDER BY port"); if (!$stmt) { echo "\nPDO::errorInfo():\n"; print_r($db->errorInfo()); echo $sql; exit; } if ($stmt->rowCount() > 0) {