Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
In the following php code to embed wmv file in a webpage, is it possible to list more than one wmv file (so that I do not have to create one php file for each very one wmv file)? Would appreciate if someone could help. Thank you.
<?php
session_start();
error_reporting(0);
$file = $_REQUEST["file"];if ($file == "name") {
$open = 'juliet.wmv';
if(is_readable($open))
{
header("Content-type: video/x-ms-wmv");
readfile($open);
exit;
}
}
// output 404 header if file not specified or not found:
header("HTTP/1.0 404 Not Found");
?>

something like this:
<?php
session_start();
error_reporting(0);
$file = $_REQUEST["file"];$myfiles = array ('juliet.wmv', 'romeo.wmv');
if (in_array ($file, $myfiles) {
$open = $file;
if(is_readable($open))
{
header("Content-type: video/x-ms-wmv");
readfile($open);
exit;
}
}
// output 404 header if file not specified or not found:
header("HTTP/1.0 404 Not Found");
?>
add all your files to $myfiles array separated by commasupload all the wmvs to the same folder where juliet.wmv is.
then you can create list of links:yourfile.php?file=juliet.wmw
yourfile.php?file=romeo.wmv...and so on
---
Fubar

Thank you so much for your input. Would appreciate if you could assist me further with the following.
The above php code rendered the error message below:
Parse error: parse error, unexpected '{' in /home/www/domain.com/wmv.php on line 8
When I remove the '{' on line 8 and re-upload the php file, another message appeared:
Parse error: parse error, unexpected T_VARIABLE in /home/www/domain.com/wmv.php on line 9

Hello, yes sorry didn't test it out. A small syntax error.
In line 8 it should be:
if (in_array ($file, $myfiles)) {
Will it work now?---
Fubar

Good evening, Laler,
Further to my earlier email, I have just noticed it is easy for other people to trace the source of the wmv file, ie www.domain.com/juliet.wmv and dowmload and save the file.
I wonder if there is anyway to go around it?
Would appreciate your advice.
Hi,First we must remember that when something is played or viewed, whether they're images, text, music, or movies, it means those something is already downloaded and can be saved.
In other words, people may save a movie by pointing his/her handycam to the monitor :)
---
We can of course do something to make people work harder when they want to save our content. This "something" cannot be explained easily. There're so many methods, each requires different knowledge. While none of them 100% guarantees that the content cannot be saved.
A basic and simple method is probably by disallowing "direct access", so people can't just type yoursite.com/juliet.wmv to download the file. This can be done by modifying your .htaccess file
> Best method (being used by rapidshare and the like)
In theory:
Put the wmvs in a restricted directory.
Only the streamer file has access to that directory.
People get different link each time, can only be used once.
The link will use the streamer file to read the requested wmv (in the restricted directory), and stream it out.
> Implementation
I also need to read and learn alot if Im going to implement these :D
---
Fubar

Thank you very much for your kind input, Laler. You are excellent.
Strange, the message I posted here (as appended below )before your above message has gone missing!!
"Thank you very much for your kind assistance. It works now.
You are really brilliant."

i need some insert code for mssql.
please help.
<?
//session_start();
mssql_connect("127.0.0.1","sa","") or die("connection failed");
$conn=mssql_connect("127.0.0.1","sa","");
mssql_select_db("[e-lib]") or die("db failed");
$sql="SELECT user_id FROM login WHERE username='$_POST[us1]' and password='$_POST[pass]'";
$rs=mssql_query($sql,$conn);
$row1=mssql_fetch_array($rs);
$num = @mssql_num_rows($rs);
if ($num != 0)
{print("<h3> wellcom</h3>");
mssql_connect("127.0.0.1","sa","") or die("connection failed");
$conn=mssql_connect("127.0.0.1","sa","");
mssql_select_db("[e-lib]") or die("db failed");
$rs=mssql_query($sql,$conn);
$row2=mssql_fetch_array($rs);
echo "<h4>please log in</h4>";
print ("login");
$_SESSION['family']=$row2[0];
mssql_close($conn);
}
else
{
print("<h3>illegal</h3>");
print("<h3>olease</h3>");
print("signup");
}
?>fafa

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |