Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Open A File To Store Some Date :: Permissions Dilemma


I want to open a file to store some data. However, when I use fopen('filename', w) I get permission denied. So, I've changed the permissions of the directory to get rid of the permission denied problem. Unfortunately, this seemed to require changing the directory to have permissions 777.




View Complete Forum Thread with Replies

Related Forum Messages:
PHP Permissions Dilemma
I'm developing an open source CMS, but have come across a problem. The
system dynamically creates .php files for the front-end of the site, meaning
they're owned by user 'nobody'.

However, for anyone with safe mode turned on, any "require_once" or
"include_once" commands used in these php pages won't work due to safe mode
restrictions (the script whose uid is * is not allowed to access..). I want
to this system to be available to users without access to the chown command
(many hosts block it), and with safe mode on, so any suggestions?

I'm developing an open source CMS, but have come across a problem. The
system dynamically creates .php files for the front-end of the site, meaning
they're owned by user 'nobody'.

However, for anyone with safe mode turned on, any "require_once" or
"include_once" commands used in these php pages won't work due to safe mode
restrictions (the script whose uid is * is not allowed to access..). I want
to this system to be available to users without access to the chown command
(many hosts block it), and with safe mode on, so any suggestions?

View Replies !
Explode - Open File Store The Numbers In An Array
I have a .txt file looking like this

3
4
56
23
59
10

i want PHP to open that file and store the numbers in an array something like this

$q = "3,4,56,59,10"

Now i want to read $q and see if it contains 56 and 10 (it does) Code:

View Replies !
Store Site-permissions
I have a wee bit of trouble deciding how I'm going to store the permissions for users on my site. It must be a way where it's easy to add new types of permissions and easy to add and delete permissions for a user. My initial thought was to have a table that look like this.Then fill it with things like (1, "may_read_forum"), (1, "may_post_in_forum") and so on and so fourth. Then in the relevant places in the code you do an sql query like "SELECT * FROM permissions WHERE user = users_id AND permission = 'may_read_forum' LIMIT 1"

Another way would be to have a permissions filed in the user table and have like a comme delimited list of permissions represented by numbers (1, 4, 6, 7, 8) and then have a table where these permissions were stored with the numeric id and their name. Here you could do a quesry like "SELECT permissions FROM users WHERE user = users_id LIMIT 1" in the beginning of the site and parse and store all the users permissions.


Any other ideas? The first one is clearly the easiest to do. The second would require parsing the result from the query. However, the first on could be a pretty BIG table if the number of users get hig. Say 50.000 users and then say that we have 10-20 permission setting on each user. That would total 1.000.000 records. And then think how often these would be looked through.

View Replies !
Store Date In A Date Field In My MYSQL Data Table
I have a form with a feild that when clicked on pops up a calendar which I can select a date I wnat to insert into the field. The date inserted displays "03 Apr, 2007". I want to store that date in a date field in my MYSQL data table, a field named "f_date" set to date type.

When I save the record the data field "f_date" displays "0000-00-00" which I take it the date input is not getting inserted to the table. My insert field code is PHP Code:

<input name="f_date"  type="text" class="bodytext" id="f_date" onclick='scwShow(this,this);' value="" size="15" />

View Replies !
Store The Date/time
What is the best(clean and fast) way to store the date/time so that I can use it to show or not show records in a mysql db ? 1142834715 or Mon, 20 Mar 2006 06:05:15 or other? I want to be able to say show records newer than 1 year old or dont show records older than 1 year old and what is that code?

View Replies !
Store A Download Date In A MySQL Database
I need to store a download date in a MySQL Database when a user makes an order,and check to see if that download date has expired when the user logs in in the future. What would be the best way to do this? timestamp?

Is there a PHP function that can anaylze the timestamp (or some sort of date string) and check to see how much time is left? Example: User orders download access for 24 hours - Comes back 5 hours, 20 minutes later - It should tell him that he has 18 hours fourty minutes left.

