コード例 #1
0
ファイル: index.php プロジェクト: ankerbon/capritools
<?php

include "posdscan.class.php";
include "functions.php";
saveHit();
if (isset($_POST['dscan'])) {
    $dscan = $_POST['dscan'];
    $objects = parseDscan($dscan);
    $key = saveDscan($objects);
    //Save to file
    file_put_contents("scans/" . $key, $dscan);
    header('Location: /dscan/' . $key);
    //print_r($objects);
}
?>
<head>
	<meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="description" content="">
    <meta name="author" content="">

	<!-- Latest compiled and minified CSS -->
	<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
	<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
	<?php 
include "../switcher.php";
?>
	<link rel="stylesheet" href="/dscan/css/custom.css">
	<!-- Optional theme -->
	<!-- Latest compiled and minified JavaScript -->
コード例 #2
0
ファイル: reparse.php プロジェクト: l0ser140/capritools
<?php

include "functions.php";
$list = getDscanList();
//Connect MySQL
include "config.php";
$db = new PDO('mysql:host=' . $mysql_host . ';dbname=' . $mysql_db . ';charset=utf8', $mysql_user, $mysql_pass);
foreach ($list as $scan) {
    $raw = file_get_contents("scans/" . $scan['key']);
    $dscan = parseDscan($raw);
    echo $scan['key'] . "... ";
    //Build SQL for object dump
    $sql = "INSERT INTO dscanObjects(`scan`, `name`, `type`, `distance`) VALUES ";
    for ($i = 0; $i < count($dscan); $i++) {
        $sql .= "(:" . $i . "scan, :" . $i . "name, :" . $i . "type, :" . $i . "distance),";
    }
    $sql = rtrim($sql, ",");
    $st = $db->prepare($sql);
    //Bind values
    for ($i = 0; $i < count($dscan); $i++) {
        $st->bindValue(":" . $i . "scan", $scan['id'], PDO::PARAM_INT);
        $st->bindValue(":" . $i . "name", $dscan[$i]['name'], PDO::PARAM_STR);
        $st->bindValue(":" . $i . "type", $dscan[$i]['type'], PDO::PARAM_STR);
        $st->bindValue(":" . $i . "distance", $dscan[$i]['distance'], PDO::PARAM_INT);
    }
    //Execute the dump
    $st->execute();
    echo " Done!\n";
}