Subversion Repositories cheapmusic

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
98 - 1
<?php
2
function clean_input($data) {
3
  $data = trim($data);
4
  $data = stripslashes($data);
5
  $data = htmlspecialchars($data);
6
  return $data;
7
}
8
 
9
include_once ($_SERVER['DOCUMENT_ROOT'] . "/php/dnsexit.php");
114 - 10
include_once ($_SERVER['DOCUMENT_ROOT'] . "/php/tools.php");
98 - 11
 
12
error_reporting(E_ALL);
13
 
14
$startDate = date_create();
15
date_add($startDate,date_interval_create_from_date_string("-14 days"));
16
$endDate = date_create();
17
$width = 1024;
18
$height = 600;
19
$uniqueIP = false;
20
$chartType = "bars";
21
 
22
 
23
if ($_SERVER["REQUEST_METHOD"] == "POST") {
24
    if (!empty($_POST['startDate'])) {
25
        $startDate = date_create(clean_input($_POST['startDate']));
26
    }
27
    if (!empty($_POST['endDate'])) {
28
        $endDate = date_create(clean_input($_POST['endDate']));
29
    }
30
    if (!empty($_POST['width'])) {
31
        $width = clean_input($_POST['width']);
32
    }
33
    if (!empty($_POST['height'])) {
34
        $height = clean_input($_POST['height']);
35
    }
36
    if (isset($_POST['unique'])) {
37
        $uniqueIP = true;
38
    }
39
    if (!empty($_POST['type'])) {
40
        $chartType = clean_input($_POST['type']);
41
    }
42
}
43
?>
44
<!DOCTYPE html>
45
<html lang="en-US">
46
<head>
47
    <title>Find Cheap Music: Searches and Transfers</title>
48
    <?php include_once ($_SERVER['DOCUMENT_ROOT'] . "/php/header.php"); ?>
49
</head>
50
<body>
51
 
52
    <form method="post" action="/report.php">
53
        <nav class="navbar navbar-expand-sm bg-black navbar-dark fixed-top">
54
            <div class="navbar-header">
55
                <button type="submit" name="submit" value="Search" class="btn text-white">Find Cheap Music</button>
56
            </div>
57
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#collapsibleNavbar">
58
                <span class="navbar-toggler-icon"></span>
59
            </button>
60
        </nav>
61
    </form>
62
 
63
    <form method="post" action="/report.php">
64
<div class="mt-2">
65
<label class="mr-2" for="startDate">Start Date: </label><input name="startDate" type="date" value="<?php echo date_format($startDate,"Y-m-d"); ?>"/>
66
<label class="mx-2" for="endDate">End Date: </label><input name="endDate" type="date" value="<?php echo  date_format($endDate,"Y-m-d"); ?>"/>
67
</div>
68
 <div class="mt-2">
69
  <label class="mr-2" for="type">Select Chart Type:</label>
70
  <select name="type">
71
    <option <?php if ($chartType == "bars") echo "selected";?>>bars</option>
72
    <option <?php if ($chartType == "area") echo "selected";?>>area</option>
73
    <option <?php if ($chartType == "linepoints") echo "selected";?>>linepoints</option>
74
    <option <?php if ($chartType == "liones") echo "selected";?>>lines</option>
75
    <option <?php if ($chartType == "pie") echo "selected";?>>pie</option>
76
    <option <?php if ($chartType == "points") echo "selected";?>>points</option>
77
    <option <?php if ($chartType == "squared") echo "selected";?>>squared</option>
78
    <option <?php if ($chartType == "squaredarea") echo "selected";?>>squaredarea</option>
79
    <option <?php if ($chartType == "stackedarea") echo "selected";?>>stackedarea</option>
80
    <option <?php if ($chartType == "stackedbars") echo "selected";?>>stackedbars</option>
81
    <option <?php if ($chartType == "stackedsquaredarea") echo "selected";?>>stackedsquaredarea</option>
82
    <option <?php if ($chartType == "thinbarline") echo "selected";?>>thinbarline</option>
83
  </select>
84
</div>
85
<div class="form-check mt-2"">
86
  <label class="form-check-label">
87
    <input type="checkbox" name="unique" class="form-check-input" value="" <?php if ($uniqueIP) echo 'checked';?>>Unique IP
88
  </label>
89
</div>
90
 
91
<div class="mt-2">
92
<label class="mr-2" for="width">Width: </label><input name="width" type="number" value="<?php echo $width;?>"/>
93
<label class="mx-2" for="height">Height: </label><input name="height" type="number" value="<?php echo $height;?>"/>
94
</div>
95
<div class="mt-2">
96
<input type="submit" name="submit" value="Submit">
97
</div>
98
    </form>
99
 
100
<hr>
101
 
102
<?php
103
    if ($_SERVER["REQUEST_METHOD"] == "POST") {
104
        //echo "<pre>"; print_r($_POST); echo "</pre>";
105
        $params = "start=" . date_format($startDate,"Ymd");
106
        $params .= "&end=" . date_format($endDate,"Ymd");
107
        $params .= "&width=" . $width;
108
        $params .= "&height=" . $height;
109
        $params .= "&type=" . $chartType;
110
        $params .= "&unique=" . ($uniqueIP ? "1" : "0");
111
        echo '<img  class="mx-auto d-block img-fluid" src="/plotimage.php?' . $params . '" alt="Searches and Transfers Image">';
112
    }
113
?>
114
    <footer class="container-fluid text-center bg-primary py-5">
115
        <p>Copyright &#169; <?php echo @date("Y"); ?> FindCheapMusic.com. All rights reserved.</p>
116
    </footer>
117
 
114 - 118
    <?php include_once ($_SERVER['DOCUMENT_ROOT'] . "/php/downloadAtOnload.php"); ?>
119
 
98 - 120
</body>
121
</html>