View Replies !
File Permissions
Im in the process of creating a web based frontend for a program called ASK (Active Spam Killer - http://a-s-k.sourceforge.net) and am currently running into a problem. Currently there is a perl based web front end, but it lacks functionality, and is rather bland, although it does work, and it works without changing any file permissions.

The problem im running into is that PHP requires me to make changes to file permissions (ASK files are located OUTSIDE of the web tree) which might end up causing problems as far as security and privacy of email. Has anyone come to any reasonable answer for this type of problem as im sure its a issue for other programs people write.

View Replies !
File Permissions....
I've read the stuff concerning writing to a text file and the related file permission issues on this forum.I have a script that does just that, it takes user-entered data from a Web Form and dumps it to a text file on a server.

This works fine on my private server, but is giving me the error...."Could not open stream.Permission denied on Line..." on the company server...The Company machine uses Windows XP.

I've tried talking to the System Administrator regarding the Permissions,but he says that giving READ/WRITE/EXECUTE Permissions could create Security Issues.

I have been told that previously,a script written in ASP had been used that did exactly the same thing i.e writing to the text file, but there were no File Permissions needed to be set!

View Replies !
4.3 And File Permissions
I know that the PHP "chmod" command sets file permissions, but how do I
retrieve what the permissions are for a particular file using PHP 4.3?

View Replies !
Problem With File Permissions : PHP / FTP
My php-script makes directories and puts files in it.
But via FTP'ing, I can't delete those files anymore.

Also, I need to put a whole bunch of existing files into these,
'made-by-php' directories, and that seems impossible
by means of FTP. I get an 'access denied' error every time.

View Replies !
How Can I Have Permissions To Delete A File?
How can I have permissions to delete a file? example: I have to delete a file, but I don't to public users have permission to delete that file but, with a certain "login" they can.

View Replies !
File Permissions After Copy()
This function basically creates a new dir in a determined location and copies the files from an established dir to the new dir. It copies the files and creates the folder ok, bit it sets the file permissons to 755 for the new folder and file contents. I then get a 550 error if I try to delete or chmod them. Any suggestions? I get permission errors in the script if I use the chgrp and chmod functions also. PHP Code:

View Replies !
How Do You Create A File In PHP And Set Permissions To It?
How do you create a file in PHP and set permissions to it?

View Replies !
File Permissions In Win98
I just wanted to know if there was any way I could change my file permissions so I can use the fopen function in windows 98 using Apache and PHP 4.04???? I know how to do it for Linux but I need it for Win 98.

View Replies !
Change File Permissions
i'm trying to create a file management tool online using php. Everytime i copy or create files or folders though it assigns ownership of the new files or folders to the apache id. i tried using backticks, exec, shell_exec and the php shell commands. php safe mode is off.

i can create the files and folders using shell commands and have tried to change ownership using chown but that doesn't seem to do anything. any insight can help. the goal is to be able to create these files with the same admin user ownership as all the other files on the site.

View Replies !
CHMOD File Permissions
i have a few question about file permissions. which is the best way to set a permission to a mp3 tha ti can play on the website, but if anyone try to get it from the directory they wont be able to?

like if i am playing thissong.mp3 and someone went to the directory to try and get the file music/songs/thissong.mp3 they would get some kind of error. also for folders that don't have a index file. which permission would be the bes tinstead of creating a number of index for each, but not give a use permusic to see the context if the go to mydirectory/functions/ .

View Replies !
File/folder Permissions
I have an upload function that uploads images into a folder. The folder is set to 777. However when I upload an image file to the folder, the file uploaded is set to 600. Therefore it wont appear on web. I'm not sure why this is doing this for??  Im using the php function move_uploaded_file to upload the file.

View Replies !
File Write Permissions
I'm trying to get an open source PHP app working for my company.  It's giving me the following custom error:

FreeMED was unable to create a file to record the healthy status of the system.
The FreeMED directory should be owned by the user that the webserver is running as...
Usually this is 'apache'. You can also fix this by giving universal write access to the home directory of FreeMED.

But that is not advisable from a security standpoint.
I've narrowed it down to the line of PHP that's breaking it here:

$test = CreateObject('FreeMED.FreeMEDSelfTest');
As far as I can tell, I've made the directory it's using as open as possible and it's still giving me that error.  The owner is apache (user and group) and the permissions are (temporarily) set at 0777 (universal read/write).

Is there some PHP or Apache configuration that needs changed to allow PHP this kind of permission?

View Replies !
File Permissions Windows
i am using the LOAD DATA INFILE to load from a txt file. Although it works fine with the MySQL command it does NOT work with Script...does anybody know why?

View Replies !
Rsync And File Permissions
Im sort of new to using rsync to transfer my files. unfortunately it is messing up something with the permissions, and somehow i get a 403 from the server.

View Replies !
File Permissions On Upload
I am uploading picture. This is part of the code

if(!move_uploaded_file($_FILES['fullSizePic'.$propId.$i]['tmp_name'], '../images/properties/'.$imageName) ){
chmod('../images/properties/' . $imageName , 0777);
}

The file uploads and moves into the properties folder. That folder's chmod is 777, but the file's chmod is only 600 making it unreadable by the server. I try to chmod it with php (as you can see above) and it doesn't work.

View Replies !
Not Enough Permissions To Delete A File
I want to delete a file using unlink() function. I'm getting a warning that says that I have no permissions to do that.

I suppose that is because the file I'm trying to delete is under the root directory path. I searched the forum about deleting files but found nothing alike my problem...

View Replies !
Upload File Permissions Problem
I've moved an existing site (which I didn't write) from a apache/php/mysql
host under windows to a linux apache/php/mysql host.
I've sorted out most problems except one.

