24, July 2008

[HELP] HTTP upload - webmaster forum

 
Webdigity webmaster forums
This forum shares its ad revenue with its members!
[ Home | Help | Search | Forum's Shop | Archive | Login | Register | Webmaster Directory ]
Webdigity Webmaster Forums  >  Web site promotion  >  Promoting & building a forum  >  SMF moding & promoting
Topic: [HELP] HTTP upload
« previous next »
Pages: [1] Print

Author Topic: [HELP] HTTP upload  (Read 1265 times)
My name is Bong, James Bong
*
Posts: 11
80 credits
Members referred : 0


« on: Nov 29, 2006, 03:31:30 PM »

I wrote this script for http upload, i mean, files uploaded via http links. I want to integrate n my SMF 1.1rc3 probably 1.1 final.

So simple, have a look into this code.
Code:
<?
$defaultDest = "./upload";
$password = "";
$os = "1";
$submit="hah!";
echo "<form method=\"POST\" action=\"$PHP_SELF\">";
echo "<fieldset>\n<legend>http uploader</legend>\n";
echo "<label for=\"file\">File Url</label><br>";
echo "Example: http://bla.com/file.ext<br>";
echo "<input type=\"text\" name=\"file\" id=\"file\" tabindex=\"1\" value=\"\"><br>";
echo "<label for=\"new\">New file name</label><br>";
echo "Example: file.ext<br>";
echo "<input type=\"text\" name=\"new\" id=\"new\" tabindex=\"2\" value=\"\"><br>";
if ($password) {
echo "<label for=\"password\">Password</label><br>";
echo "<input type=\"password\" name=\"password\" id=\"password\" tabindex=\"3\" value=\"\"><br>";
}
echo "<p><input name=\"submit\" type=\"submit\" id=\"submit\" value=\"submit\"></p>";
echo "</fieldset>\n</form>";

$submit = $_POST['submit'];
if($submit) {
if($password) {
if ($_POST['password']!=$password) {
  echo "Password incorrect!";
  } else {
  $access = "09023578353";
  }
   } else {
$access = "09023578353";
}


if($access=="09023578353") {

if($os==2) {
$slash="\\";
} else {
$slash="/";
}

$file = $_POST['file'];
$newfilename = $_POST['new'];

if($_POST['otherdest']) {
$dest = $_GET['otherdest'];
} else {
$dest = $defaultDest;
}

$ds = array($dest, $slash, $newfilename);
$ds = implode("", $ds);

if (file_exists($ds)) {
echo "<p>File already exists! <br>\n Adding random digits to beginning of filename.</p>\n";
$ds = array($dest, $slash, rand(0,9999), $newfilename);
$ds = implode("", $ds);
}

echo "<p>New destination $ds</p>\n";
if (!copy($file, $ds)) {
echo "<p>Was unable to copy $file <br>\n See if your path and destination are correct.</p> \n";
} else {
echo "<p><strong>Copy successful!</strong></p> \n";
}}}
?>
you might have understand it. :-) Now, i want to input above fields below attachment filed. Only certain groups are allowed to use this function. Can you rewrite it as a mod, giving full permissions to do it. ;-)
Global Moderator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 6280
38506 credits
Members referred : 374


It's time to use PHP5!


« Reply #1 on: Nov 29, 2006, 03:33:15 PM »

how much do you pay? Cheesy


Last blog : 4th of July Lottery from TemplateMonster.com
My name is Bong, James Bong
*
Posts: 11
80 credits
Members referred : 0


« Reply #2 on: Nov 29, 2006, 03:40:26 PM »

Lol...For integrating also? I can't pay.... Sorry to say it, i can't pay for this one. But, i will pay for other mods, if i like from yr site...
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 7974
40801 credits
Members referred : 3



« Reply #3 on: Nov 29, 2006, 03:46:30 PM »

May I ask what is the purpose of this script? Do you want to integrate a file hosting to your forum maybe?

I took a look at it, and found some things that you can fix :

1) Replace this :

if($os==2) {
$slash="\\";
} else {
$slash="/";
}


with this :

$slash = (strtoupper(substr(PHP_OS03)) === "WIN")? '\' : '/';


2) Replace this :

if (file_exists($ds)) {
echo 
"<p>File already exists! <br>\n Adding random digits to beginning of filename.</p>\n";
$ds = array($dest$slashrand(0,9999), $newfilename);
$ds implode(""$ds);
}


with this :

