source: subversion/applications/utils/tagstat/votecomment.php @ 13869

Last change on this file since 13869 was 13868, checked in by petschge, 11 years ago

Add savecomment.php writecomment.php votecomment.php the pages related
to comments on tags.

File size: 1.3 KB
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2<HTML>
3 <HEAD>
4  <TITLE>tagstat</TITLE>
5  <META http-equiv="content-type" content="text/html; charset=UTF-8">
6  <LINK rel="stylesheet" type="text/css" href="style.css">
7 </HEAD>
8 <BODY>
9<?php
10        require_once "DB.php";
11        include("config.php");
12        include("func.php");
13
14        $id = getValueFromRequest("id");
15        $tag = getValueFromRequest("tag");
16        $tag_html = htmlspecialchars($tag);
17        $vote = getValueFromRequest("vote");
18
19        echo "<H1>Saving vote for comment on tag &quot;$tag_html&quot;</H1>\n";
20        $dsn = "mysqli://$user:$passwd@$host/$db";
21        $conn =& DB::connect($dsn);
22        if (DB::isError($conn)) {
23                die ("Cannot connect: " . $conn->getMessage() . "\n");
24        }
25
26        $change = "0";
27        if($vote == "up") {
28                $change = "1";
29        } else if ($vote == "down") {
30                $change = "-1";
31        } else {
32                echo "Don't try to play with the URL I don't like that\n";
33        }
34
35        $updatescore =& $conn->prepare("UPDATE tagcomments SET score=score+? WHERE id=?");
36        $result =& $conn->execute($updatescore, array($change, $id));
37        if (DB::isError($result)) {
38                die ("UPDATE failed: " . $result->getMessage() . "\n");
39        }
40
41        $conn->disconnect();
42
43        echo "<A href=\"tagdetails.php?tag=$tag\">Back to $tag_html</A>\n";
44        echo "<A href=\"index.php\">Back to index page</A>\n";
45?>
46 </BODY>
47</HTML>
Note: See TracBrowser for help on using the repository browser.