Jump to content

[SOLVED] Illogical PHP?


SireJoe

Recommended Posts

Ok, so heres what Im looking to do, and am half doing :P

 

I want my URL to redirect my users to a video page that will have a playlist dynamically created via PHP. The PHP doc will look in the given folder and spit out the .asx file (.asx are treated as .php on my server).

 

I have the file that can create the .asx's on the fly. I have the player that can play the .asx via the "?src=" within the URL. The only issue is, that when I get the media player to call the .asx file so that the code can create the playlist, I am unable to pass the information onto that file.

 

Uhh, so its like this:

 

videoplayer.php -> playlist.asx -> "?srcpath=" string -> create .asx from folder contents -> videoplayer.php plays playlist

 

I cannot get the ?srcpath= to my .asx PHP file. Whenever I try to query the string from my vidplayer.php page it strips the attached string. So all my .asx file sees is http://mydomain.com/playlist.asx NOT http://mydomain.com/playlist.asx?srcpath=folderhere

 

 

I dunno how clear this is. But what I need is to somehow get my string from the  vidplayer.php URL through to my playlist.asx.

 

 

 

playlist (fldrd.asx) code right now:

 

<?

 

$fld1 = $_SERVER['REQUEST_URI'];

$fld = $_SERVER['QUERY_STRING'];

$trimd = explode("srcpath=", $fld);

$folder= dir("/var/www/vhosts/mydomain.com/httpdocs/Members/vidgallery/$trimd[1]");

$path = "http://www.mydomain.com/Members/vidgallery/$trimd[1]/";

 

  echo "<ASX Version = \"3.0\">";

print "\n";

echo "<Title></Title>";

print "\n";

 

while($folderEntry=$folder->read()){

  if ($folderEntry !="fldrd.asx" & $folderEntry !="." & $folderEntry !="..")

  {

 

echo "<ENTRY>";

print "\n";

echo "<Title></Title>";

print "\n";

echo "<REF HREF=\"";

    echo $path;

    echo $folderEntry;

echo " />";

print "\n";

echo "</ENTRY>";

print "\n";

 

  }

}

 

$folder->close();

 

echo "</ASX>";

 

?>

 

 

 

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

 

URL strings being used:

 

http://www.mydomain.com/Members/vidgallery/qthigh.php?src=fldrd.asx?srcpath=MM/A

 

 

Media player looks like this:

 

<OBJECT id="VIDEO" width="720" height="640" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject">

<PARAM NAME="URL" VALUE="<? echo $_GET['src']; ?>">

<PARAM NAME="SendPlayStateChangeEvents" VALUE="True">

<PARAM NAME="AutoStart" VALUE="True">

<PARAM NAME="AllowScan" VALUE="Yes">

<PARAM NAME="EnablePositionControls" VALUE="Yes">

<PARAM NAME="Enabled" VALUE="Yes">

<PARAM NAME="ShowDisplay" VALUE="Yes">

<PARAM NAME="ShowGotoBar" VALUE="Yes">

<PARAM NAME="Prebuffer" VALUE="true">

<PARAM name="uiMode" value="full">

<PARAM name="PlayCount" value="1">

</OBJECT>

 

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

 

 

In any event, any help would be greatly appreciated!

 

Thanks.

Link to comment
Share on other sites

Use mod_rewrite to rewrite the links, so rather than:

 

http://mydomain.com/playlist.asx?srcpath=folderhere

 

It's:

 

http://mydomain.com/playlists/folderhere/playlist.asx

 

You can use mod_rewrite to pass the part as a parameter or just parse the $_SERVER['REQUEST_URI']

 

RewriteEngine On

RewriteRule ^playlists/(.*)/playlist.asx playlist.php?srcpath=$1

 

Read this:

 

http://www.ilovejackdaniels.com/mod_rewrite_cheat_sheet.png

Link to comment
Share on other sites

Hi,

 

$trimd = explode("srcpath=", $fld);

 

can you show us what in $trimd and kindly print $fld.

 

regards

 

 

It depends on the input in the URL. It either returns nothing, as with the case right now. Or will return the proper folder name. Its all based on .php?src=fldrd.asx?srcpath=dir/dir. In theory it should return " dir/dir " or to that effect.

Link to comment
Share on other sites

Use mod_rewrite to rewrite the links, so rather than:

 

http://mydomain.com/playlist.asx?srcpath=folderhere

 

It's:

 

http://mydomain.com/playlists/folderhere/playlist.asx

 

You can use mod_rewrite to pass the part as a parameter or just parse the $_SERVER['REQUEST_URI']

 

RewriteEngine On

RewriteRule ^playlists/(.*)/playlist.asx playlist.php?srcpath=$1

 

Read this:

 

http://www.ilovejackdaniels.com/mod_rewrite_cheat_sheet.png

 

 

If I do it that way, then I will need to have my .asx file in every folder that I have my media stored, correct? If so, thats what I am trying to avoid.

 

Also, if anyone hows how to sort this correctly, I would appreciate that too :P

Link to comment
Share on other sites

hi,

 

I see .php?src=fldrd.asx?srcpath=dir/dir in your post and can point you that instead of .php?src=fldrd.asx?srcpath=dir/dir you whould create url like

 

.php?src=fldrd.asx&srcpath=dir/dir

 

two question marks in the query string ...i never seen them before :-)

 

Link to comment
Share on other sites

hi,

 

I see .php?src=fldrd.asx?srcpath=dir/dir in your post and can point you that instead of .php?src=fldrd.asx?srcpath=dir/dir you whould create url like

 

.php?src=fldrd.asx&srcpath=dir/dir

 

two question marks in the query string ...i never seen them before :-)

 

 

I did that to pass on the string through to the .asx file. The other way with the ampersand leaves it off. Or so I was trying anyways.

 

There is only one way that I have tried that works in getting the string into the .asx page via the vidpage. that is an alteration in the URL that the media player uses. such as instead of fldrd.asx it will be fldrd.asx?srcpath=dir/dir (here: <PARAM NAME="URL" VALUE="<? echo $_GET['src']; ?>">) . The problem with that is though, that the media player no longer recognizes the file as a .asx. and cannot play the content.

 

I have tried direct folder inputs and a proper .asx file to see if I could use that variation, and it would just not play the file.

Link to comment
Share on other sites

Use mod_rewrite to rewrite the links, so rather than:

 

http://mydomain.com/playlist.asx?srcpath=folderhere

 

It's:

 

http://mydomain.com/playlists/folderhere/playlist.asx

 

You can use mod_rewrite to pass the part as a parameter or just parse the $_SERVER['REQUEST_URI']

 

RewriteEngine On

RewriteRule ^playlists/(.*)/playlist.asx playlist.php?srcpath=$1

 

Read this:

 

http://www.ilovejackdaniels.com/mod_rewrite_cheat_sheet.png

 

 

Ok, so i have been trying this, and my server does not redirect me for some reason. I have tried to simplify the rewrite rule and it still seems to not respond. I'm not sure what to do here....

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.