[PHP-DB] Re: redirecting function

2005-03-17 Thread Bunmi AKinmboni
Can you state the exact error?
Bunmi in Lagos
Yemi Obembe wrote:
hi folks,
who knows any function that can do this javascript trick
script
window.location='http://somewhere.com/'
/script
tried header(location:http://somewhere.com/) but it gave me an errorinclude() 
on the other hand only includes the url  doest redirect to it...
thnx

-
A passion till tomorrow,
Opeyemi Obembe | ng.clawz.com


		
-
Do you Yahoo!?
 Make Yahoo! your home page   
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Re: redirecting function

2005-03-17 Thread Bunmi AKinmboni
Ha, I see Ben and Ken have dealt with the most common cause with the 
header statement especially Ben.
Hope you're okay now?

Bunmi from Lagos
Yemi Obembe wrote:
hi folks,
who knows any function that can do this javascript trick
script
window.location='http://somewhere.com/'
/script
tried header(location:http://somewhere.com/) but it gave me an errorinclude() 
on the other hand only includes the url  doest redirect to it...
thnx

-
A passion till tomorrow,
Opeyemi Obembe | ng.clawz.com


		
-
Do you Yahoo!?
 Make Yahoo! your home page   
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] String pictures in MySQL

2005-03-17 Thread Bunmi AKinmboni
I want to store picture in a MySQL field. What type do I call the field 
and any guide or link on the net to tell me how to store the picture?

Bunmi from Lagos
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Help with file upload

2003-10-16 Thread Bunmi Akinmboni
I used this code now:

if (is_uploaded_file($_FILES['ufile1']['tmp_name'])) {
move_uploaded_file($_FILES['ufile1']['tmp_name'],'./' .
$_FILES['ufile1']['name']);
This is the reply I got:

Warning: move_uploaded_file(./ayservenet.jpg): failed to open stream:
Permission denied in /home/ayserve/public_html/fu/fuprocess.php on line 6
Warning: move_uploaded_file(): Unable to move '/tmp/phpfJyDSw' to
'./ayservenet.jpg' in /home/ayserve/public_html/fu/fuprocess.php on line 6
ayservenet.jpg DONE Array ( [ufile1] = Array ( [name] = ayservenet.jpg
[type] = image/pjpeg [tmp_name] = /tmp/phpfJyDSw [error] = 0 [size]
= 3030 ) )
I had experienced this also on Windows IIS now it is also coming on my
Linux yet I have full access to the two servers.
Bunmi

John W. Holmes wrote:

Bunmi Akinmboni wrote:

His is the new code:
?php
if (is_uploaded_file($_FILES['ufile1']['tmp_name'])) {
copy($_FILES['ufile1']['tmp_name'], .);


You should be using move_uploaded_file() instead of copy(), first of all.

Next, the two arguments passed to either copy() or move_uploaded_file() 
are _filenames_, not directories. So something like

move_uploaded_file($_FILES['ufile1']['tmp_name'],'./' . 
$_FILES['ufile1']['name']);

is probably what you're after.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Help with file upload

2003-10-16 Thread Bunmi Akinmboni
I just changed the permission on fu folder to 777 but it gives me the 
same problem. I'm writing this script so that I can use it to upload to 
jpeg files. The code is hereby attached.

Gabriel Peugnet wrote:
For the message:

Warning: move_uploaded_file(./ayservenet.jpg): failed to open stream:
Permission denied in /home/ayserve/public_html/fu/fuprocess.php on line 6


you have to change the permissions of the file folder where you are copying
the file.
If you created it via FTP then you can't use copy() or move().
check:
echo fileperms( $folder );
if it's 33188 or 33279 it's ok but I think it is not the permission of your
folder.
I think you'll get 17901 or some other.
so you have to use ftp_chmod() of ftp_site() to change it..
try this:

$folderbase = folderbase; // it's the folder where your folder for
uploads is.
$folder = foldername;// it's your folder for uploads.
$mode = 0777;
$site = ftp_connect ( ftp.yourdomain.com );
if( $site != FALSE ) {
$loged = ftp_login( $site , your username, your password );

if( $loged ) {

ftp_chdir( $site , $folder );
ftp_site( $site , chmod $mode $folder );
}

ftp_quit( $site );

John W. Holmes [EMAIL PROTECTED] escribi en el mensaje
news:[EMAIL PROTECTED]
Bunmi Akinmboni wrote:


Pls Help.
I have done a lot of reading prior to this yet I just can't seem make it
work. I wrote an upload program as seen below but the response I got
was:

Possible file upload attack. Filename: ayservenet.jpg Array ( [ufile1]
= Array ( [name] = ayservenet.jpg [type] = image/pjpeg [tmp_name] =
/tmp/phpIMEhdh [error] = 0 [size] = 3030 ) )
[snip]

if (is_uploaded_file($_FILES['ufile1']['name'])) {
   copy($_FILES['ufile1']['name'], .);
   echo $ufile1_name ;
   echo DONE;
   echo  ;
   print_r($_FILES);
} else {
   echo Possible file upload attack. Filename:  .
$_FILES['ufile1']['name'];
   echo  ;
   print_r($_FILES);
}
?
You should pass $_FILES['ufile1']['tmp_name'] to is_uploaded_file().

--
---John Holmes...
Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/

php|architect: The Magazine for PHP Professionals  www.phparch.com


--
'Bunmi Akinmboni
5, Aibu Street, Off Bode Thomas Street,
P.O. Box 6235, Surulere, Lagos, NIGERIA.
Tel: (234) 1-813-3335
Fax: (234) 1-583-2585 (Nigeria Only)
Fax: 1 (309) 285-2383 (International)
Email: [EMAIL PROTECTED]
Web site: http://www.budelak.com
  http://www.ayserve.net
Web Design, Web Hosting, Domain Registration, ICT Consultancy, 
Networking, Internet, eCommerce, System Integrator
===

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP-DB] Help with file upload

2003-10-16 Thread Bunmi Akinmboni
Thanks Neil. My ultimate aim to update my database with the details of 
the upload after it uploads successfully, but I need to solve this 
problem first.

The folder already has permission 777.

Bunmi

Neil Smth wrote:
Bunmi, you need to understand Unix file permissions.

Because you are running as the web server 'user / group' that user needs 
permission to write to the directory you are specifying. In this case 
you are trying to circumvent filesystem access controls by writing 
directly to the root directory of the filesystem !

So you need to adjust your path to for example 
/home/ayserve/public_html/fu/uploads/

*** Then*** You need to adjust the permission on this directory to allow 
write access to the web server. You can do this from most FTP clients 
(dreamweaver has a plugin to adjust the permissions of the directory). 
It needs to be mode 660 or 666 for testing, you can tighten up the 
permissions later.

If you absolutely cant do this by FTP somehow, try using

chmod(/home/ayserve/public_html/fu/uploads/,100666);
 execute your upload after extensive file type checks
chmod(/home/ayserve/public_html/fu/uploads/,100755);
To change it back again to a safe setting as soon as possible !

666 corresponds to user-group-everybody, rwx and 660 to rw (no execute 
permission). Finally, 755 allows owner rwx and others rx permission - 
execute permission needs to be set again afterwards to allow the web 
server to traverse (read) the directory again.

PS _ Can you remind me again how this is related to Databases in PHP, 
the topic of this list ;-)

Cheers - Neil.

At 06:25 16/10/2003 +, you wrote:

Message-ID: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Date: Thu, 16 Oct 2003 06:09:07 +0100
From: Bunmi Akinmboni [EMAIL PROTECTED]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Subject: Re: [PHP-DB] Help with file upload
I used this code now:

if (is_uploaded_file($_FILES['ufile1']['tmp_name'])) {
move_uploaded_file($_FILES['ufile1']['tmp_name'],'./' . 
$_FILES['ufile1']['name']);

This is the reply I got:

Warning: move_uploaded_file(./ayservenet.jpg): failed to open stream: 
Permission denied in /home/ayserve/public_html/fu/fuprocess.php on line 6

Warning: move_uploaded_file(): Unable to move '/tmp/phpfJyDSw' to 
'./ayservenet.jpg' in /home/ayserve/public_html/fu/fuprocess.php on 
line 6
ayservenet.jpg DONE Array ( [ufile1] = Array ( [name] = 
ayservenet.jpg [type] = image/pjpeg [tmp_name] = /tmp/phpfJyDSw 
[error] = 0 [size] = 3030 ) )

I had experienced this also on Windows IIS now it is also coming on my 
Linux yet I have full access to the two servers.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Help with file upload

2003-10-16 Thread Bunmi Akinmboni
Neil,
The folder fu is not the root. I just created it for testing and it has 
777 permission. My ultimate aim is to update a database upon successful 
uploading.

Bunmi

Neil Smth wrote:

Bunmi, you need to understand Unix file permissions.

Because you are running as the web server 'user / group' that user needs 
permission to write to the directory you are specifying. In this case 
you are trying to circumvent filesystem access controls by writing 
directly to the root directory of the filesystem !

So you need to adjust your path to for example 
/home/ayserve/public_html/fu/uploads/

*** Then*** You need to adjust the permission on this directory to allow 
write access to the web server. You can do this from most FTP clients 
(dreamweaver has a plugin to adjust the permissions of the directory). 
It needs to be mode 660 or 666 for testing, you can tighten up the 
permissions later.

If you absolutely cant do this by FTP somehow, try using

chmod(/home/ayserve/public_html/fu/uploads/,100666);
 execute your upload after extensive file type checks
chmod(/home/ayserve/public_html/fu/uploads/,100755);
To change it back again to a safe setting as soon as possible !

666 corresponds to user-group-everybody, rwx and 660 to rw (no execute 
permission). Finally, 755 allows owner rwx and others rx permission - 
execute permission needs to be set again afterwards to allow the web 
server to traverse (read) the directory again.

PS _ Can you remind me again how this is related to Databases in PHP, 
the topic of this list ;-)

Cheers - Neil.

At 06:25 16/10/2003 +, you wrote:

Message-ID: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Date: Thu, 16 Oct 2003 06:09:07 +0100
From: Bunmi Akinmboni [EMAIL PROTECTED]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Subject: Re: [PHP-DB] Help with file upload
I used this code now:

if (is_uploaded_file($_FILES['ufile1']['tmp_name'])) {
move_uploaded_file($_FILES['ufile1']['tmp_name'],'./' . 
$_FILES['ufile1']['name']);

This is the reply I got:

Warning: move_uploaded_file(./ayservenet.jpg): failed to open stream: 
Permission denied in /home/ayserve/public_html/fu/fuprocess.php on line 6

Warning: move_uploaded_file(): Unable to move '/tmp/phpfJyDSw' to 
'./ayservenet.jpg' in /home/ayserve/public_html/fu/fuprocess.php on 
line 6
ayservenet.jpg DONE Array ( [ufile1] = Array ( [name] = 
ayservenet.jpg [type] = image/pjpeg [tmp_name] = /tmp/phpfJyDSw 
[error] = 0 [size] = 3030 ) )

I had experienced this also on Windows IIS now it is also coming on my 
Linux yet I have full access to the two servers.

Bunmi
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Help with file upload

2003-10-16 Thread Bunmi Akinmboni
HI Nitin,
Is that not dangerous as it will affect the entire server structure?
Bunmi
Nitin wrote:

permission is ok but it's got to be inside the home directory of web server,
which is /var/www by default for apache
Nitin

- Original Message - 
From: Bunmi Akinmboni [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, October 16, 2003 1:28 PM
Subject: Re: [PHP-DB] Help with file upload



Thanks Neil. My ultimate aim to update my database with the details of
the upload after it uploads successfully, but I need to solve this
problem first.
The folder already has permission 777.

Bunmi

Neil Smth wrote:

Bunmi, you need to understand Unix file permissions.

Because you are running as the web server 'user / group' that user needs
permission to write to the directory you are specifying. In this case
you are trying to circumvent filesystem access controls by writing
directly to the root directory of the filesystem !
So you need to adjust your path to for example
/home/ayserve/public_html/fu/uploads/
*** Then*** You need to adjust the permission on this directory to allow
write access to the web server. You can do this from most FTP clients
(dreamweaver has a plugin to adjust the permissions of the directory).
It needs to be mode 660 or 666 for testing, you can tighten up the
permissions later.
If you absolutely cant do this by FTP somehow, try using

chmod(/home/ayserve/public_html/fu/uploads/,100666);
 execute your upload after extensive file type checks
chmod(/home/ayserve/public_html/fu/uploads/,100755);
To change it back again to a safe setting as soon as possible !

666 corresponds to user-group-everybody, rwx and 660 to rw (no execute
permission). Finally, 755 allows owner rwx and others rx permission -
execute permission needs to be set again afterwards to allow the web
server to traverse (read) the directory again.
PS _ Can you remind me again how this is related to Databases in PHP,
the topic of this list ;-)
Cheers - Neil.

At 06:25 16/10/2003 +, you wrote:


Message-ID: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Date: Thu, 16 Oct 2003 06:09:07 +0100
From: Bunmi Akinmboni [EMAIL PROTECTED]
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Subject: Re: [PHP-DB] Help with file upload
I used this code now:

if (is_uploaded_file($_FILES['ufile1']['tmp_name'])) {
   move_uploaded_file($_FILES['ufile1']['tmp_name'],'./' .
$_FILES['ufile1']['name']);
This is the reply I got:

Warning: move_uploaded_file(./ayservenet.jpg): failed to open stream:
Permission denied in /home/ayserve/public_html/fu/fuprocess.php on line
6

Warning: move_uploaded_file(): Unable to move '/tmp/phpfJyDSw' to
'./ayservenet.jpg' in /home/ayserve/public_html/fu/fuprocess.php on
line 6
ayservenet.jpg DONE Array ( [ufile1] = Array ( [name] =
ayservenet.jpg [type] = image/pjpeg [tmp_name] = /tmp/phpfJyDSw
[error] = 0 [size] = 3030 ) )
I had experienced this also on Windows IIS now it is also coming on my
Linux yet I have full access to the two servers.
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] Help with file upload

2003-10-15 Thread Bunmi Akinmboni
Pls Help.
I have done a lot of reading prior to this yet I just can't seem make it 
work. I wrote an upload program as seen below but the response I got was:

Possible file upload attack. Filename: ayservenet.jpg Array ( [ufile1] 
= Array ( [name] = ayservenet.jpg [type] = image/pjpeg [tmp_name] = 
/tmp/phpIMEhdh [error] = 0 [size] = 3030 ) )

My codes are:
File UPLOAD.HTM:
html
head
titleUntitled Document/title
meta http-equiv=Content-Type content=text/html; charset=iso-8859-1
/head
body
form method=post action=fuprocess.php enctype=multipart/form-data
input type=file name=ufile1 size=20
input type=submit name=submit value=submit
/form
/body
/html
File FUPROCESS.PHP:
?php
// In PHP earlier then 4.1.0, $HTTP_POST_FILES  should be used instead 
of $_FILES.
// $realname = $_FILES['ufile1']['name'];

if (is_uploaded_file($_FILES['ufile1']['name'])) {
copy($_FILES['ufile1']['name'], .);
	echo $ufile1_name ;
	echo DONE;
	echo  ;
	print_r($_FILES);
} else {
echo Possible file upload attack. Filename:  . 
$_FILES['ufile1']['name'];
	echo  ;
	print_r($_FILES);
}
?

Thanks.
--
'Bunmi Akinmboni
5, Aibu Street, Off Bode Thomas Street,
P.O. Box 6235, Surulere, Lagos, NIGERIA.
Tel: (234) 1-813-3335
Fax: (234) 1-583-2585 (Nigeria Only)
Fax: 1 (309) 285-2383 (International)
Email: [EMAIL PROTECTED]
Web site: http://www.budelak.com
  http://www.ayserve.net
Web Design, Web Hosting, Domain Registration, ICT Consultancy,
Networking, Internet, eCommerce, System Integrator
===
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DB] subscribe me

2003-10-15 Thread Bunmi Akinmboni
--
'Bunmi Akinmboni
5, Aibu Street, Off Bode Thomas Street,
P.O. Box 6235, Surulere, Lagos, NIGERIA.
Tel: (234) 1-813-3335
Fax: (234) 1-583-2585 (Nigeria Only)
Fax: 1 (309) 285-2383 (International)
Email: [EMAIL PROTECTED]
Web site: http://www.budelak.com
 http://www.ayserve.net
Web Design, Web Hosting, Domain Registration, ICT Consultancy, Networking, Internet, 
eCommerce, System Integrator
===
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Help with file upload

2003-10-15 Thread Bunmi Akinmboni
His is the new code:
?php
if (is_uploaded_file($_FILES['ufile1']['tmp_name'])) {
copy($_FILES['ufile1']['tmp_name'], .);
	echo $ufile1_name ;
	echo DONE;
	echo  ;
	print_r($_FILES);
} else {
echo Possible file upload attack. Filename:  . 
$_FILES['ufile1']['name'];
	echo  ;
	print_r($_FILES);
}
?

Bunmi

Bunmi Akinmboni wrote:

Thanks John,
I had done it before and still tried it again now. This is what I get:
Warning: copy(.): failed to open stream: Is a directory in 
/home/ayserve/public_html/fu/fuprocess.php on line 6
ayservenet.jpg DONE Array ( [ufile1] = Array ( [name] = ayservenet.jpg 
[type] = image/pjpeg [tmp_name] = /tmp/php1tARiu [error] = 0 [size] 
= 3030 ) )

Bunmi

John W. Holmes wrote:

Bunmi Akinmboni wrote:

Pls Help.
I have done a lot of reading prior to this yet I just can't seem make 
it work. I wrote an upload program as seen below but the response I 
got was:

Possible file upload attack. Filename: ayservenet.jpg Array ( 
[ufile1] = Array ( [name] = ayservenet.jpg [type] = image/pjpeg 
[tmp_name] = /tmp/phpIMEhdh [error] = 0 [size] = 3030 ) )


[snip]

if (is_uploaded_file($_FILES['ufile1']['name'])) {
copy($_FILES['ufile1']['name'], .);
echo $ufile1_name ;
echo DONE;
echo  ;
print_r($_FILES);
} else {
echo Possible file upload attack. Filename:  . 
$_FILES['ufile1']['name'];
echo  ;
print_r($_FILES);
}
?


You should pass $_FILES['ufile1']['tmp_name'] to is_uploaded_file().

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Help with file upload

2003-10-15 Thread Bunmi Akinmboni
This is reply I got:

Warning: move_uploaded_file(./ayservenet.jpg): failed to open stream: 
Permission denied in /home/ayserve/public_html/fu/fuprocess.php on line 6

Warning: move_uploaded_file(): Unable to move '/tmp/phpfJyDSw' to 
'./ayservenet.jpg' in /home/ayserve/public_html/fu/fuprocess.php on line 6
ayservenet.jpg DONE Array ( [ufile1] = Array ( [name] = ayservenet.jpg 
[type] = image/pjpeg [tmp_name] = /tmp/phpfJyDSw [error] = 0 [size] 
= 3030 ) )

I had experienced this also on Windows IIS now it is also coming on my 
Linux yet I have full access to the two servers.

Bunmi

John W. Holmes wrote:

Bunmi Akinmboni wrote:

His is the new code:
?php
if (is_uploaded_file($_FILES['ufile1']['tmp_name'])) {
copy($_FILES['ufile1']['tmp_name'], .);


You should be using move_uploaded_file() instead of copy(), first of all.

Next, the two arguments passed to either copy() or move_uploaded_file() 
are _filenames_, not directories. So something like

move_uploaded_file($_FILES['ufile1']['tmp_name'],'./' . 
$_FILES['ufile1']['name']);

is probably what you're after.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Help with file upload

2003-10-15 Thread Bunmi Akinmboni
I used this code now:

if (is_uploaded_file($_FILES['ufile1']['tmp_name'])) {
move_uploaded_file($_FILES['ufile1']['tmp_name'],'./' . 
$_FILES['ufile1']['name']);

This is the reply I got:

Warning: move_uploaded_file(./ayservenet.jpg): failed to open stream: 
Permission denied in /home/ayserve/public_html/fu/fuprocess.php on line 6

Warning: move_uploaded_file(): Unable to move '/tmp/phpfJyDSw' to 
'./ayservenet.jpg' in /home/ayserve/public_html/fu/fuprocess.php on line 6
ayservenet.jpg DONE Array ( [ufile1] = Array ( [name] = ayservenet.jpg 
[type] = image/pjpeg [tmp_name] = /tmp/phpfJyDSw [error] = 0 [size] 
= 3030 ) )

I had experienced this also on Windows IIS now it is also coming on my 
Linux yet I have full access to the two servers.

Bunmi

John W. Holmes wrote:

Bunmi Akinmboni wrote:

His is the new code:
?php
if (is_uploaded_file($_FILES['ufile1']['tmp_name'])) {
copy($_FILES['ufile1']['tmp_name'], .);


You should be using move_uploaded_file() instead of copy(), first of all.

Next, the two arguments passed to either copy() or move_uploaded_file() 
are _filenames_, not directories. So something like

move_uploaded_file($_FILES['ufile1']['tmp_name'],'./' . 
$_FILES['ufile1']['name']);

is probably what you're after.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DB] Help with file upload

2003-10-15 Thread Bunmi Akinmboni
So what could be the problem? I reaaly don't know.
Bunmi
John W. Holmes wrote:

Bunmi Akinmboni wrote:

Warning: move_uploaded_file(./ayservenet.jpg): failed to open stream: 
Permission denied in /home/ayserve/public_html/fu/fuprocess.php on line 6


PHP runs as the web server and it does not have permission to write to 
the current directory. If you're using IIS, PHP runs as the 
IUSR_computer_name user.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php