Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (!mysql_connect('**', '***', '***'))
- die(mysql_errno() . ': ' . mysql_error());
- if (!mysql_select_db('***'))
- die(mysql_errno() . ': ' . mysql_error());
- function db_escape($values, $htmlspecialchars = false) {
- if (is_array($values)) {
- foreach ($values as $key => $value) {
- $values[$key] = db_escape($value, $htmlspecialchars);
- }
- }
- else if ($values === null) {
- $values = '0';
- }
- else if (is_bool($values)) {
- $values = $values ? 1 : 0;
- }
- else if (!is_numeric($values)) {
- $values = mysql_real_escape_string(($htmlspecialchars ? htmlspecialchars($values, ENT_QUOTES) : $values));
- $values = "'" . $values . "'";
- }
- return $values;
- }
- if (!isset($_GET['NES'])) {
- if (isset($_GET['PNG'])) {
- $addLinkToPostReference = 0;
- $showPostOnMouseOverReference = 0;
- $showPostOnMouseOverReferenceLeft = 0;
- $showPostOnMouseOverReferenceMini = 0;
- $improvedQuoteSetting = 0;
- $applyTargetBlank = 0;
- $applyTargetBlankOnlyOutgoing = 0;
- $fixFailTagsSetting = 0;
- $showUrlImages = 0;
- $embedYouTubeUrls = 0;
- $embedYouTubeUrlsNotInQuote = 0;
- $narrowSite = 0;
- //Include phpMyGraph class
- require_once('phpMyGraph5.0.php');
- if (!$query = mysql_query('SELECT * FROM `NES_stats`'))
- die(mysql_errno() . ': ' . mysql_error());
- $total = mysql_num_rows($query);
- while ($row = mysql_fetch_array($query)) {
- $addLinkToPostReference += $row['addLinkToPostReference'];
- $showPostOnMouseOverReference += $row['showPostOnMouseOverReference'];
- $showPostOnMouseOverReferenceLeft += $row['showPostOnMouseOverReferenceLeft'];
- $showPostOnMouseOverReferenceMini += $row['showPostOnMouseOverReferenceMini'];
- $improvedQuoteSetting += $row['improvedQuoteSetting'];
- $applyTargetBlank += $row['applyTargetBlank'];
- $applyTargetBlankOnlyOutgoing += $row['applyTargetBlankOnlyOutgoing'];
- $fixFailTagsSetting += $row['fixFailTagsSetting'];
- $showUrlImages += $row['showUrlImages'];
- $embedYouTubeUrls += $row['embedYouTubeUrls'];
- $embedYouTubeUrlsNotInQuote += $row['embedYouTubeUrlsNotInQuote'];
- $narrowSite += $row['narrowSite'];
- }
- //Create data array for graph
- $data = array
- (
- 'a'=> round($addLinkToPostReference / $total * 100),
- 'b'=> round($showPostOnMouseOverReference / $total * 100),
- 'c'=> round($showPostOnMouseOverReferenceLeft / $total * 100),
- 'd'=> round($showPostOnMouseOverReferenceMini / $total * 100),
- 'e'=> round($improvedQuoteSetting / $total * 100),
- 'f'=> round($applyTargetBlank / $total * 100),
- 'g'=> round($applyTargetBlankOnlyOutgoing / $total * 100),
- 'h'=> round($fixFailTagsSetting / $total * 100),
- 'i'=> round($showUrlImages / $total * 100),
- 'j'=> round($embedYouTubeUrls / $total * 100),
- 'k'=> round($embedYouTubeUrlsNotInQuote / $total * 100),
- 'l'=> round($narrowSite / $total * 100)
- );
- $cfg['title'] = 'Angivet i %';
- $cfg['average-line-visible'] = 0;
- //Create new graph
- $graph = new phpMyGraph();
- Header("Content-Type: image/png");
- //Parse vertical line graph
- $graph->parseVerticalColumnGraph($data, $cfg);
- } else {
- ?>
- <img src="http://d9projects.com/NES_stats.php?PNG"><br>
- a - addLinkToPostReference<br>
- b - showPostOnMouseOverReference<br>
- c - showPostOnMouseOverReferenceLeft<br>
- d - showPostOnMouseOverReferenceMini<br>
- e - improvedQuoteSetting<br>
- f - applyTargetBlank<br>
- g - applyTargetBlankOnlyOutgoing<br>
- h - fixFailTagsSetting<br>
- i - showUrlImages<br>
- j - embedYouTubeUrls<br>
- k - embedYouTubeUrlsNotInQuote<br>
- l - narrowSite
- <?
- }
- } else {
- $hash = db_escape($_GET['hash']);
- if (!$query = mysql_query('SELECT * FROM `NES_stats` WHERE `hash` = ' . $hash))
- die(mysql_errno() . ': ' . mysql_error());
- if (mysql_num_rows($query) == 0) {
- $hash = md5(uniqid());
- if (!mysql_query('INSERT INTO `NES_stats` (hash) VALUES (\'' . $hash . '\')'))
- die(mysql_errno() . ': ' . mysql_error());
- die('localStorage["NES_statHash2"] = \'' . $hash . '\'; uploadStatistik();');
- }
- $addLinkToPostReference = db_escape($_GET['addLinkToPostReference']);
- $showPostOnMouseOverReference = db_escape($_GET['showPostOnMouseOverReference']);
- $showPostOnMouseOverReferenceLeft = db_escape($_GET['showPostOnMouseOverReferenceLeft']);
- $showPostOnMouseOverReferenceMini = db_escape($_GET['showPostOnMouseOverReferenceMini']);
- $improvedQuoteSetting = db_escape($_GET['improvedQuoteSetting']);
- $applyTargetBlank = db_escape($_GET['applyTargetBlank']);
- $applyTargetBlankOnlyOutgoing = db_escape($_GET['applyTargetBlankOnlyOutgoing']);
- $fixFailTagsSetting = db_escape($_GET['fixFailTagsSetting']);
- $showUrlImages = db_escape($_GET['showUrlImages']);
- $embedYouTubeUrls = db_escape($_GET['embedYouTubeUrls']);
- $embedYouTubeUrlsNotInQuote = db_escape($_GET['embedYouTubeUrlsNotInQuote']);
- $narrowSite = db_escape($_GET['narrowSite']);
- if (!$query = mysql_query(
- <<<CakeIsNigh
- UPDATE `NES_stats` SET
- addLinkToPostReference=$addLinkToPostReference,
- showPostOnMouseOverReference=$showPostOnMouseOverReference,
- showPostOnMouseOverReferenceLeft=$showPostOnMouseOverReferenceLeft,
- showPostOnMouseOverReferenceMini=$showPostOnMouseOverReferenceMini,
- improvedQuoteSetting=$improvedQuoteSetting,
- applyTargetBlank=$applyTargetBlank,
- applyTargetBlankOnlyOutgoing=$applyTargetBlankOnlyOutgoing,
- fixFailTagsSetting=$fixFailTagsSetting,
- showUrlImages=$showUrlImages,
- embedYouTubeUrls=$embedYouTubeUrls,
- embedYouTubeUrlsNotInQuote=$embedYouTubeUrlsNotInQuote,
- narrowSite=$narrowSite
- WHERE `hash` = $hash
- CakeIsNigh
- ))
- die(mysql_errno() . ': ' . mysql_error());
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement