NameSilo

[Need Php help] Code modification needed - copy pswd protected file form url to my server

Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
SpaceshipSpaceship
Watch
Impact
35
hello
i use the script below to move a file on another server to mine just by entering the file url and choosing the name i want
this is working perfectly but i want to move a password protected file by this script how can i modify it so that it works fine ?


PHP:
<?php
if ($_GET[xfer]) {
if ($_POST[from] == "") {
print "You forgot to enter a url.";
} else {
copy("$_POST[from]", "$_POST[to]");
$size = round((filesize($_POST[to])/1000000), 3);
print "Transfer complete. <br>
<a><a href=\"$_POST[from]\">$_POST[from]</a><br>
<a><a href=\"$_POST[to]\">$_POST[to]</a> : $size MB";
}
} else {
print "<form action=\"$PHP_SELF?xfer=true\" method=post>
from(http://): <input name=from><br>
to(filename): <input name=to><br>
<input type=submit value=\"transload\">";
}
?>
 
Last edited:
0
Close
The views expressed on this page by users and staff are their own, not those of NamePros.
GoDaddyGoDaddy
Your code DOESN'T actually work. I can see this by inspection.

Did you write it yourself or just "get it" from someone? Did you even run it yet?
 
0
Close
yes it works
i use it to copy a certain file on a server into mine
i just enter the URL and new name on my server it words so smoothly :)
BUT i want a way to do the same thing for password protected files top move them to my server :)

any ideas
 
0
Close
Hi,

The script looks like it will work to me. I'd suggest putting quotes round your array keys for future compatibility.

To copy a page which requires http authentication, you can use the following in your "from" input:

http://user:[email protected]

If the page you are copying from is cookie or session protected, then I think you'll have to use something much more complicated.

Edit: Disabled smiles
 
Last edited:
0
Close
This script steals peoples files? and you want it to steal peoples password protected files?

Am I right?
 
0
Close
well Morph not exactly :D
want to use it instead of downloading a database and reupload i'll just move it online because if slow down/upload speed i got :)

---------- Post added at 09:31 PM ---------- Previous post was at 09:24 PM ----------

btw qbert220 tried this way before :( no luck
 
0
Close
rcep, that code doesn't work. I guarantee it. Look for syntax errors. You'll find a dozen.
 
0
Close
Last edited:
0
Close
hello
i use the script below to move a file on another server to mine just by entering the file url and choosing the name i want
this is working perfectly but i want to move a password protected file by this script how can i modify it so that it works fine ?


PHP:
<?php
if ($_GET[xfer]) {
if ($_POST[from] == "") {
print "You forgot to enter a url.";
} else {
copy("$_POST[from]", "$_POST[to]");
$size = round((filesize($_POST[to])/1000000), 3);
print "Transfer complete. <br>
<a><a href=\"$_POST[from]\">$_POST[from]</a><br>
<a><a href=\"$_POST[to]\">$_POST[to]</a> : $size MB";
}
} else {
print "<form action=\"$PHP_SELF?xfer=true\" method=post>
from(http://): <input name=from><br>
to(filename): <input name=to><br>
<input type=submit value=\"transload\">";
}
?>
Well at least you fixed your epic syntax errors on your original post:

Last edited by rcep; Today at 01:48 PM.

Now the question is, why are you wanting to copy files like this, and why password-protected files? What form of authentication protects the files?

Also, did you notice there's some huge and obvious security flaws in your script?
 
0
Close
btw qbert220 tried this way before :( no luck

I guess the pages you want to copy are not http password protected. What form of password protection do they use? If they are cookie or session protected, then you'll need something more complicated. It is possible to support cookies with http wrappers, but not obvious. Using libcurl might be a better choice if you need to take this route.
 
1
Close
s

I guess the pages you want to copy are not http password protected. What form of password protection do they use? If they are cookie or session protected, then you'll need something more complicated. It is possible to support cookies with http wrappers, but not obvious. Using libcurl might be a better choice if you need to take this route.

Its normal http authentication no sessions for such files
ill pm u more details you will understand what i mean
:|
 
0
Close
AIVikingsAIVikings

We're social

Escrow.com
Spaceship
CryptoExchange.com
Domain Recover

NamePros updates

Quick replies: search, your most used replies, and more on every post
Quick replies are easier to find and use now. The quick reply menu has a search box. Type a few letters to find the reply you want. A...
AIVikings
Catchy
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back