Check my script?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

lol, no... if your going to do it that then take the "$dir = out
should be:

Code: Select all

copy($_FILES['userfile']['tmp_name'], $_SERVER['DOCUMENT_ROOT'] . "/home/hsphere/local/home/monkeyj/monkeyblast.com/anims/upload"); ");
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

There is a parse error is because you had an extra quotatation and ;

Code: Select all

<?php
copy($_FILES['userfile']['tmp_name'], $_SERVER['DOCUMENT_ROOT'] . "/home/hsphere/local/home/monkeyj/monkeyblast.com/anims/upload")); 

?>
Sorry MOnkey I completely forgot about this thread, when I get home I will send you an easier script
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

parse error here is because you have an extra parenthesis

Code: Select all

<?php 
copy($_FILES['userfile']['tmp_name'], $_SERVER['DOCUMENT_ROOT'] . "/home/hsphere/local/home/monkeyj/monkeyblast.com/anims/upload"); 
?>
User avatar
monkeyj
Forum Commoner
Posts: 82
Joined: Mon Dec 15, 2003 4:32 pm
Location: USA
Contact:

another error

Post by monkeyj »

another parse error

Parse error: parse error in /home/hsphere/local/home/monkeyj/monkeyblast.com/submit.php on line 9

Code: Select all

<?php 
if (is_uploaded_file($_FILES&#1111;'userfile']&#1111;'tmp_name'])) &#123; 
    copy($_FILES&#1111;'userfile']&#1111;'tmp_name'], $_SERVER&#1111;'DOCUMENT_ROOT'].
	"/home/hsphere/local/home/monkeyj/monkeyblast.com/anims/upload");
&#125; else &#123; 
    echo "Possible file upload attack. Filename: " . $_FILES&#1111;'userfile']&#1111;'name']; 
&#125; 
/* ...or... */ 
move_uploaded_file($_FILES&#1111;'userfile']&#1111;'tmp_name'], $dir = $_SERVER&#1111;'DOCUMENT_ROOT'] . "/home/hsphere/local/home/monkeyj/monkeyblast.com/anims/upload"; ); 
?>
User avatar
monkeyj
Forum Commoner
Posts: 82
Joined: Mon Dec 15, 2003 4:32 pm
Location: USA
Contact:

Post by monkeyj »

ok, nvm.. stupid.. forgot the second.. sorry
User avatar
monkeyj
Forum Commoner
Posts: 82
Joined: Mon Dec 15, 2003 4:32 pm
Location: USA
Contact:

Post by monkeyj »

thx btw
User avatar
monkeyj
Forum Commoner
Posts: 82
Joined: Mon Dec 15, 2003 4:32 pm
Location: USA
Contact:

Post by monkeyj »

Gah.. Another error

Warning: copy(/hsphere/local/home/monkeyj/monkeyblast.com/anims/upload): failed to open stream: Is a directory in /home/hsphere/local/home/monkeyj/monkeyblast.com/submit.php on line 4

Warning: move_uploaded_file(/hsphere/local/home/monkeyj/monkeyblast.com/anims/upload): failed to open stream: Is a directory in /home/hsphere/local/home/monkeyj/monkeyblast.com/submit.php on line 10

Warning: move_uploaded_file(): Unable to move '/tmp/phpx8f14u' to '/hsphere/local/home/monkeyj/monkeyblast.com/anims/upload' in /home/hsphere/local/home/monkeyj/monkeyblast.com/submit.php on line 10


Code: Select all

<?php 
if (is_uploaded_file($_FILES&#1111;'userfile']&#1111;'tmp_name'])) &#123; 
    copy($_FILES&#1111;'userfile']&#1111;'tmp_name'], $_SERVER&#1111;'DOCUMENT_ROOT'].
	"/anims/upload");
&#125; else &#123; 
    echo "Possible file upload attack. Filename: " . $_FILES&#1111;'userfile']&#1111;'name']; 
&#125; 
/* ...or... */ 
move_uploaded_file($_FILES&#1111;'userfile']&#1111;'tmp_name'], $_SERVER&#1111;'DOCUMENT_ROOT'].
"/anims/upload"); 
?>
User avatar
monkeyj
Forum Commoner
Posts: 82
Joined: Mon Dec 15, 2003 4:32 pm
Location: USA
Contact:

Post by monkeyj »

I changed the /home/hsphere..
yall suggested..
cause the earlier error just like copied that.. so it was doubled..

home/hspere/monkeyblast.com/home/hspere...

u get the point
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

if server on a linux login with ssh or something..

chmod 777 /home/and/some/dir/to/follow/


;-)


you also might wanna check that the directory that youre trying to access indeed is there..
User avatar
monkeyj
Forum Commoner
Posts: 82
Joined: Mon Dec 15, 2003 4:32 pm
Location: USA
Contact:

Post by monkeyj »

well..
I've 777'd it..

ran it.. tried to uploada gif and.. i still get error:

Warning: copy(/hsphere/local/home/monkeyj/monkeyblast.com/upload): failed to open stream: Is a directory in /home/hsphere/local/home/monkeyj/monkeyblast.com/submit.php on line 4

Warning: move_uploaded_file(/hsphere/local/home/monkeyj/monkeyblast.com/upload): failed to open stream: Is a directory in /home/hsphere/local/home/monkeyj/monkeyblast.com/submit.php on line 10

Warning: move_uploaded_file(): Unable to move '/tmp/phpUJy3EU' to '/hsphere/local/home/monkeyj/monkeyblast.com/upload' in /home/hsphere/local/home/monkeyj/monkeyblast.com/submit.php on line 10


Also: I changed the file to just /upload

instead of anims/upload


Umm, I have an idea...

How bout I just give one of you access to my folders and you do it for me? lol
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

are those folder even where you say they are?
User avatar
monkeyj
Forum Commoner
Posts: 82
Joined: Mon Dec 15, 2003 4:32 pm
Location: USA
Contact:

Post by monkeyj »

I have a new script..
I found for free

FREE
Free
wee
wee
wee

Umm
I uploaded it..
and..
It works..
But..
I never looked through the coding..
so..
I still don't know what I did wrong..
But thanks everyone for your patience and understanding in my newb quest to understand PHP..
RAWR
meow

-Monkeyj
Illusionist
Forum Regular
Posts: 903
Joined: Mon Jan 12, 2004 9:32 pm

Post by Illusionist »

lol, post the new code and your old code, i'd liek to see the differences! lol
If you don't mind!
User avatar
monkeyj
Forum Commoner
Posts: 82
Joined: Mon Dec 15, 2003 4:32 pm
Location: USA
Contact:

Post by monkeyj »

Hell, the New code has about 4 files.. 1 for the style/way it looks... 2 for the actual script
3 for the way the page looks..
4 for the form or something
User avatar
monkeyj
Forum Commoner
Posts: 82
Joined: Mon Dec 15, 2003 4:32 pm
Location: USA
Contact:

Post by monkeyj »

but ok, one sec
Post Reply