• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 180
  • Last Modified:

Flash htaccess and loadsound

I have this simple script:
url = "http://www.domain.com/file.mp3";
player2 = new Sound();
player2.loadSound(url, true);

but now my file.mp3 is behind a .htaccess and it require I send a user and password.. I see I can send the user and password from the header, but I don't realy understand how I can send a header with the loadsound... someone have any idea how I can send the user password for I can get the mp3?

0
Yard072999
Asked:
Yard072999
  • 5
  • 4
1 Solution
 
hsmtpCommented:
Use it this way:

url = "http://login:password@www.domain.com/file.mp3";
player2 = new Sound();
player2.loadSound(url, true);
0
 
hsmtpCommented:
But anyone can decompile your movie and see your login and password.
0
 
Yard072999Author Commented:
I already try, but it don't work it seem that only work for ftp and not for http...
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Yard072999Author Commented:
bah I don't care about that :), because the user will write his own user and password into a textbox in the flash...
0
 
hsmtpCommented:
If you have htaccess and modeRewrite available on your server, you may use URL rewrite from

http://www.domain.com/music/login/password/file.mp3

to

http://login:password@www.domain.com/file.mp3


Here is the rule for .htaccess:

RewriteRule      music/([^/]+)/([^/]+)/([^/]+)$      http://$1:$2@www.domain.com/$3
0
 
hsmtpCommented:
Don't forget to turn on mod_rewrite engine:

RewriteEngine      on
0
 
hsmtpCommented:
Damn, looks like this rule will simply redirect you to needed location. It may not work.

Maybe you have some PHP language here? So you can write your own program for checking login and password and giving the file?
0
 
Yard072999Author Commented:
hmm, don't work :), I think I will use php and send the username and password in the url like ww.domain.com/mp3.mp3?user=thing&pass=something... I think is the best way... I will leave this question open for some moment in case someone have any idea :) else I will give you the point the idea of php and loginpassword :)
0
 
Yard072999Author Commented:
I think is the best solution for using the php script in this case.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 5
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now