Jump to content

Using a Java code in PHP file


Syntax6

Recommended Posts

OK here is my issue.

 

I have a file called embed.php

it calls a swf video player that is on my server but i am using an external player.

 

so I am trying to remove the current document.write that calls the swf player and insert the java code for the other player but i cant get it to work either I get no errors but a blank square. or I get some $end  or T-STRING error.

 

here is the  embed.php code:

 
<?php
// Set the "VALID" flag, to include child files
define( '_VALID_CS', 1 );

session_start();
include("include/config.php");
include("include/header.php");
include("include/function.php");
sess_register();

// Register some vars, from config.php
$site_name = $config['site_name'];
$site_url = $config['BASE_URL'];
$videoid = mysql_real_escape_string($_REQUEST[video]);

// Get the video info and set the session for the SWF video player
$getvideodetails = mysql_query("select VID,UID,title,description,keyword,type,viewnumber,rated,embd,embed_code from video where VID='$videoid'");
list($gvdoid,$gvduid,$gvdotitle,$gvdodescr,$gvdokey,$gvdotype,$gvdoviewnumber,$grated,$embd,$embed_code) = mysql_fetch_row($getvideodetails);

// No 18+ video and no private video can be embedded, by illegally passing the video ID to the iframe
if ($grated == "1" || $gvdotype=="private")
{
echo "<b>YOU ARE TRYING TO WATCH A PRIVATE OR DISALLOWED VIDEO!</b>";
}
else
{

// Externally embedded videos should also add to the view video counter, so we add +1 to the video count... 
$newview = $gvdoviewnumber + 1;
$updatevdodetails = mysql_query("update video set viewnumber='$newview',viewtime='".date("Y-m-d H:i:s")."' where VID='$videoid'");

if ($embd=='1') {
$embed_code = stripslashes($embed_code);
echo "$embed_code";
} else {

// Javascript detection of the user's installed Flash(TM) plugin, if any
echo "<script language=JavaScript src=$site_url/include/js/compressed/flash_detect.php></script>";

if ($config[stream] == 'php') {
video_to_session($gvdoid);
}

// Externally embedded videos can be a lot, for a huge site, and Smarty is rather slow, so...
// we simly will not be using templates in this file...

// Output the content to the browser
echo "
<script language=JavaScript type=text/javascript>
if(flashinstalled == 2){
  if(flashversion >= 9){
document.write(\"<object type=application/x-shockwave-flash data=$site_url/include/flash_players/player_flv_maxi.swf width=390 height=340><param name=movie value=$site_url/include/flash_players/player_flv_maxi.swf /><param name=allowFullScreen value=true /><param name=wmode value=transparent /><param name=FlashVars value=configxml=$site_url/include/flash_players/player_flv_maxi.php?video=$gvdoid.flv&videopass=$videopass /></object>\");
  }
else{
document.write(\" <embed src=$site_url/include/js/swfobject/expressinstall.swf bgcolor=#FFFFFF width=425 height=367></embed> \");
  }
}
else{
   document.write(\"<div align=left style='font-size: 11px; background-color: #EEEEEE; border: 1px #BABDBF dashed;'>  You need Macromedia Flash Player<sup>TM</sup> 9, to watch this video. You don't even have Flash<sup>TM</sup> installed. Please click <a href=http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash target=_blank>HERE</a> to install it.</b> Close your browser or refresh the page after the install.</div>\");
}
</script>";

}
}
echo "<br><span style=\"font-weight: bold; color: #FF0000; font-size:12px;\">Watch more videos at <a href=$site_url target=_blank style=\"font-weight: bold; color: #FF0000; font-size:11px;\">$site_name</a>!</b>";
?>

 

I want to remove the  player_flv_maxi.swf code and use this:

 

<!-- Start Embed Code Block -->
<script type="text/javascript">
adotube_embed = {
    avpid: 'M3xR59',
    runtime_location: '$site_url/include/adoe',   // Location of the Runtime    
    player_video_stream_url'$site_url/uploads/flvideo/$gvdoid.flv',  // URL of the FLV stream 
    player_video_thumbnail_url:'$site_url/tmp/player_frame/$gvdoid.jpg',  // URL of the video thumbnail
    player_video_page_url:'null',   // URL of the page where the video can be viewed
    video_identifier_string: 'null' // Video Identifier
};
</script>
<script type="text/javascript">
document.write('<script type="text/javascript" src="http://www.mysite.com/php/services/Runtime/courier.js.php"><'+'/script>');
document.write('<script type="text/javascript" src="'+adoe_embed.runtime_location+'/swfobject/swfobject.js"><'+'/script>');
document.write('<script type="text/javascript" src="'+adoe_embed.runtime_location+'/js/sorge.js"><'+'/script>');
</script>
<!-- End Embed Code Block -->

 

I either get a blank embeded player, a 500 internal server error or any of the following:

PHP Parse error:  syntax error, unexpected T_ELSE in

PHP Parse error:  syntax error, unexpected T_STRING, expecting ',' or ';' in

PHP Warning:  Division by zero in

 

 

Link to comment
https://forums.phpfreaks.com/topic/98041-using-a-java-code-in-php-file/
Share on other sites

in where? in blah.php on line 10932342?

 

well the first code is the untouched so it has no errors but when i try to  remove the  document.write ...blah /player_flv_maxi.swf blah

and insert the second code I get the errors  depending on how i mess with it it sometimes says line 76 or 83  etc etc.

 

here is what it looks like now I get no errors but I only get a blank page with single line that says " Watch more videos at mysite.com!"

 


<?php

// Set the "VALID" flag, to include child files
define( '_VALID_CS', 1 );

session_start();
include("include/config.php");
include("include/header.php");
include("include/function.php");
sess_register();

// Register some vars, from config.php
$site_name = $config['site_name'];
$site_url = $config['BASE_URL'];
$videoid = mysql_real_escape_string($_REQUEST[video]);

// Get the video info and set the session for the SWF video player
$getvideodetails = mysql_query("select VID,UID,title,description,keyword,type,viewnumber,rated,embd,embed_code from video where VID='$videoid'");
list($gvdoid,$gvduid,$gvdotitle,$gvdodescr,$gvdokey,$gvdotype,$gvdoviewnumber,$grated,$embd,$embed_code) = mysql_fetch_row($getvideodetails);

// No 18+ video and no private video can be embedded, by illegally passing the video ID to the iframe
if ($grated == "1" || $gvdotype=="private")
{
echo "<b>YOU ARE TRYING TO WATCH A PRIVATE OR DISALLOWED VIDEO!</b>";
}
else
{

// Externally embedded videos should also add to the view video counter, so we add +1 to the video count...
$newview = $gvdoviewnumber + 1;
$updatevdodetails = mysql_query("update video set viewnumber='$newview',viewtime='".date("Y-m-d H:i:s")."' where VID='$videoid'");

if ($embd=='1') {
$embed_code = stripslashes($embed_code);
echo "$embed_code";
} else {

// Javascript detection of the user's installed Flash(TM) plugin, if any
echo "<script language=JavaScript src=$site_url/include/js/compressed/flash_detect.php></script>";

if ($config[stream] == 'php') {
video_to_session($gvdoid);
}

// Externally embedded videos can be a lot, for a huge site, and Smarty is rather slow, so...
// we simly will not be using templates in this file...

// Output the content to the browser
echo "
<script language=JavaScript type=text/javascript>
if(flashinstalled == 2){
  if(flashversion >= 9){
  <script type="text/javascript">
  adotube_embed = {
  avpid: 'M3xR59',
  runtime_location: '$site_url/include/adoe',
  player_video_stream_url: '$site_url/uploads/flvideo/$gvdoid.flv',
  player_video_thumbnail_url: '$site_url/tmp/player_frame/$gvdoid.jpg',
  player_video_page_url: 'null',
  video_identifier: ''
  };
  </script>
  <script type="text/javascript">
  <script type=\"text/javascript\" src=\"http://www.mysite.com/php/services/adoeRuntime/courier.js.php\"><'+'/script>
  <script type=\"text/javascript\" src=\"'+adoe_embed.runtime_location+'/swfobject/swfobject.js\"><'+'/script>
  <script type=\"text/javascript\" src=\"'+adoembed.runtime_location+'/js/sorge.js\"><'+'/script>
  </script>
  }
else{
document.write(\" <embed src=$site_url/include/js/swfobject/expressinstall.swf bgcolor=#FFFFFF width=425 height=367></embed> \");
  }
}
else{
   document.write(\"<div align=left style='font-size: 11px; background-color: #EEEEEE; border: 1px #BABDBF dashed;'>  You need Macromedia Flash Player<sup>TM</sup> 9, to watch this video. You don't even have Flash<sup>TM</sup> installed. Please click <a href=http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash target=_blank>HERE</a> to install it.</b> Close your browser or refresh the page after the install.</div>\");
}
</script>";

}
}
echo "<br><span style=\"font-weight: bold; color: #FF0000; font-size:12px;\">Watch more videos at <a href=$site_url target=_blank style=\"font-weight: bold; color: #FF0000; font-size:11px;\">$site_name</a>!</b>";
?>

 

there was an error on line 68 and 79 but I fixed it by adding  \"

 

but still I get a page that has this:

-------------------------------------------

else{ document.write("

 

(blank square here )

 

"); } } else{ document.write("

  You need Macromedia Flash PlayerTM 9, to watch this video. You don't even have FlashTM installed. Please click HERE to install it. Close your browser or refresh the page after the install.

"); }

Watch more videos at mysite.com!

 

--------------------------------------------

when I view the source source looks like this: ( seems as if it is outputing the source code with out processing it.  but it does get the  variables info passed thru.

 

<script language=JavaScript src=http://www.mysite.com/include/js/compressed/flash_detect.php></script>
<script language=JavaScript type=text/javascript>
if(flashinstalled == 2){
  if(flashversion >= 9){
  <script type="text/javascript">
  adotube_embed = {
  avpid: 'M3xR59',
  runtime_location: 'http://www.mysite.com/include/adotube',
  player_video_stream_url: 'http://www.mysite.com/uploads/flvideo/152.flv',
  player_video_thumbnail_url: 'http://www.mysite.com/tmp/player_frame/152.jpg',
  player_video_page_url: 'null',
  video_identifier: ''
  };
  </script>
  }
else{
document.write(" <embed src=http://www.mysite.com/include/js/swfobject/expressinstall.swf bgcolor=#FFFFFF width=425 height=367></embed> ");
  }
}
else{
   document.write("<div align=left style='font-size: 11px; background-color: #EEEEEE; border: 1px #BABDBF dashed;'>  You need Macromedia Flash Player<sup>TM</sup> 9, to watch this video. You don't even have Flash<sup>TM</sup> installed. Please click <a href=http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash target=_blank>HERE</a> to install it.</b> Close your browser or refresh the page after the install.</div>");
}
</script><script type="text/javascript">,
  <script type="text/javascript" src="http://www.mysite.com/php/services/Runtime/courier.js.php"><'+'/script>
  <script type="text/javascript" src="'+adoe_embed.runtime_location+'/swfobject/swfobject.js"><'+'/script>
  <script type="text/javascript" src="'+adoe_embed.runtime_location+'/js/sorge.js"><'+'/script>
  </script>
  <br><span style="font-weight: bold; color: #FF0000; font-size:12px;">Watch more videos at <a href=http://www.mysite.com target=_blank style="font-weight: bold; color: #FF0000; font-size:11px;">mysite.com</a>!</b>

OK i got it to work

but there is one thing.

 

there is a single  "coma"  that apears on the top of the code.

If i remove the coma (right after </script>, )  the entire script will not work.

to see this horrible "coma"  try this iframe code:

 

<iframe width=395 height=370 frameborder=0 border=0 scrolling=no src=http://www.shameblame.com/embed.php?video=486></iframe>

 

Any help would be apretiated.

 

here is the code:

-----------------------------------------

<?php

// Set the "VALID" flag, to include child files

define( '_VALID_CS', 1 );

 

session_start();

include("include/config.php");

include("include/header.php");

include("include/function.php");

sess_register();

 

// Register some vars, from config.php

$site_name = $config['site_name'];

$site_url = $config['BASE_URL'];

$videoid = mysql_real_escape_string($_REQUEST);

 

// Get the video info and set the session for the SWF video player

$getvideodetails = mysql_query("select VID,UID,title,description,keyword,type,viewnumber,rated,embd,embed_code from video where VID='$videoid'");

list($gvdoid,$gvduid,$gvdotitle,$gvdodescr,$gvdokey,$gvdotype,$gvdoviewnumber,$grated,$embd,$embed_code) = mysql_fetch_row($getvideodetails);

 

// No 18+ video and no private video can be embedded, by illegally passing the video ID to the iframe

if ($grated == "1" || $gvdotype=="private")

{

echo "<b>YOU ARE TRYING TO WATCH A PRIVATE OR DISALLOWED VIDEO!</b>";

}

else

{

 

// Externally embedded videos should also add to the view video counter, so we add +1 to the video count...

$newview = $gvdoviewnumber + 1;

$updatevdodetails = mysql_query("update video set viewnumber='$newview',viewtime='".date("Y-m-d H:i:s")."' where VID='$videoid'");

 

if ($embd=='1') {

$embed_code = stripslashes($embed_code);

echo "$embed_code";

} else {

 

if ($config[stream] == 'php') {

video_to_session($gvdoid);

}

 

// Output the content to the browser

echo "<script type=\"text/javascript\">

adotube_embed = {

avpid:'9DWHtr',

runtime_location:'http://www.mysite.com/include/adoe',

player_video_stream_url:'$site_url/uploads/flvideo/$gvdoid.flv',

player_video_thumbnail_url:'$site_url/tmp/player_frame/$gvdoid.jpg',

  }

     </script>, <--- This is the COMA that is killing me!

<script type=\"text/javascript\">

     document.write('<script type=\"text/javascript\" src=\"http://www.mysite.com/php/services/Runtime/courier.js.php\"><'+'/script>');

     document.write('<script type=\"text/javascript\" src=\"'+adotube_embed.runtime_location+'/swfobject/swfobject.js\"><'+'/script>');

     document.write('<script type=\"text/javascript\" src=\"'+adotube_embed.runtime_location+'/js/sorge.js\"><'+'/script>');

  </script>

<span style=\"font-weight: bold; color: #FF0000; font-size:12px;\">Watch more videos at <a href=$site_url target=_blank style=\"font-weight: bold; color: #FF0000; font-size:11px;\">$site_name</a>!</b>";

}

}

?>

---------------------------------

Any help is Greatly appreciated.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.