Jump to content

php embed error


Fsoft

Recommended Posts

Hello,

 

I use this code for my video.php

 

<?php

$permission = "yes";

echo "<embed height=\"399\" width=\"415\" volume=\"0\" showtracker=\"0\" showpositioncontrols=\"0\" showgotobar=\"0\" showdisplay=\"0\" showaudiocontrols=\"1\" showcontrols=\"1\" sendplaystatechangeevents=\"-1\" sendmousemoveevents=\"0\" sendmouseclickevents=\"0\" sendkeyboardevents=\"0\" senderrorevents=\"-1\" sendwarningevents=\"-1\" sendopenstatechangeevents=\"-1\" enabletracker=\"-1\" enablefullscreencontrols=\"1\" enablepositioncontrols=\"-1\" enablecontextmenu=\"0\" enabled=\"-1\" displaysize=\"4\" displaymode=\"0\" allowchangedisplaysize=\"-1\" allowscan=\"-1\" autosize=\"-1\" showstatusbar=\"1\" autostart=\"1\" allowfullscreen=\"true\" bgcolor=\"#000000\" id=\"wmplayer\" pluginspage=\"http://www.microsoft.com/Windows/MediaPlayer/\" type=\"application/x-mplayer2\" src=\"link.php\" mediawrapchecked=\"true\"/>";

?>

 

and link.php is

 

<?php

if($permission == "yes")
{
echo "mms://site.com/stream";
}else
{
echo "sorry but you do not have the permission to see this stream";
}

?>

 

 

Now as you can see, on the video.php, the variable $permission gets a value of yes. After when I echo the embed code out, in that file, I put src=link.php ; normally when "src" hits link.php it must get my stream link and start working, but actually this is not the case.

 

It doesn't work :(..

 

When I simply require(); or include(); my link.php in video.php (to check if $permission is working fine). It shows me up the correct mms link. But it is not working with the <embed> .

 

I am doing this, because I don't want others to see my stream code (mms code). In this way, they will only see link.php , and if they try to browse link.php directly, the $permission will be blank (empty) and they will get the error.

 

Every thing is suppose to work normal, but it doesn't.. Please help..

 

Thanks  alot.

 

Faisal!!!!!

Link to comment
Share on other sites

Another separate file just can't know what variables you have declared in some other file. If this was the case.. imagine you have huge application with thousands of variables and hundreds of different files. It would probably drive you crazy when your variables would override each other at some point... You can use for example session variables for moving the variable to another file. Just start session on both files in the beginning and set the $_SESSION['permissions'] in video.php. Then you can use it in link.php.

 

video.php

<?php
session_start();
$_SESSION['permissions'] = 'yes';
.....

 

link.php

<?php
session_start();

if (isset($_SESSION['permissions']) && $_SESSION['permissions'] === 'yes')
{
   // do something..
}

Link to comment
Share on other sites

Another separate file just can't know what variables you have declared in some other file. If this was the case.. imagine you have huge application with thousands of variables and hundreds of different files. It would probably drive you crazy when your variables would override each other at some point... You can use for example session variables for moving the variable to another file. Just start session on both files in the beginning and set the $_SESSION['permissions'] in video.php. Then you can use it in link.php.

 

video.php

<?php
session_start();
$_SESSION['permissions'] = 'yes';
.....

 

link.php

<?php
session_start();

if (isset($_SESSION['permissions']) && $_SESSION['permissions'] === 'yes')
{
   // do something..
}

 

Well, using your solution, I get two problem(s).

 

1. After visiting one time (video.php) some one makes a session, and that session is valid for 25 minutes, after if some one directly access the link.php, he can easily see the link.

 

2. The player still doesn't play up the media, even after using SESSION, when I src=link.php

It doesn't play the data :( and when I visit link.php directly, it shows mms link.

 

Help please.

 

FAISAL!

Link to comment
Share on other sites

Not sure what you mean? But, if mr A comes to video.php and goes through link to link.php mr A has session set. Then if just little after Mr B tries to directly to link.php Mr B does not have the $_SESSION['permissions'] set to anything. Mr B Starts a session yes, but he cant see things that you have declared in the if clause which checks that if the $_SESSION['permissions'] is set to 'yes'.

Link to comment
Share on other sites

Well,

 

The real reason of doing this all is , not any one else to know our real mms code.

 

Now, if you see code carefully, I want users to visit video.php (in order to get the link of link.php get working).

 

Lets be more logical, I know how to do this with any thing, such as text, or images, but currectly this <embed> src="link.php"

 

Is not working, so I am trying to find out some good solution, I want the mms link staying inside of link.php must only load only if video.php is being loaded, if some one tries to directly access link.php he shouldn't get the mms link.

 

He is suppose to get an error saying, that please visit the video.php in order to video the mms video.

 

I hope I was clear enough, isn't??

 

FAISAL :)

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.