Jump to content

Simple help please!


Dagunchi

Recommended Posts

Hello, i am newbie at PHP codes and i need help little! How to limit of chars of song? I uploaud an images and post php code!

 

		$fp_data = ereg_replace("^.*<body>","",$fp_data); 
	$fp_data = ereg_replace("</body>.*","",$fp_data); 

	list($currentlisteners,$status,$peak,$max,$reported,$bit,$song) = explode(",", $fp_data, 7);

	if($showsong == '1')
	{
		$stationinfo = '   '.$currentsong.' '.$song.'  ';
	}

	if($showlisteners == '1')
	{
		$stationinfo = $stationinfo.'   '.$currentlisteners.' of '.$peak.' '.$listenerlabel.'  ';
	}
}
}


// Include the layout for display
require(JModuleHelper::getLayoutPath('mod_ngs_shoutcast'));
?>

 

Thank you!

 

[attachment deleted by admin]

Link to comment
Share on other sites

No it not help, because song not showing generally!

Here is full php code:

<?php 
/**
* NGS Shoutcast - A Joomla internet radio module
* @version 1.1.0
* @package mod_ngs_shoutcast.zip
* @copyright (C)2009 by Steve Williams.  (C)2007 by Silent Joe.
*/

// Don't allow direct acces to the file
defined( '_JEXEC' ) or die( 'Direct Access to this location is not allowed.' );

// Get parameters from module configuration
$stationname = $params->get( 'stationname', 'Station Name' );
$prihost = $params->get('prihost');
$priport = $params->get('priport');
$sechost = $params->get('sechost');
$secport = $params->get('secport');
$priwmsmp = $params->get('priwmsmp');
$secwmsmp = $params->get('secwmsmp');
$priname = $params->get('priname');
$secname = $params->get('secname');
$currentsong = $params->get('currentsong');
$listenerlabel = $params->get('listeners');
$showsong = $params->get('showsong');
$showlisteners = $params->get('showlisteners');
$showname = $params->get('showname');
$showthreed = $params->get('showthreed');
$playlistmode = $params->get('playlistmode');

$modulepath = './modules/mod_ngs_shoutcast/';

// if windows mountpoints are not defined, build a playlist for shoutcast in ASX format
// if (empty($wmsfastmp)) {
//$wmsfastmp = $modulepath.'makeplaylist.php?ip='.$fasthost.'&port='.$fastport.'&format=ASX';
//}
//if (empty($wmsslowmp)) {
//$wmsslowmp = $modulepath.'makeplaylist.php?ip='.$slowhost.'&port='.$slowport.'&format=ASX';
//}

if($sechost > '')
{
if( $playlistmode == "0") {
	if(empty($priwmsmp)) {
		$wmslink = $modulepath.'dualplaylist.php?priip='.$prihost.'&priport='.$priport.'&secip='.$sechost.'&secport='.$secport.'&format=ASX';
	} else {
		$wmslink = $priwmsmp;
	}
	$winamplink = $modulepath.'dualplaylist.php?priip='.$prihost.'&priport='.$priport.'&secip='.$sechost.'&secport='.$secport.'&format=PLS';
	$ituneslink = $modulepath.'dualplaylist.php?priip='.$prihost.'&priport='.$priport.'&secip='.$sechost.'&secport='.$secport.'&format=M3U';
	$realplayerlink = $modulepath.'dualplaylist.php?priip='.$prihost.'&priport='.$priport.'&secip='.$sechost.'&secport='.$secport.'&format=RAM';
} else {
	if(empty($priwmsmp)) {
		$priwmslink = $modulepath.'singleplaylist.php?ip='.$prihost.'&port='.$priport.'&format=ASX';
	} else {
		$priwmslink = $priwmsmp;
	}
	$priwinamplink = $modulepath.'singleplaylist.php?ip='.$prihost.'&port='.$priport.'&format=PLS';
	$priituneslink = $modulepath.'singleplaylist.php?ip='.$prihost.'&port='.$priport.'&format=M3U';
	$prirealplayerlink = $modulepath.'singleplaylist.php?ip='.$prihost.'&port='.$priport.'&format=RAM';

	if(empty($secwmsmp)) {
		$secwmslink = $modulepath.'singleplaylist.php?ip='.$sechost.'&port='.$secport.'&format=ASX';
	} else {
		$secwmslink = $secwmsmp;
	}
	$secwinamplink = $modulepath.'singleplaylist.php?ip='.$sechost.'&port='.$secport.'&format=PLS';
	$secituneslink = $modulepath.'singleplaylist.php?ip='.$sechost.'&port='.$secport.'&format=M3U';
	$secrealplayerlink = $modulepath.'singleplaylist.php?ip='.$sechost.'&port='.$secport.'&format=RAM';
}
} else {
if(empty($priwmsmp)) {
	$wmslink = $modulepath.'singleplaylist.php?ip='.$prihost.'&port='.$priport.'&format=ASX';
} else {
	$wmslink = $priwmsmp;
}
$winamplink = $modulepath.'singleplaylist.php?ip='.$prihost.'&port='.$priport.'&format=PLS';
$ituneslink = $modulepath.'singleplaylist.php?ip='.$prihost.'&port='.$priport.'&format=M3U';
$realplayerlink = $modulepath.'singleplaylist.php?ip='.$prihost.'&port='.$priport.'&format=RAM';
}

