"" ) { //mass delete comes in via POST, not GET $remove = $_POST['ids']; for($i = count($remove) - 1; $i >= 0; $i--) { $id = $remove[$i]; if ($id <> "") $cookie = preg_replace( "/,{$id}/", ",", $cookie ); } } else if ($_GET['add'] <> '') { //a promotional item to add $cookie = addCDTitle( $cookie, $_GET['add'] ); } else if ($_POST[ 'AddRecommended' ] <> "" ) { //add all promotional items $cookie = addCDTitle( $cookie, $_POST['addall'] ); } else if ($_GET['remove'] <> '') { //a CD item to remove $cookie = preg_replace( "/,{$_GET['remove']}/", ",", $cookie ); } else if ($_POST['addnew'] <> '') { //user specified add new ids $cookie = addCDTitle( $cookie, $_POST['addnew'] ); } include_once('header1.php'); $columns = 6; $smarty = newSmarty(); $smarty->assign( 'columns', $columns ); $smarty->assign( 'sort', $_GET['sort'] ); //generate a query for every title on the CD $cd = explode( ",", $cookie ); for($i = count($cd) - 1; $i >= 0; $i--) { $id = $cd[$i]; if ($id <> "") if ($list == "") $list = "paddata.id='" . addslashes($id) . "'"; else $list .= " or paddata.id='" . addslashes($id) . "'"; } if ($list <> "") { if ($_GET['sort'] == 'size') $querystr = <<assign( 'items', $items ); $smarty->assign( 'num', $num ); $smarty->assign( 'total_size', $total_size ); $smarty->assign( 'total_MB', round($total_size / 1024) ); if ($total_MB > 580) $smarty->assign( 'remaining', 0 ); else $smarty->assign( 'remaining', 580 - round($total_size/1024) ); //promotional titles - except if they have been added already $promo = "id=110779 or id=474119 or id=110782"; // $promo = "id=0"; if ($list == "") $querystr = "select * from paddata where ($promo) order by title"; else $querystr = "select * from paddata where ($promo) and not($list) order by title"; $result = query( $querystr ); if ( mysql_num_rows( $result ) ) { $num = 1; $addall = ""; $items = array(); while ($query = mysql_fetch_assoc($result) ) { $item = array(); $item['id'] = $query['id']; $id = $query['id']; $addall .= ",$id"; $item['icon'] = get_icon( $query ); $item['title'] = $query['title']; $item['download'] = get_download_url( $query ); $item['info'] = get_info_url( $query ); $item['buy'] = get_buy_url( $query ); $item['shortdescription'] = get_description( $query ); $num++; $items[count($items)] = $item; } $smarty->assign( 'promo', $items ); $smarty->assign( 'promo_num', $num ); $smarty->assign( 'addall', $addall ); } mysql_close($link_id); echo << ENDH; $res = $smarty->fetch( 'cdedit.tpl' ); substitute_header_code_into_text( $res ); include_once('footer2.php'); ?>