if (!$db->checkKey($k)) { unset($k); } } if (isset($_GET['s']) && isset($k)) { $s = $db->limitScore((double) $_GET['s']); $s = $db->processScore($p, $s); echo json_encode(array('p' => $p, 'score' => $s)); exit; } else { $s = $db->getScore($p); } $messages = array('not_logged_in' => array('class' => 'warning', 'text' => 'You need to login before voting. Click <a href="#login">here</a> to login.'), 'invalid_key' => array('class' => 'error', 'text' => 'Your account could not be activated. Click <a href="#login">here</a> to re-activate.'), 'vote_saved' => array('class' => 'success', 'text' => 'Your vote has been saved. Thank you!'), 'already_voted' => array('class' => 'information', 'text' => 'You\\\'ve voted for this package.'), 'vote_changed' => array('class' => 'success', 'text' => 'Your vote has been changed.')); $voted = false; if (isset($k)) { if ($db->hasVoted($p)) { $voted = true; $status = 'vote_changed'; } else { $status = 'vote_saved'; } } else { if (isset($_GET['k'])) { $status = 'invalid_key'; } else { $status = 'not_logged_in'; } } $pi = new PackImage($p); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">