if ($showthreed == '1') {
$winampimage = $modulepath.'images/winamp3d.gif';
$itunesimage = $modulepath.'images/itunes3d.gif';
$realplayerimage = $modulepath.'images/realplayer3d.gif';
$wmplayerimage = $modulepath.'images/wmplayer3d.gif';
} else {
$winampimage = $modulepath.'images/winamp.gif';
$itunesimage = $modulepath.'images/itunes.gif';
$realplayerimage = $modulepath.'images/realplayer.gif';
$wmplayerimage = $modulepath.'images/wmplayer.gif';
}

$stationinfo = '';

if ($showsong == '1' OR $showlisteners == '1') {
$fp=@fsockopen($prihost,$priport,$errno,$errstr,10);

if (!$fp && $sechost > '') 
	$fp=@fsockopen($sechost,$secport,$errno,$errstr,10);

if(!$fp) {
	$stationinfo = '$errstr: $errno'; 
} else {
	fputs($fp,"GET /7 HTTP/1.1\nUser-Agent:Mozilla\n\n");
	for($i=0; $i<1; $i++) { 
		if(feof($fp)) break; 
		$fp_data=fread($fp,31337); 
		usleep(500000); 
	}

	$fp_data = ereg_replace("^.*<body>","",$fp_data); 
	$fp_data = ereg_replace("</body>.*","",$fp_data); 

	list($currentlisteners,$status,$peak,$max,$reported,$bit,$song) = explode(",", $fp_data, 7);

	if($showsong == '1')
	{
		$stationinfo = '   '.$currentsong.' '.$song.'  ';
	}

	if($showlisteners == '1')
	{
		$stationinfo = $stationinfo.'   '.$currentlisteners.' of '.$peak.' '.$listenerlabel.'  ';
	}
}
}


// Include the layout for display
require(JModuleHelper::getLayoutPath('mod_ngs_shoutcast'));
?>


