/*************************************************************** * This page handles the backend of the "edit group ID" function * (found on edit.php). It simply changes the group ID of a * torrent. ****************************************************************/ if(!check_perms('torrents_edit')) { error(403); } $OldGroupID = $_POST['oldgroupid']; $GroupID = $_POST['groupid']; $TorrentID = $_POST['torrentid']; if(!is_number($OldGroupID) || !is_number($GroupID) || !is_number($TorrentID) || !$OldGroupID || !$GroupID || !$TorrentID) { error(0); } if($OldGroupID == $GroupID) { header('Location: '.$_SERVER['HTTP_REFERER']); die(); } //Everything is legit, let's just confim they're not retarded if(empty($_POST['confirm'])) { $DB->query("SELECT Name FROM torrents_group WHERE ID = ".$OldGroupID); if($DB->record_count() < 1) { //Trying to move to an empty group? I think not! set_message("That group doesn't exist!"); header('Location: '.$_SERVER['HTTP_REFERER']); die(); } list($Name) = $DB->next_record(); $DB->query("SELECT CategoryID, Name FROM torrents_group WHERE ID = ".$GroupID); list($CategoryID, $NewName) = $DB->next_record(); if($Categories[$CategoryID-1] != 'Music') { error('Target must be a music group.'); } $Artists = Artists::get_artists(array($OldGroupID, $GroupID)); View::show_header(); ?>