There is an upload function on the site, which uploads files via POST to
temp folder and then moves it into a folder on the host using php function
move_uploaded_file. Under windows this works fine but on the linux host the
uploaded file is created with 600 permissions so it cannot be accessed later
by site visitors. The folder it is uploaded into has 755 permissions. Is
there a way of setting the default file permissions so each uploaded file
can be set to say 644 or do I need to chmod each file after upload?

View Replies !
File Permissions Of PHP Session Files
I noticed that the file permissions (unix) of the PHP session files
have only read and write permissions for the Apache process (600 or rw-
--- ---).

Does anyone have any idea where this permission is set ? I can't find
any
umask or chmod settings for it in the php.ini file. Can't find
anything in
the httpd.conf either. Is it set in the PHP code that implements
session_start()?

View Replies !
Creating A File, Uploading, And Permissions
I'm using php4 and i want to check for a file, if it doesn't exist it
should be created. My problem is i have to create it with specific
permissions specifically 666 so that the script can then write to it. I
don't have ftp access. I'm also looking for any tutorials, recent ones,
using php4 for creating file upload areas, i'm trying to make one of those
as well.

View Replies !
File And Directory Permissions For PHP Application
I make the directory 0777 and then write the file then i make the file i tried a few but they keep from being read im sure the file is ok i think i can handdle file permissions but i think its directory permissions im having a prob with.

Its an image file i write it and then need to use it so make the directory 0777 and then write the file and then what to the file and what to the directory ?

i am using php ftp() but if anyone knows any differences with php chmod() then please tell me apart from that i do a 777 righth now and leave it at that.

what should i being to the directory and file after to make it secure because i dont whant people tampering with them ?

OH AND THIS PROBS ON TH MAC OSX 10.4 TIGER

my chmoding works fine on linux the way it is 0777 and then a 655

+ somtimes i play with the permissions of the directory throgh the os GUI or the shell and i got it to tell me i dont have permissions in the OS but in PHP its ok is this coz PHP got ownership of it when i messed with the addtional BIT.

View Replies !
Minimun File Writing Permissions
I believe the chmod command -w- is write only, the minimum file writing permission but what is this in terms of numeric - chmod 755? or 777 .

View Replies !
File Permissions Denied Error
i'm using the following code to create a file. PHP Code:

$fn = "file.php";
    $FileHandle = fopen($fn, 'w+') or die("can't open file");
    $stringData = "Something";
    fwrite($FileHandle, $stringData);
    fclose($FileHandle);

when i check the file properties i can see that the file's permission is set to 644 so when i use the following code to delete it i get a permission denied error. PHP Code:

