-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunction.sql.php
More file actions
25 lines (21 loc) · 901 Bytes
/
function.sql.php
File metadata and controls
25 lines (21 loc) · 901 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
<?php
function statistic_insert($filename, $author)
{
$query = 'INSERT INTO `statistic`(`key`, `filename`, `authorname`) VALUES ("' . md5($filename) . '","' . $filename . '","' . $author . '")';
$result = mysql_query($query) or die("Invalid query: " . mysql_error());
return $result;
}
function statistic_read($page)
{
$itemsPerPage = 1000;
$offset = ($page - 1) * $itemsPerPage;
$query = "SELECT *, count(filename) as count FROM `statistic` GROUP BY `key` LIMIT " . $offset . "," . $itemsPerPage;
$result = mysql_query($query) or die("Invalid query: " . mysql_error());
return $result;
}
function commiter_count($key)
{
$query = "SELECT authorname, count(filename) as count FROM `statistic` WHERE `key` = '" . $key . "' GROUP BY `authorname`";
$result = mysql_query($query) or die("Invalid query: " . mysql_error());
return $result;
}