<?php
/****************************************************************************
* DRBRatings
* http://www.dbscripts.net/ratings/
*
* Copyright (c) 2007-2010 Don B
****************************************************************************/
include_once(dirname(__FILE__) . '/ratings.php');
function show_error() {
global $rating_error_message;
echo(htmlspecialchars($rating_error_message));
}
// Handle action
if(isset( $_POST[$RATING_PARAM_NAME] ) && isset( $_POST[$RATING_ID_PARAM_NAME] )) {
// Reset error message
global $rating_error_message;
$rating_error_message = NULL;
// Get parameter values from post
$rating = trim($_POST[$RATING_PARAM_NAME]);
$ratingid = trim($_POST[$RATING_ID_PARAM_NAME]);
// Attempt to add a new rating
if(add_new_rating($ratingid, $rating) === TRUE) {
// Display success page
include_once(dirname(__FILE__) . '/template/success.php');
} else {
// Display error page
include_once(dirname(__FILE__) . '/template/failure.php');
}
} else {
die("Invalid request.");
}
?>