$myFile = "file.php";
$fh = fopen($myFile, 'w') or die("can't open file");
fclose($fh);

$myFile = "$file.php";
unlink($myFile);

what shall i do to set the permission to 777 when creating the file?

View Replies !
Chmod Mkdir And File Permissions..
I'm trying to create directories and move files with the right permissions. When I make a dir using mkdir I'm setting the permission to 777 to my folder variable $t2 below,

but when I check the chmod it's 755? When I copy files over to this folder the file permission are set to 644 and I can't even get rid of them on the server because it won't allow me to delete them. Is there anyway to set permissions to a file as you're using the copy function? Code:

View Replies !
Another Calendar Dilemma
I coded a calendar a while back with sample code from here. Then the user wanted the calendar to span into the next month and I did this. Now the calendar needs to span into the previous and possibly next month...it called a bidmonth. I get the actual dates from a table. So for example bidmonth December 06 spans from November 27, 2006 to December 31, 2006. The table stores the bidmonthbegindate, bidmonthenddate, and the actual bidmonth, in this case 12, as a number.

I am not sure if it could span 3 months but I would like to code for it just in case. Below is the code I had that allows for a bid month to span into the NEXT month. I need to change it and I am in way over my head. Can someone help? PHP Code:

View Replies !
Ereg() Dilemma
PHP and to this group, so very sorry if this is simple or
has been covered before. Basically want to check that a user and
password (entered in a previous page) only has characters but the
result of this is that it only ever goes to wrong!!! please tell me
why! I cant figure it out and feel so stupid! I even tried with :

if(ereg("[a-z][A-Z][0-9]", $Pword) && ereg("[a-z][A-Z][0-9]", $User)) {
redirection2();
}
else {
redirection();
}

and that also goes to the wrong.php page (which I put in a following
else), that's why I assumed try checking that it equals 1, but still no
good. HELP ME PLEASE!!

<?php
function redirection2() {
header("location: ok.php");
}

function redirection() {
header("location: wrong.html");
}

$User = $_POST["Username"];
$Pword = $_POST["Password"];

if(ereg("([a-z][A-Z][0-9])", $User, $Pword) == 1) {
redirection2();
}
else {
redirection();
}
?>

View Replies !
Replace Dilemma
I'm writing a system for articles. In mysql, each article has title and content.
the index page shows a link to all articles, and the href value is the title or the article, with some fixes. For example:

"first article" => <a href="first-article">first article</a>
"hello world article" => <a href="hello-world-article">hello world article</a>

That's easy: in the index I'm using str_replace for replacing spaces to hyphen, and in the page shows the article (htaccess refers to this page) simply replacing hyphen to space, and showing the article with this title. Code:

View Replies !
Search Dilemma
I have built a simple search feature for selecting clients where one may search by last, first (name), company, city or state.

The problem arises when someone searches, for instance, the city "Hartford". The search results displays all of the cities with the name Hartford in it. (East Hartford, West Hartford, etc). Code:

View Replies !
Generic Dilemma
I am just about to start developing a PHP IRC bot system. The events for the bot will be stored in a database, and on every line of text in the IRC Channel (chat room) the bot is in, it must check if it complies with one of these events. For example an event may be trigered by the text "hello" and the bot would respond with an action.

The problem I am having is that I cannot decide on the best way to check each line of text against these events. I do not really want to do an sql query on each line at risk of killing the server. My other idea was that I could load the whole table into an array on load of the bot, and just use in_array to search it. But, the problem with this is that I need to do regex matches on each event, e.g. check the event ".*hello.*" against an inputted line of text, e.g. "hi hello hi".

View Replies !
Change File Permissions On Uploaded Files?
I am trying to find a way to change the default file permissions for uploaded files using PHP. When I upload a file using my PHP script the default file permissions are 755. I would like the file to have 744.

View Replies !
What File Permissions To Keep Files Safe From Outside Users
My php source files should have what file permissions to keep them safe from outside users.I have chmod 711 but i want somefiles to be able to be downloaded eg txt,doc files.

