Hi, I'm having a few issues regarding maian music for Joomla.

When a user goes to download a free mp3 they are asked to enter their name and email.

When the user clicks submit their name and email are logged into a database (via the acajoom newsletter plugin), they are then given a 'return to previous page' button.

After this 'return to previous page' button is a load of symbols, these differ from browser to browser.

Opera:


IE8:


Firefox 3.5 just crashes after a few minutes, on restart the download begins, I really don't know why.

This can all be viewed live at www.talking-guides.com

This is the function which controls this bit
Code PHP:
function freebie(){
 
		$track_id = intval(cleanData(JRequest::getVar('track')));
		$track_album = intval(cleanData(JRequest::getVar('track_album')));
 
		$db =& JFactory::getDBO();
 
		if(!isset($query)){
			$db->setQuery("SELECT params FROM #__menu WHERE link like '%index.php?option=com_maian15&view=freebie%' and type like 'component'");
			$query = $db->loadObject();
			if(!isset($query)){
				$query =   "display_num=5
							orderBy=track-desc
							email=0
							accept_users=1
							color=#F5F5F5
							system=ccnews
							newslist=1
							page_title=
							show_page_title=1
							pageclass_sfx=
							menu_image=-1
							secure=0";
			}
		}
 
		$lines = explode("\n", trim($query->params));
 
		for ($i=0; $i<count($lines);$i++){
			list($key,$val) = explode("=", $lines[$i]);
			$params [urldecode($key)] = urldecode($val);
		}
 
		$db->setQuery("SELECT * FROM #__m15_tracks WHERE id = $track_id") ;
		$track = $db->loadObject();
		$cost = floatval($track->track_cost);
 
		//Protect from people trying to steal other tracks!!!
		if($track->track_cost != '0.00'){
			echo '<div id="thief">'.JText::_(_msg_theif).'</div>';
			return;
		}
 
		$user =& JFactory::getUser();
 
		if($params ['email'] == '1' ){
			if($params['accept_users'] == '1'){
				if(isset($_SESSION['mm_email']) && $user->guest){
					$this->MM_CART->forceDownload($this->SETTINGS->mp3_path.DS.$track->mp3_path, JText::_(_msg_paypal27));
				}else if(!$user->guest){
					$this->MM_CART->forceDownload($this->SETTINGS->mp3_path.DS.$track->mp3_path, JText::_(_msg_paypal27));
				}else{
					$document = &JFactory::getDocument();
					$document->addScript( 'components/com_maian15/ajax/cartajax.js');	
					$find       = array('{item_id}','{required_field}','{invalid_address}','{name}','{email}', '{submit}');
					$replace    = array($id, JText::_(_msg_require_field), JText::_(_msg_invalid_email), JText::_(_msg_name), JText::_(_msg_email), JText::_(_msg_submit));
					$sData .= str_replace($find,$replace,
					file_get_contents(JPATH_COMPONENT.DS.'html'.DS.'tpl'.DS.'free_download.html'));
					echo '<div id="no_email">'.JText::_(_msg_must_provide).'</div>';
					echo '<input type="hidden" id="mm_album" name="mm_album" value="'.$track_album.'" />';
					echo '<input type="hidden" id="mm_track" name="mm_track" value="'.$track->id.'" />';
					echo $sData;	
				}
			}
		}else{
			$this->MM_CART->forceDownload($this->SETTINGS->mp3_path.DS.$track->mp3_path, JText::_(_msg_paypal27));
		}
 
	}

Here is 'free_download.html'
Code HTML4Strict:
<div id="email_container">
        <span id="loading"></span><div id="mm_email">
<input type="hidden" value="{item_id}" name="item_id" />
<label>{name}</label> <input id="mm_name" name="mm_name" type="text" />
 
<label>{email}</label> <input id="mm_email" name="mm_email"
	type="text" />
 
<input class="button" type="submit" value="{submit}" onclick="ajaxRequest('mm_loading', 'index.php?option=com_maian15&format=raw&task=verifyEmail', '1')"/>
<div id="mm_loading"></div>
</div>
</div>

Is there any way I can strip all of these symbols out of the echo $sData?


Any help would be really appreciated.

Thanks
James