function delVote() { global $xoopsDB, $eh; $rid = $_GET['rid']; $lid = $_GET['lid']; $sql = sprintf("DELETE FROM %s WHERE ratingid = %u", $xoopsDB->prefix("mylinks_votedata"), $rid); $xoopsDB->query($sql) or $eh->show("0013"); updaterating($lid); redirect_header("index.php", 1, _MD_VOTEDELETED); exit; }
function delVote() { global $xoopsDB, $eh; $lid = mylinksUtility::mylinks_cleanVars($_POST, 'lid', 0, 'int', array('min' => 0)); $rid = mylinksUtility::mylinks_cleanVars($_POST, 'rid', 0, 'int', array('min' => 0)); $sql = sprintf("DELETE FROM %s WHERE ratingid = %u", $xoopsDB->prefix("mylinks_votedata"), $rid); $xoopsDB->query($sql) or $eh->show('0013'); updaterating($lid); redirect_header('index.php', 2, _MD_MYLINKS_VOTEDELETED); exit; }
} // Check if ANONYMOUS user is trying to vote more than once per day. if ($ratinguser == 0) { $yesterday = time() - 86400 * $anonwaitdays; $result = DB_query("SELECT COUNT(*) FROM {$_FM_TABLES['filemgmt_votedata']} " . "WHERE lid='{$lid}' AND ratinguser=0 AND ratinghostname = '{$ip}' " . "AND ratingtimestamp > {$yesterday}"); list($anonvotecount) = DB_fetchArray($result); if ($anonvotecount >= 1) { redirect_header("index.php", 4, _MD_VOTEONCE); exit; } } //All is well. Add to Line Item Rate to DB. $datetime = time(); DB_query("INSERT INTO {$_FM_TABLES['filemgmt_votedata']} " . "(lid, ratinguser, rating, ratinghostname, ratingtimestamp) " . "VALUES ('{$lid}', '{$ratinguser}', '{$rating}', '{$ip}', '{$datetime}')"); //All is well. Calculate Score & Add to Summary (for quick retrieval & sorting) to DB. updaterating($lid); $ratemessage = _MD_VOTEAPPRE . "<br>" . sprintf(_MD_THANKYOU, $_CONF[site_name]); redirect_header("index.php", 4, $ratemessage); exit; } else { $lid = 0; if (isset($_GET['lid'])) { $lid = COM_applyFilter($_GET['lid'], true); } $display = ''; $display .= COM_startBlock("<b>" . _MD_RATEFILETITLE . "</b>"); $result = DB_query("SELECT title FROM {$_FM_TABLES['filemgmt_filedetail']} WHERE lid='{$lid}'"); list($title) = DB_fetchArray($result); $title = $myts->makeTboxData4Show($title); $display .= '<table border="0" cellpadding="1" cellspacing="0" width="80%" class="plugin"><tr>'; $display .= '<td class="pluginHeader">' . _MD_FILE . ': ' . $title . '</td></tr>';
function delVote() { global $_CONF, $_FM_TABLES; $rid = 0; if (isset($_POST['rid'])) { $rid = COM_applyFilter($_POST['rid'], true); } $lid = 0; if (isset($_POST['lid'])) { $lid = COM_applyFilter($_POST['lid'], true); } DB_query("DELETE FROM {$_FM_TABLES['filemgmt_votedata']} WHERE ratingid='{$rid}'"); updaterating($lid); redirect_header("{$_CONF['site_admin_url']}/plugins/filemgmt/index.php?lid={$lid}&op=modDownload", 2, _MD_VOTEDELETED); exit; }