Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //DB login info
- $dbUsername = 'changed';
- $dbPassword = 'changed';
- $qdb = "ttk_qdb";
- $addlike = $_POST['curlike'] + 1;
- $addhate = $_POST['curhate'] + 1;
- if ($_SESSION['login'] != "yes")
- {
- echo('You must login to use this function.');
- }
- elseif ($_POST['rate'] == "")
- {
- echo "You didn't vote!";
- }
- elseif ($_POST['rate'] == "Hate")
- {
- echo 'Submiting your vote...';
- $ttkqdb = mysql_connect("localhost", $dbUsername, $dbPassword);
- if (!$ttkqdb)
- {
- echo('Error, unable to connect to the database');
- }
- mysql_select_db($qdb, $ttkqdb);
- mysql_query("UPDATE `quotes` SET `hate` = '".$addhate."' WHERE id = '".$_POST['postid']."'") or die(mysql_error());
- mysql_close($ttkqdb);
- }
- elseif ($_POST['rate'] == "Like")
- {
- echo 'Submiting your vote...';
- $ttkqdb = mysql_connect("localhost", $dbUsername, $dbPassword);
- if (!$ttkqdb)
- {
- echo('Error, unable to connect to the database');
- }
- mysql_select_db($qdb, $ttkqdb);
- mysql_query("UPDATE `quotes` SET `like` = '".$addlike."' WHERE id = '".$_POST['postid']."'") or die(mysql_error());
- mysql_close($ttkqdb);
- }
Add Comment
Please, Sign In to add comment