View Replies !
Abstraction Layer Dilemma
I have a huge problem tht's hanging over me.

I'm looking for an abstraction layer that is both extremely fast, support features such as :

TO_DAYS(CURDATE()) - TO_DAYS(created) <= 7
DATE_FORMAT(created, '%a %b %D %x') created

(this is mysql)

AND

that is able to get the results via an object Just like the php function mysql_fetch_object.

View Replies !
Back Button Dilemma
I am creating a file sharing web application. When a user edits an existing file -- by clicking the edit link for the file on the "directory view" page (which displays a list of all files in that "directory) -- the file's checkout value is changed from &#390;' to &#391;' to indicate that it has been checked out. This means that other users that visit the "directory view" page will not be given the option to edit that file. Code:

View Replies !
Data Type Dilemma
Having some trouble with data types. In my script, I need the table's data to be ordered by "page", but the values have mixed char/num data (for instance, "21-22"). Because of the hyphen, I have to set it to VARCHAR (or it will erase the hyphen completely), but since it's a number, it won't order properly. For example, let's say my page numbers are 1, 21-22, 31, 121. Code:

SELECT * FROM 'table' ORDER BY page;

Would return: 1, 121, 21-22, 31 (it's ordering by the first digit in the value only).

Is there a datatype that will allow me to include hypens, but still order properly as numeric data?

View Replies !
Set Up The Permissions So That My Script Can Simply Fopen A File For Writing.
I am rather new to PHP and a relative newbie to Linux too.
I have a webserver at home (Apache 2.0.48 on SuSe 9.0, PHP4).
I have some scripts, one of them needs to be able to create logfiles
somewhere on my machine. It must also later be able to read from and write
to these files again.

Sofar I get a permission error. I tried chmodding 666 or 777 the directory
in which the files could reside, to no avail.
How do I set up the permissions so that my script can simply fopen a file
for writing. Or if that's not the issue, what am I doing wrong or
overlooking ?

The errors:
Warning: fopen(logfileslog1.txt): failed to open stream: Permission denied
in script1.php on line 142
Warning: fwrite(): supplied argument is not a valid stream resource in
script1.php on line 154
Warning: fclose(): supplied argument is not a valid stream resource in
script1.php on line 161
It's the first I am puzzled about, the 2nd and 3rd are a logical
consequence.

By the way, reading from and writing to a file I have previously created
myself with exactly the names I tried to get created by the script (echoed
the name, ok) is no problem at all.
So I don't think it has much to do with a safemode or open_basedir setting.
I also tried creating the scripts in the same dir the script itself resides.
Did not work either.

View Replies !
Linux File Permissions On Maildir, Apache User
i have the following problem. I am trying to create maildir
directories on the local filesystem then chmod, chown them to
courier:courier (for courier mail server). the courier mail server
reads and writes on these maildirs on the local filesystem and they
need to have courier:courier ownership. it does not work because the
directories are created with apache:apache ownership and apparently
only root can change ownership. My question is as follows. Is the
only solution to this problem to add the courier user to the apache
group?

View Replies !
File Download Problem - Change A Binary File Into A Text And Open It In A Browser
I have uploaded files to mysql (doc and xls) using the tutorial. The problem comes when I try to download. Again I followed instructions in the tutorial. When I click on the link to download the file, it formats it as text and sends it to the browser instead of seeing it as binary and offering me a download box. PHP Code:

<?
if(isset($_GET['id']))
{
    include 'includes/configdb.php'
    include 'includes/opendb.php'

    $id      = $_GET['id'];
    $query   = "SELECT name, type, size, content FROM upload WHERE id = '$id'";
    $result  = mysql_query($query) or die('Error, query failed');
    list($name, $type, $size, $content) = mysql_fetch_array($result);

    header("Content-Disposition: attachment; filename=$name");
    header("Content-length: $size"); ....

View Replies !
Store File
I have a site with membership. Members can upload couple of files. Currently, when a memeber uploads a file a unique sub-directory is created for that member where both files are stored. Quote:

/members
/members/unique_member_name_1
/members/unique_member_name_1/file_1
/members/unique_member_name_1/file_2
/members/unique_member_name_2
/members/unique_member_name_2/file_1
/members/unique_member_name_2/file_2
etc.

View Replies !
VCard Dilemma With Firefox On Macosx
I've got the following problem I'm currently looking after and investigate:

I'd like to display a link that offers a vcard to download or to be opened in the default vcard application on the system (address book). while safari does this with ease, firefox does nothing. even if I explicitly download the vcard, it saves a 0 byte file (!). FYI: the file has got more then 0 bytes.

The only thread I found on webmasterworld about a similar vcard releated problem was the following one: Downloading vCard Links in a browser

If anyone can point me to somewhere that might help, that would be great. I even had problems finding the right forum for it on good'ol webmasterworld.

View Replies !
Open File, Put First 5 Lines Into A Variable, Close File...
1) I want to open a file on my server.
2) I want to read only the first 5 lines.
3) Put the first five lines into a variable.
4) Close the file.
5) Display the contents of the variable.

