Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with including an html/flash file

Status
Not open for further replies.

steveracicot

Programmer
Jun 23, 2001
10
US
Hello,

Is there anyone out there that can help me understand why php is having trouble including an html file that calls a flash file.

I have a client who wants to display a "flash movie" on his site, but only to members. I have set it up so that the php scripts checks for membership, and then calls the appropriate html file. Yet the flash "movie" doesnt come up in the screen. The path to the file is correct because the title bar brings up a different title but the page is all white and it page seems to stop loading half-way through.

The server has php 4.3.0 . Can anyone guide me, or lend me there words of wisdom to help resolve this issue.
 
I don't know of a common resolution for that, because this is the first I've ever heard of it.

Whats your code look like that makes all your calls?

- "Delightfully confusing..." raves The New York Times

-kas
 
how do u go about doing it? do u use a redirection code?

Known is handfull, Unknown is worldfull
 
I have had what sounds like the same or similar problem with an ASP page that called a Flash file.

I got around it by changing the <object> and <embed> tags within the HTML portion of the code. Don't ask me why it didnt work, or why it does now. I really don't like ASP that much :)
Part of the problem was down to a crappy CMS though and I had to use a javascript redirect to gt it to work properly.

Instead of redirecting, why not try using a conditional that echoes out the <object> tags IF the user is a member?
 
Are you sure the reference to the object has the correct path? All relative paths are seen from the scripts point of view - does the flah movie reside in that relative path? Try using the absolute path from the web servers point of view.

Also:
Look in the web server logs to learn where the process gets stuck. That will help to find the point where it fails.
 
It is a Linux Red Hat box. with php4.3.1


The files all reside in the files/ folder which is one folder inside httpdocs folder ( ROOT ) .

My test environment can seen here:

69.0.210.42/tiger_den_archive.php


I am also enclosing the code from the 2 relevant pages. Hopefully someone can shed some more light on this.


Steve



<!----- archive.php -->
session_start();
require_once ('includes/common.inc.php');

$html = new Html();
if (!is_object($html))
{
trigger_error(UNDEF_HTML, E_USER_ERROR);
}
store ($html,HTML);
$member = get(MEMBER);
print $member;
if (!is_object($member))
{
trigger_error(UNDEF_MEMBER, E_USER_ERROR);
}
is_member($member);

$date = $_GET['date'];
$show = $_GET['show'];

$path = &quot;files/$show-$date.html&quot;;

// print $path;
include &quot;$path&quot;;




<!---- End of archive.php -->


<!----- start of tiger_den_archive.php ---->

session_start();
require_once ('includes/common.inc.php');

$member = get(MEMBER);

if (!is_object($member))
{
trigger_error(UNDEF_MEMBER, E_USER_ERROR);
}

is_member($member); // checks if they are member if they are not -- they are redirected to login.


print &quot;<blockquote>\n&quot;;
print &quot;<img src='images/title_archived_shows.jpg'>\n&quot;;
print &quot;<h2>The Morning Growl</h2>\n&quot;;

print &quot;<blockquote>\n&quot;;
for ( $i =1; $i<14; $i++)
{
$j = $i *24;
$yesterday = date(&quot;m-d-Y&quot;,time()-$j*3600);
$day = date(&quot;l&quot;, time()-$j*3600);
if ( ($day == &quot;Saturday&quot;) || ($day == &quot;Sunday&quot;) )
{
print &quot;<br />&quot;;
}
else
{
print $day . &quot;: <a href='&quot;. ARCHIVE_PAGE .&quot;?date=$yesterday&show=MG' target='_blank'>&quot;. $yesterday . &quot;</a><br />&quot;;
}
}
print &quot;</blockquote>\n&quot;;
print &quot;<br /><h2>The Tom O'Brien Show</h2>\n&quot;;
print &quot;<blockquote>\n&quot;;
for ( $i =1; $i<14; $i++)
{
$j = $i *24;
$yesterday = date(&quot;m-d-Y&quot;,time()-$j*3600);
$day = date(&quot;l&quot;, time()-$j*3600);
if ( ($day == &quot;Saturday&quot;) || ($day == &quot;Sunday&quot;) )
{
print &quot;<br />&quot;;
}
else
{
print $day . &quot;: <a href='&quot;. ARCHIVE_PAGE .&quot;?date=$yesterday&show=TOS' target='_blank'>&quot;. $yesterday . &quot;</a><br />&quot;;
}
}
print &quot;</blockquote>\n&quot;;
print &quot;</blockquote>\n&quot;;


<!---- end of tiger_den_archive.php ---->
 
All i get is an open_basedir restriction.
That means you should check your php.ini or use phpinfo() to see what is set as the open_basedir.
The file that's tried to be loaded is outside that allowed path and can't be opened.
 
the open_basedir reads: /home/httpd/vhosts/test.com/httpdocs:/tmp

which is correct.

and the files are located here:
/home/httpd/vhosts/test.com/httpdocs/files/*****

So why is throwing that error?

Steve
 
The error changed.
Now you are sending something in /home/httpd/vhosts/test.com/httpdocs/archive.php:13
and
/home/httpd/vhosts/test.com/httpdocs/includes/common.inc.php Line: 536 tries to write headers.

Headers need to be the very first output on the page.

There is an object error that probably triggers the output.
 
Here's the output:
Error number: 2 Error: main() [function.main]: open_basedir restriction in effect. File(/files/MG-08-25-2003.html) is not within the allowed path(s): (/home/httpd/vhosts/test.com/httpdocs) File: /home/httpd/vhosts/test.com/httpdocs/archive.php Line: 26

Note that it says File(/files/MG-08-25-2003.html) which indicates to me that the path is looking for the server root. These paths need to be file system specific, not according to the httpd document_root.
 
So does that mean I have to list the entire path to the file like:
/home/httpd/vhosts/test.com/httpdocs/files/MG-08-25-2003.html ???


The reason you got a different error message is because I was making some changes and actually working on it.


Steve
 
You are right.
The PHP interpreter works with absolute file paths. It is not web server oriented. It is triggered by the web server, but as such it works like a system function.

This explains why /files/ would be outside of the allowed open_basedir. When you use the absolute file system path all will work.

After all, this had nothing to do with Flash!
 
It still does not work.

I tried /home/httpd/vhosts/test.com/httpdocs/files/MG-08-22-2003.html

and simply files/MG-08-22-2003.html

The browser title comes up correctly. So that leads me to believe that it is calling the html file correctly but it seems like it runs out of gas to be able to load the flash object listed in the html file.



 
From the outside world I can't get anything but the error message.
Use the full file system path. Then we'll inspect what the server is delivering.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top