Unstoppable Domains โ€” Expired Auctions

Security Issue Related to PHP Safe Mode

Namecheap AuctionsNamecheap Auctions
Namecheap AuctionsNamecheap Auctions
SpaceshipSpaceship
Watch

billinchina

General BillEstablished Member
Impact
20
I want to upload photos into a folder that is accessible to the world with file permissions 755. My php script only works when the permissions on the folder are 777. What can I do to make this safer? I'm running on a shared hosting account with php safe mode turned on (as always). I do not want to store the pics in a database, I just want to figure out some way to only allow my domain name or static ip to write to files and allow all others to read only.
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
Unstoppable Domains โ€” AI StorefrontUnstoppable Domains โ€” AI Storefront
what you could do is chmod the folder you right to 777 write the file

then chmod it back to 755

<?php
// Read and write for owner, nothing for everybody else
chmod("/somedir/somefile", 0600);

// Read and write for owner, read for everybody else
chmod("/somedir/somefile", 0644);

// Everything for owner, read and execute for others
chmod("/somedir/somefile", 0755);

// Everything for owner, read and execute for owner's group
chmod("/somedir/somefile", 0750);
?>

http://uk2.php.net/chmod
 
0
•••
Can't use chmod function

It throws a warning cannot use error because the uid of the script is different that the file I'm trying to chmod. Probably need safe mode turned off for that too...
 
0
•••
Appraise.net
Escrow.com
Spaceship
Domain Recover
CryptoExchange.com
Catchy
DomDB
NameFit
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back