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