if (file_exists($ds)) {
echo 
"<p>File already exists! <br>\n Adding random digits to beginning of filename.</p>\n";
do {
 
$ds implode('',array($dest$slashrand(0,9999), $newfilename));//Actually this can be done faster but I am a little bored right now
} while ( file_exists($ds) )


BTW the script as is, is unsecure, as the user can actually rewrite files of your server, as you don't have any restriction on the directory that he/she is uploading to.

Maybe you should fix that Smiley

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy

Last blog : MIA - Where Nick and Tim
My name is Bong, James Bong
*
Posts: 11
80 credits
Members referred : 0


« Reply #4 on: Nov 29, 2006, 03:53:38 PM »

Like yr idea! Hope it's a matter of 10min? Yeah, it's a file hosting n forum. Can you please do it brother as a mod. I will be happy with it!
My name is Bong, James Bong
*
Posts: 11
80 credits
Members referred : 0


« Reply #5 on: Nov 29, 2006, 03:55:16 PM »

Like yr idea! Hope it's a matter of 10min? Yeah, it's a file hosting n forum. Can you please do it brother as a mod. I will be happy with it!

Didn't get, how user can rewrite files. Because did you see code for random digit. When you upload same file, it adds random digit. So i didn't find, how it rewrites?
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 7974
40801 credits
Members referred : 3



« Reply #6 on: Nov 29, 2006, 03:58:04 PM »

Quote
Didn't get, how user can rewrite files. Because did you see code for random digit. When you upload same file, it adds random digit. So i didn't find, how it rewrites?

The user can add a new filename in the script, in which he/she can actually use a full path in the system......

Like yr idea! Hope it's a matter of 10min? Yeah, it's a file hosting n forum. Can you please do it brother as a mod. I will be happy with it!

That would took me a lot of time, and in this stage I have too much work to do (actually I have been late for a couple of small projects)

Maybe later, but I can't promise anything.

Of course if you want it so much you can allways hire me for stuff like this Wink

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy

Last blog : MIA - Where Nick and Tim
My name is Bong, James Bong
*
Posts: 11
80 credits
Members referred : 0


« Reply #7 on: Nov 29, 2006, 04:21:46 PM »

Hmmm, Sad anyone?
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 7974
40801 credits
Members referred : 3



« Reply #8 on: Nov 29, 2006, 04:25:40 PM »

Hmmm, Sad anyone?

Don't expect people to spend so much time for something that is valuable only for you.

If you want my advice, pay to get it, or learn how to do it. After all it isn't so difficult to modify SMF Wink

You will have to start from :

/Sources/Post.php
/Themes/xxx/Post.template.php

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy

Last blog : MIA - Where Nick and Tim
My name is Bong, James Bong
*
Posts: 11
80 credits
Members referred : 0


« Reply #9 on: Nov 29, 2006, 04:33:20 PM »

Yeah brothr, i tried it...But didn't able to do it. Hope you will spend ten minutes to complete it. I am confused, how does it take more than 10 minutes. The main problem is, option should be available for only few allowed groups :'-(
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 7974
40801 credits
Members referred : 3



« Reply #10 on: Nov 29, 2006, 04:40:07 PM »

If it was 10 minutes, I would allready had it done, and as I said before I am very busy these days.....

Maybe I'll help you later on this.

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy

Last blog : MIA - Where Nick and Tim
My name is Bong, James Bong
*
Posts: 11
80 credits
Members referred : 0


« Reply #11 on: Nov 29, 2006, 04:42:27 PM »

Hope you will make it as a mod, when i get my smf 1.1final
My name is Bong, James Bong
*
Posts: 11
80 credits
Members referred : 0


« Reply #12 on: Jan 02, 2007, 10:35:57 AM »

Any help? Now i am planning to pay!
I am a metal monkey!
Administrator
Community Supporter ?
Jedai Sword Master
*****
Gender: Male
Posts: 7974
40801 credits
Members referred : 3



« Reply #13 on: Jan 02, 2007, 01:22:56 PM »

Any help? Now i am planning to pay!

Can you send an email to nikolas at webdigity dot com and tell me what exactly do you want to do?

Trial and Error my two best teachers Cool
Join us @ facebook Visit through proxy

Last blog : MIA - Where Nick and Tim
My name is Bong, James Bong
*
Posts: 11
80 credits
Members referred : 0


« Reply #14 on: Jan 02, 2007, 01:54:53 PM »

mail sent
Trackback URI for this entry : http://www.webdigity.com/trackback.php?topic=4980
Tags : forums simple machines forum hosting Bookmark this thread : Digg Del.icio.us Dzone more....

Topic sponsors:
Get a permanent link here for $1.99!


Pages: [1] Print 
Webdigity Webmaster Forums  >  Web site promotion  >  Promoting & building a forum  >  SMF moding & promoting
Topic: [HELP] HTTP upload
« previous next »
Jump to:
User Area
Welcome, Guest. Please login or register.
Did you miss your activation email?
Jul 24, 2008, 06:32:07 AM





Login with username, password and session length

Donate to our community, and get a permanent link back to your site!

Donate to our community, and get a permanent link back to your site!


Forum Statistics
Total Posts: 35.708
Total Topics: 7.375
Total Members: 3.705
Tutorials : 56
Resources : 143
Designs : 220
Latest Member: jino@webdco.com

21 Guests, 5 Users online :

13 users online today:



Readers

Web Design Gallery · Whois Lookup · Pagerank · Tag Browsing · Lo-fi version · Syndication · Webmaster forum history · Advertise
Developed by HumanWorks © 2005 - 2008 Webdigity webmaster community · sublime directory
Webdigity Webmaster Forums | Powered by SMF 1.0.12. © 2001-2005, Lewis Media. All Rights Reserved.