Subversion Repositories cheapmusic

Rev

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