Solved

background process in php

Posted on 2004-10-13
4
226 Views
Last Modified: 2006-11-17
Hello,   I have a screen that will be displaying a movie created for windows media player.  While this movie is running I need javascript to kick off a  background process to update the movie.  This could happen several times while the movie is running.  Can I write the background process in php?  will it popup a little window or can I write it completely in the background (preferable).  If I can not write it that way can I integrate a java file into the mix?  Lots of stuff to this question so I appreciate the help!
0
Comment
Question by:JGoyer
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 49

Expert Comment

by:Roonaan
ID: 12299019
What do you mean by "update the movie"? And why would this process happen frequently?

As you use javascript it is never a problem to call a php script in the background. It is just the question what it is you need the php script to do and how you want it to output its data.

There are a lot of ways:
- use process.php?ext=.png, let the script first return a png and then have it do some maintainance processing.
- use a iframe and call the script in there.
- let javascript add a <script src="somephp.php"></script> to the document contents and let the script return javascript output.

Please give us more details as to what it is you need.

-r-
0
 
LVL 2

Author Comment

by:JGoyer
ID: 12299176
More details:  The movie is to seperated out into multiple modules.  The viewer has the option of watching it in its entirety or stopping at somepoint.  We need to keep track of which modules they have completed so that when they come back to the movie they can go right back to where they were.  So, once they reach the end of module 1 javascript kicks off a call to a php process (how does it do that?) that process runs in a seperate window (output something like you have finished module one continue to module 2?) if they click yes the javascript window goes away and the next module starts up, if they click no they go to another screen.  The part about going on to the next mod in the same screen is pretty key also.  Thanks for you time and whatever you can come up with in this mess ;-)

JGoyer

ps what is an iframe?
0
 
LVL 49

Accepted Solution

by:
Roonaan earned 500 total points
ID: 12299417
An iframe is inline frame. And can be used to display another website into a rectangular display on a place you would like it to display.

Personally, I don't know how javascript is going to detect when the moviepart is stopped. But from that point on, it would be quite 'easy'. You would write a function in javascript like the one i'll write below:

<script type="text/javascript">
function run_php_window(currentmovieid)
{
    window.open('continue.php?movieid=' + currentmovieid, 'continueWindow', 'height=240,width=320');
}
</script>

Continue.php would then look something like this:
stage 1 is the stage where the visitor gets asked wether or not he would like to continue.
stage 2 is the stage where we will redirect the parent window.
<?php

$movieid = $_GET['movieid'];
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
 $stage = 2;
}
else
{
 $stage = 1;
}

if($stage == 1)
{
?>
<form method="post" action="<?php echo $_SERVER['PHP_SELF'].'?movieid='.$movieid;?>">
<input type="submit" name="movie_next" value="Goto next module" />
<input type="submit" name="movie_stop" value="Call it a day" />
</form>
<?php
}
elseif($stage == 2)
{
 if(isset($_POST['movie_next']))
   $parenturl = 'url_of_next_module';
 else
   $parenturl = 'url_of_the_other_screen';
 ?>
 <html>
  <head>
   <title>Handling your request</title>
   <script type="text/javascript">
   function go()
   {
    window.opener.location.href="<?php echo $parenturl;?>";
    window.close();
   }
   </script>
  </head>
  <body onload="go();">
    You request will be handled appropriately. You will be directed to:
    <p><a target="_blank" href="<?php echo $parenturl;?>"><?php echo $parenturl;?></a>.</p>
    If redirection fails. Please click the link above and close this window.
  </body>
  </html>
<?php  
}
?>

This would give you a popup window asking what people want to do and then handling accordingly.

Regards

-r-
0
 
LVL 2

Author Comment

by:JGoyer
ID: 12322584
Thanks a ton!!
0

Featured Post

Revamp Your Training Process

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
php error 27 61
htaccess block all countries but the US 4 41
$_GET call between URL 3 45
Modify Filter to cause a field to be not Required 3 30
Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question