oh no it showing, but not help :(

Link to comment
Share on other sites

None of that code actually displays anything. You need to find the code that displays the part that's too long, and use the substr() function there.

Maybe in this php file?

<?
// Make a playlist given IP, port, and format
// format paramaters can be either ASX, PLS, M3U, RAM
// Call file like so:
// /singleplaylist.php?ip=123.45.67.89&port=8000&format=ASX
// Author: Joseph Geyer
// Email: silentjoe@silentjoe.com
// (Originally titled makelist.php)

$ip = $_GET['ip'];
$port = $_GET['port'];
$format = $_GET['format'];

$ip = strip_tags($ip);
$port = strip_tags($port);
$format = strip_tags($format);

switch($format) {
  case 'ASX': // show ASX output
         header('Content-Type: video/x-ms-asf; name="playlist.asx"');
 	 header('Content-Transfer-Encoding: 7bit');
         header('Content-Disposition: attachment; filename="playlist.asx"');
         echo "<ASX version = \"3.0\">\r\n<Entry>\r\n";
         echo "<REF HREF=\"http://$ip:$port/\" />\r\n";
         echo "</Entry>\r\n</ASX>\r\n";
        break;
  case 'M3U': // show M3U output
         header('Content-Type: audio/mpegurl; name="playlist.m3u"');
 header('Content-Transfer-Encoding: 7bit');
         header('Content-Disposition: attachment; filename="playlist.m3u"');
         echo "#EXTM3U\r\n";
         echo "#EXTINF:-1,Live Station\r\n";
         echo "http://$ip:$port/\r\n";
       break;
  case 'PLS': // show PLS output
         header('Content-Type: audio/x-scpls; name="playlist.pls"');
 header('Content-Transfer-Encoding: 7bit');
         header('Content-Disposition: attachment; filename="playlist.pls"');
         echo "[playlist]\r\n";
         echo "NumberOfEntries=1\r\n";
         echo "File1=http://$ip:$port\r\n";
         echo "Version=2";
         break;
case 'RAM': // show RAM output
         header('Content-Type: audio/x-pn-realaudio; name="playlist.ram"');
 header('Content-Transfer-Encoding: 7bit');
         header('Content-Disposition: attachment; filename="playlist.ram"');
         echo "http://$ip:$port/\r\n";
         break;
  default: // no playlist format selected
      echo 'No playlist selected';
      break;
}

or in this maybe?

 

<?php
// Prevent direct access of this file
defined('_JEXEC') or die('Direct Access to this location is not allowed.');
?>

<?php if ($showname == '1') { ?>
<font color="Lightyellow" face="verdana" size="5"><b> <?php echo $stationname ?></b></font>
<?php } ?>

<?php if( $sechost > '' AND $playlistmode == "1") { ?>
<b><?php echo $priname ?>
<a href="<?php echo $priwmslink ?>">
	<img src="<?php echo $wmplayerimage ?>" border=0 alt="listen with Window Media Player" />
</a> 
<a href="<?php echo $priwinamplink ?>">
	<img src="<?php echo $winampimage ?>" border=0 alt="listen with Winamp" />
</a> 
<a href="<?php echo $priituneslink ?>">
	<img src="<?php echo $itunesimage ?>" border=0 alt="listen with iTunes" />
</a> 
<a href="<?php echo $prirealplayerlink ?>">
	<img src="<?php echo $realplayerimage ?>" border=0 alt="listen with RealPlayer" />
</a>

<b><?php echo $secname ?>
<a href="<?php echo $secwmslink ?>">
	<img src="<?php echo $wmplayerimage ?>" border=0 alt="listen with Window Media Player" />
</a> 
<a href="<?php echo $secwinamplink ?>">
	<img src="<?php echo $winampimage ?>" border=0 alt="listen with Winamp" />
</a> 
<a href="<?php echo $secituneslink ?>">
	<img src="<?php echo $itunesimage ?>" border=0 alt="listen with iTunes" />
</a> 
<a href="<?php echo $secrealplayerlink ?>">
	<img src="<?php echo $realplayerimage ?>" border=0 alt="listen with RealPlayer" />
</a>
<?php } else { ?>
<a href="<?php echo $wmslink ?>">
	<img src="<?php echo $wmplayerimage ?>" border=0 alt="listen with Window Media Player" />
</a> 
<a href="<?php echo $winamplink ?>">
	<img src="<?php echo $winampimage ?>" border=0 alt="listen with Winamp" />
</a> 
<a href="<?php echo $ituneslink ?>">
	<img src="<?php echo $itunesimage ?>" border=0 alt="listen with iTunes" />
</a> 
<a href="<?php echo $realplayerlink ?>">
	<img src="<?php echo $realplayerimage ?>" border=0 alt="listen with RealPlayer" />
</a>
<?php } ?>
<?php
echo $stationinfo;
?>

Thank you in an advance!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.