id); if (isset($HTTP_POST_VARS)) { // form submitted foreach ($HTTP_POST_VARS as $post => $rating) { if ($post == "id") { continue; } if ($rating) { if ($check = get_record_sql("SELECT COUNT(*) as count FROM forum_ratings WHERE user='$USER->id' AND post='$post'")){ if ($check->count == 0) { $timenow = time(); if (!$rs = $db->Execute("INSERT DELAYED INTO forum_ratings SET user='$USER->id', post='$post', time='$timenow', rating='$rating'")){ error("Could not insert a new rating ($post = $rating)"); } } else { error("You've rated this question before ($post)"); } } } } redirect($HTTP_REFERER, "Ratings saved"); } else { error("This page was not accessed correctly"); } ?>