$type) { if (!$previous_type) $previous_type = $type; // we will need to know what the last vid type was so we can add a space if necessary (see below) but we must prime it the first time. if (!$episodes_already_billed) $episodes_already_billed = array(); if ($type == 2) { $query = "select *, scenes.id as id, episodes.id as episodeid, episodes.title as episode_title, scenes.title as title, episodes.cost as episode_cost, scenes.cost as cost from scenes left join episodes on episodes.id = scenes.episode where scenes.id = '$videoid'"; $videodata = coolquery($query,1); } else { $query = "select *, scenes.id as id from scenes where scenes.id = '$videoid'"; $videodata = coolquery($query,1); } //echo $query.'
'; if ($type == 1 && $previous_type == 2) $output[] = array('','

'); // if we are now putting a single vid after a packaged vid, add a space. $previous_type = $type; // remember what the previous vid type was so we know whether to put a space next time. if ($type == 2 && (!in_array($videodata[episodeid], $episodes_already_billed))) { $number_of_clips = mysqli_num_rows(mysqli_query($database_connection, "select 1 from scenedata where scene_id = '$videodata[episodeid]'")); $output[] = array('','

'); $output[] = ''.'Episode: '.''; $output[] = ''.$videodata[episode_title].' '. ($admin_user && $edit_mode ? 'Edit this episode
':''). '  
'; $output[] = '$'.number_format($videodata[episode_cost],2).''; $output[] = '
   Remove
'; } $output[] = ''.($type == 2 ? '' : ''); $output[] = ''.$videodata[title].' '.($admin_user && $edit_mode ? '
Edit this update':''); // : video ID '.$videodata[id] // only show the price of videos that aren't part of a scene. if ($type == 1) $output[] = '$'.number_format($videodata[cost],2).''; else $output[] = ''; $output[] = ($type == 1 ? '
   Remove
':''); if ($type == 1) { $total_download += $videodata[cost]; // a type of 1 means it's an individually-billed single vid. 2 means it's part of a package. // now put together the order strings for patrick 'n em. $html_order_string .= 'Downloadable scene: "'. $videodata[scene_name].'" ID# '.$videoid.' $'.number_format($videodata[cost],2).'
'; $text_order_string .= 'Downloadable scene: "'. $videodata[scene_name].'" ID# '.$videoid.' $'.number_format($videodata[cost],2)."\n"; $paypal_hiddens .= ' '; $item_count++; } if ($type == 2) { // if this video is part of a whole episode that was added, then we need to add the price of the whole episode just ONCE. if (!in_array($videodata[episodeid], $episodes_already_billed)) { $total_download += $videodata[episode_cost]; $episodes_already_billed[] = $videodata[episodeid]; // remember that we've charged the person for this episode already. // now put together the order strings for patrick 'n em. $html_order_string .= 'Downloadable episode: "'. $videodata[episode_title].'" ID# '.$videoid.' $'.number_format($videodata[episode_cost],2).'
'; $text_order_string .= 'Downloadable episode: "'. $videodata[episode_title].'" ID# '.$videoid.' $'.number_format($videodata[episode_cost],2)."\n"; $paypal_hiddens .= ' '; $item_count++; } } } $html_order_string .= '

Please go to http://'.$sitedata[domain].'/myupdates.html and use Cart ID '.$cartid.' to view your videos.'; $text_order_string .= "\n".'Please go to http://'.$sitedata[domain].'/myupdates.html and use Cart ID '.$cartid.' to view your videos.'; $overall_quantity = count($cart[updates]) + count($cart[products]); $paypal_hiddens .= ''; } if ($output) { $temp_cart = $cart; $mktime = time(); $sql_cart = serialize($cart); $query = "insert into carts (cart, price, created_date, cartid) values ('$sql_cart', '$total_download', '$mktime', '$cartid')"; mysqli_query($database_connection, $query); $cart_download .= '
My Downloads Cart
'; $cart_download .= tabletime($output,4,'align=center cellpadding=2 cellspacing=0 align=center', 'style="padding-right:30px;"').'



Total: $'.number_format($total_download,2).'

'; if (!$return) $return = 'index.html'; } if (!$return) $return = 'index.html'; $cart_download .= ' '; if ($output) { if (!$userid) { $cart_download .= ''; } elseif(!$not_enough) { // we can recalculate the cost of this cart, and deduct that amount on the other side! (the dollar amount is stored in the db) $cart_download .= ''; } } $cart_download .= '
 
'; if ($admin_user && $edit_mode) $cart_download .= ''; $cart_download .= '
'; $cart_download .='
'; if ($sitedata[domain] != 'wamthroughyou.com') { $cart_download .= '
'.$paypal_hiddens.' We now also accept Paypal!


'; } else { $cart_download .= '
'.box3('
Request an alternate payment method
').'
'; } if (!$output) { echo '
There is nothing in your shopping cart.

'; setcookie("cart", '', time()+10000000,"/"); // make sure that shit's really empty! setcookie("cartid", '', time()+10000000,"/"); // make sure that shit's really empty! } echo $cart_download; ?>