I know how to use the fopen() but I have big problems just trying to read the first 5 lines only? I tried many things. I downloaded some search scripts which displayed the <meta> tag only from html pages...

What is this guy doing?

Well I have a big site and content is added and changed everyday. I have a dynamic page that reads a directory for files and then puts a link (well it includes the file for reading on my php page). That works great! MY PROBLEM is that I want not only a link but a small description below it (basically the first five lines on the file)...

See so far:
Quote: if (isset ($content)) {
include ("files/$content.html");
echo "<p><A HREF="read.php"><b>Back to index</b></A>";
} else {
echo "<b>Opening directory, reading files, and listing them as a link</b><p>";
$handle = opendir('./files');
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") {
echo eregi_replace (".html", "", "<A HREF="read.php?content=$file">$file</a><p>");
}
}
closedir($handle);
}

View Replies !
Open .php File With PHP Designer 2007 By Clicking The File In XP
In windows XP, I want to be able to click on a .php file and have it
opened in PHP Designer 2007,
Or right-click on it and have an "edit" menu option presented to me.
I know how to tweak the registry to do this in general, but what would
the command line look like in this specific case ?
PHP Designer does not do this automatically. It is as if the program
does not allow commandline options.
It only opens with the last file used or a menu of recently opened
files.

View Replies !
PHP File Handling Open A Simple Text File
I am trying to open a simple text file using php, read the content in , close the file and display the content to a page. I can't seem to get this code to work. When i run the page i get no errors but and the "this doesn't work" string at the bottom prints out ok. I have tried putting the 'PHPdata.txt' section in as a url ie 'http://localhost/phpdata.txt' but this doesn't seem to work either.

I am using windows xp and apache. I am trying to firstly get this code to work with the aim of opening and pulling back the html content from a remote page to mess around with on my server. Code:

View Replies !
PHP "Calender Like" Pop Up To Select Date And Store As Variable In Mysql Format?
I use to have this feature on my site about two years ago when i hired someone. It would allow the user to select between two different dates, via a small calender, save it as a variable then query the database.

Does anyone know where I can find the script for the small calender? I think it must of been populated by an external clock since all the dates were accurate etc. July 21st was on a saturday.

View Replies !
Store Date In Mysql Via <?=$row["stored"]?> With If Statement
among other things, i am storing date data in mysql. it is stored as yyyy-mm-dd. i can pull the data and display it via

<?=$row["stored"]?>

, "stored" being the date. what i want to do if have an if statement that says if "stored" is less than 7 days old, it echoes new.gif. I am fine with regular if statements, but haven't worked with dates much at all.

View Replies !
File Upload & Store Problem
I'm trying to upload a file through a form. But when I click submit it won’t upload the file.

It runs an SQL query I have above it in the same if statement but not the upload code.

This is the upload code I'm trying to use:

View Replies !
Download File And Store On Server
I want to make an online application that i can access, i want to be able to put a http address in a form, and click the submit button. i want the file then to be downloaded onto the server. would it be best to use a wget command (i'm on a linux server) or is there a native php command?

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved