Correct Permissions For Directories On FTP Site?
I am making an FTP site for users to add files and folders to. Does anyone know what the correct permissions should be so that people logged in to the site can do this? I know that 0777 allows this, but I didn't know if this left the folders/files open to people outside the site?
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
New Directories Have Incorrect Permissions
I'm building an FTP site. I am manually creating my root folder via an FTP programme and setting the permissions to 777 (which I believe is required). When I check who the owner of this folder is, its 32414 (As far as I'm aware, I don't need to take any notice of what this means). I have a form on the site which people can fill out to create new directories, which will result in the following code being run: if ($result_folder = mkdir($path.$id, 0777)) { # if the new folder was created, do this: $file = 'index.php'; $file_copy = $path.$id.'/index.php'; copy($file, $file_copy); echo '<p>Thank you '.$creater.', the folder ''.$name.'' has been created.</p>'; echo '<p>Would you like to <a href="add_a_folder.php">add another folder</a>?</p>'; } When this is done, I notice that the actual permissions of the new subdirectory are not 777, but instead are 755, the owner is 99. This means that I can't manually delete the folder via my ftp programme and my domain will become untidy and crowded. Do you know how to get the correct permissions to be setup, and if I need to specify who the owner is?
Trying To Get All Directories In A Site Into Array
Thanks for reading. I'm trying to get an array of all the directories in my website. So, it reads the first level, then goes through each first level to find the second, and so on. I'm hoping to get all the first level in one array, all the second level in another and so on. I'm working with this code which does fine for the first level, but can't seem to get it to work for multiple levels without hardcoding everything in: PHP Code:
Creating Directories In Directories
I'm building a document management system and I've hit a snag. I'm relatively new, so this might be obvious to someone else. A user can add folders into the system (kinda like Windows Explorer) and then add folders IN those folders. I have a database set up to track the child/parent relationships but I'm having trouble with the actual creation of the directory on the server. I pass the "add folder" script the NAME of the new folder as well as the PATH of the new folder. If I'm in the root directory and I add a "TEST" folder I pass "TEST" as the folder name and "" as the path, because we're adding at the root. If I've added "TEST" and I want to add "IN TEST" inside the "TEST" folder I send "IN TEST" as the new folder name and "TEST" as the path. My code then adds a "/" and calls mkdir. So the path passed to mkdir is "IN TEST/TEST". Code:
Converting A PHP Site To A Total Static HTML Site
What's the best way to convert a PHP site to a total static HTML site? You might wanna ask why I wanna do this. Reason: I would like to create an offline version (without server) for demo purposes. Looking at my current PHP site, I am having problem dealing with this issue.
Site Flow Chart/site Map Creator For PHP?
I'm working on a site created by someone else, containing a hundred different pages or so in PHP, with connections (includes and form actions) going all over the place. Is there a utility out there that will create a visual site map of all the connecting pages in a site? I tried using Dreamweaver MX 2004's, but the best it can do is see connections in HTML. It'd only go one layer deep and find only a few connections for a total of about 6 pages out of the dozens.
Correct Way To Use ||?
Can anyone show me the correct way to use the || to compare if a string equals value 1 or value 2, 3, 4 etc? For example; PHP Code:
Copy Image From Site To Site Using URL
I'm trying to copy an image/file from one website to a directory in another, using the URL for the source image/file. I'm not sure which PHP function to use. Does anyone have a suggestion?
How To Get The Correct Date...
I'm working on an interactive calendar for my home page, but I can't get it to put the right dates down. It just keeps repeating today's date. Here's the code:
Correct Redirect Help...
Howdy. Here's the deal. I'm trying to use the script "Correct Redirect" written by Shamim Islam on my website. I'm having a major side effect with it: It don't work like I want it to. Here's a little information: I Type This: URL I Want To Go Here: URL But I Go Here: URL See where the problem arises? Even going to just URL I am given a problem. I have tried to email the author of the script but I am getting no replys so I didn't know where to turn. I hope someone here has an idea as to what I should do. Oh, and those addresses up there are correct. Here's the original script that I downloaded: Code:
How To Do Correct Path?
I have many folders and subfolders on server. As I would like to add code on each page to detect server URL, I need help with this. Code is: $_PATH1="http://" . $_SERVER['HTTP_HOST']."/"; Why I have to add on link for images also / that it will work as it is already there / in Link is like. <img src="<?=$_PATH1?>images/myimage.jpg" ></a>
Correct Date
i need a good script that can validate a proper date... by that I mean that it knows how many days are in each month etc. and so if a user selects a date that isn't valid then it just echo's an error message.
Is This Preg_replace Correct?
Just want to verify. I have a form and I want to parse any semi-colons out of the submitted info and replace with commas. Would this be the correct way to do it? $question1 = preg_replace(";", ",", $question1); Is there a better way to replace it in all the $_POST variables at once like maybe $_POST[] - preg_replace(";", ",", $_POST[]); or would I have to do a foreach loop?
Correct Use Of AddSlashes
When reading in values submmitted by a form, do you use addslashes just on string values or on any value regardless of type. I have a double value and a date value and am not sure whether I need to include these in my code block which addslashes to the submitted values.
Sub Directories
What i would like to know is how with php can i create a subdirecty and copy some files into there?
Correct Date Syntax?
I have a mysql DATE column called date_available that I'm attempting to make this happen:
Correct Implementation Of Smbclient
I've got a real N00b question. I've been messing around with smbclient all day and I can get it to work from the commandline but not from my php script...i'm sure it's probably just an un-escaped character. PHP Code:
Correct Use Of Html_entity_decode($var,ENT_QUOTES);
I use the html_entity_decode() and htmlentities() for my all my php-form. It is safe and fast. I have read in a website that when using it is recommended to indicate the character encoding after the function e.g. html_entity_decode($var,ENT_QUOTES [, character_encoding]); I have also read in this topic that the utf-8 encoding is the safest as it is now recognised worlwide (though there are still some problem with Asian countries) My questions : 1/ Should I indicate the encoding in my statement? 2/ Is utf-8 really safe worldwide? 3/ If not, what about allowing the user to modify the encoding in its profile page (assing a variable) and then use the variable to all entity functions? Or can I forget this coz it has no use?
Cannot Get This One Correct And Working, Though Simple!
I have 40 or jpeg files which I want them displayed in a frame called "main" upon clicking thumbnails of the same pics in a "leftMenu" frame. The thumbnail jpeg files are called thumb1, thumb2, thumb3, thumb4, ...., thumb40. These files are smaller versions (50pixelX50pixel) of the larger jpeg files called 1, 2, 3, 4, ..., 40 which I want them displayed. To display the hyperlinked thumbnails in the "leftMenu" frame I have it in a loop. [See the code snippet] But my problem is that part of the code ...<img src='thumb$i.jpg'> ... It doesn't display the intended thumbnail jpeg files; instead, it display the larger version of the files as thumbnails which takes longer to load. Here's my loop: <?php for ( $i = 1; $i < 40; $i++) { if ($i!=17) { echo "<a href='$i.jpg' target='main'><img src='thumb$i.jpg'></a> } } ?>
Correct Format For .php&redirect=
I'm working on setting up some affiliate links on a site of mine and I haven't been able to get a redirect to work. The original affiliate link looks like this: http://www.exampleurl.com/index.php?ref=10 Rather than use this link however I am wanting to redirect to specific product pages. A product page link would look like this: http://www.exampleurl.com/example-p...-1-135_100.html In the past I have been able to easily set up a redirect link simply by combining the links with &redirect= such as: http://www.exampleurl.com/index.php?ref=10&redirect= http://www.exampleurl.com/example-p...-1-135_100.html I understand this is probably not correct for PHP. I did play around with it a lot to no avail, including the use of URL encoding.
Echoing The Correct XML Tag Data
I am having trouble ECHOing specific data and for some reason the links for each sub parent are combined into one link...Let me explain that. The first link is correct and outputs http://example.com/1, but the second link outputs http://example.com/1http://example.com/2 Does anyone know why that is? The other problem I have is that I have about 200 sub parents in my xml file and the sub parents represent different categories, for example: Code:
Join And Echoing Correct Id
The information is displayed correctly. The problem comes into play with the record id's. The link I would click on for the employees name is echoing the job id and not the employee id so I get sent to the job page and not the employee profile. The link I would click on for the job is echoing fine. Code:
Calculating Correct Time
Lets start off by giving you my code (Well the important sections of it!): <?php /**/# Total Time /**/$query = "SELECT sum(hours) FROM flights ".$condition; /**/$result=mysql_query($query); /**/$blcktime = number_format(mysql_result($result,0)); /**/$query = "SELECT sum(minutes) FROM flights ".$condition; /**/$result=mysql_query($query); /**/$blckmins = number_format(mysql_result($result,0)); echo "$blcktime:$blckmins"; ?> Okay this part works. Like if there is an entry that has 20 hours in hours table and 50 minutes in minute table it displays 20:50, but my problem is if there are more than one record (Which there will be) if the previous was still true and another record had 1:30 the total would be 21:80 but this of course is not correct addition of time. And this is not a 24 hour clock it simply displays the time someones been in a game so it can go lke 300:56 too. Now how would I get it so if the $minutes were greater than 60 and divisible by 60 it would add the correct numbers to the hours like $hours = $hours + $times_divisible; or something like that! I am okay with if..else..elseif statements but that would take forever to write. thats why I need a looping sttatement but I havent got a clue how to write it.
Displaying The Correct Result
I am getting a value from the table of the field no_of_semester. suppose the no_of_semester for the programe BCS are 8. Now i have to put the no_of_semester value in a listbox but the no_of_semester will start from 1,2,3.....8, which will be defenetly done with the help of a loop. Code:
Uploading Directories ?
Is there any way I can simply allow a user to upload an entire directory through php without selecting the files one by one ?
Create Directories On The Fly...
Just curious to know is it possible to create directories on the fly? What I have done is created a script when you can add categories and subcategories, but what I would like to do is create a directory physcially within that category. For instance using the mkdir command using linux. In a way traversing through and creating a directory. An example would be: If I created a category called business and econony then it would display this in the address bar. http://www.domain.com/Business_and_Economy Then perhaps under Business and Economy, a category called Accounting, then it would display the following: http://www.domain.com/Business_and_Economy/Accounting/ Hopefully I'm making some sense here. Heres the code: function maketree($rootcatid,$level) { $sql="select catid,cat_name from quiz_category where parentid=$rootcatid order by cat_name"; $result=mysql_query($sql); while (list($DBcatid,$DBcatname)=mysql_fetch_row($result)) { $width=($level+1)*24; $display="<img src=http://www.domain.com/spacer.gif border=0 width=$width height=12>"; if ($DBcatid==1) { $display.="<input type="radio" name="quest_type" value=$DBcatid checked>"; } else { $display.="<input type="radio" name="quest_type" value=$DBcatid>"; } $display.="$DBcatname<br> "; echo $display; maketree($DBcatid,$level+1); } } if ($submit=='Add New Category') { if ($new_cat!='') { mysql_query("insert into quiz_category (parentid,cat_name) values ($quest_type,'$new_cat')"); # need to create directory here echo "<br><br><center><b>New category entered</b></center>"; } else echo "<br><br><center><b>New category name must be entered</b></center>"; }
Fopen() With Directories
I am attempting to create directories using a form, a user submits the directory name and the directroy is created. I am attempting to use fopen to create it, but it doesn't seem to be working. Is there a way to use fopen()? Also, could opendir() be used instead? Code: <form action="create.php" method="post"> Site Address: <br> <input name="subdir" width="30" type="text"> <input type="submit" value="create"> </form> PHP Code:
Virtual Directories?
Virtual Directories? I've been working with ColdFusion for my real job and sticking with PHP for my side work and have a question. In CF, they have virtual directories you can set up that you can use the address of mydomain.com/admin and have it access files from another location on the same server thisdomain.com/clientadmin I was wondering if there is something similar to this in PHP. I run a reseller account on a server and can access databases from different domains, so I was hoping this could be possible. If anyone has any ideas, please let me know.
Traverse Directories
My problem is that I can't find a way of referencing files and includes statically. I have to change each page reference so that when it is referenced it references the correct document. As I want a central location to keep all my most used 'includes'. So if I change a scripts location I also have to change the script it's self to point to the correct documents. This is a problem when the directory structures hierarchy keeps changing. Also HTTP referencing is out as the scripts will not all be run on the same servers.
Converting ?PID=whatever To Directories?
I've got a product directory with a product detail page for all products. The way the product page is displayed in the address bar is productdetail.php?PID=# Would it be feasible for a newbie like me to do so that instead of putting in the question mark it's in directories similar to Amazon?
Different Timezones In Different Directories
I have a strange problem. Iset up php 5.1.6 on my Solaris10 box and after that i get errors on my webbpage: "Warning: date() [function.date]: It is not safe to rely on the system's timezone settings. Please use the date.timezone setting, the TZ environment variable or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We had to select 'UTC' because your platform doesn't provide functionality for the guessing algorithm" I searched a little and foun out by setting up date.timezone in php.ini it works. Bur then I have to recompile php for support of zlib, and after that, I get the error again. Now I found out the following: # pwd /usr/local # php -i |grep timezone Default timezone =Europe/Luxembourg date.timezone =Europe/Luxembourg =Europe/Luxembourg # # cd .. # pwd /usr # php -i |grep timezone Default timezone =UTC date.timezone =no value =no value How is it possible that, when I'm in /usr/local the settings are OK, and in all other location the settings are not. Here header output of phpinfo: PHP Version 5.1.6 System SunOS my-web 5.10 Generic_118844-19 i86pc Build Date Nov 5 2006 16:24:04 Configure Command './configure' '--prefix=/usr/local' '--with-mysql=/usr/local/mysql '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-zlib=/usr/local'
Copy In 2 Directories
I've got a simple question. Is it possible with the command "copy" upload a file via browser on two different directories? I use copy copy("$file", "/directory1/$superdat_name")
Sync Directories
I have a php script on a cron job running every half an hour that FTPs to a given server and downloads files, heres a list of everything it does: 1. Checks file names in the FTP directory with a database table 2. Downloads any new files and imports the file information into that table 3. Uploads all the information inside that file into a different database table 4. Deletes file on the local machine that was downloaded, as to not take up space Now, the FTP directory keeps a full 60 days worth of files which is about 8640 files, everything so far works perfectly, efficiently and doesn't need to be changed. However I want to add a function, in everything it does I want it to check if any of the files in the database have been deleted on the FTP server. As to have only the 60 days worth of file records in the table.
File Directories
I searched the forums and didn't see an answer to this question. I need to store a lot of files on my server, ~100 000 files. The files range from 800kb to 30MB. Would it make a difference in search time for PHP to find a single or multiple files if all the files were in one directory, or should I map them over several directories (e.g alphabetically)?
Correct Validation Logic In Forms
I have a question which have bothered me for a while - thats to do the validation when a form is submittted: How can validation be done in the best way? I have come on the alternatives: 1- making the validation in the php after submitting the form --> then you handle in the server level, but would the data that the user enters still exist when you redirect to the same page (probably globals is needed then) --> how would the error messages be handled - would you redirect to a totally new page or the same the user came from? 2 - Using Javascript. --> This I like because you directly apply messages at the instance data is entered. --> But this is Client side - so its not a REAL validation. I like the usability of 2) and the consistency of 1) But what is the best practices?
Refreshing A Frame With The Correct Content
I have a frame.html which will call navigator.php in headerFrame and main.php in mainFrame. The problem that i am facing now is whenever a user refresh the pages, the frame will load the default main.php in mainFrame although the user may be looking at other pages. i've tot of using sessions to track the page that the user is currently viewing. from there, i can call the right file upon refreshing frame.html. however, what if the user had openned two windows? how can i make refreshing with the right page possible?
Correct Handling Of Multiple Sessions
For accessibility reasons I have replaced data being derived from a javascript triple drop down menu on a form feeding to a php page for processing. The replacement method uses a series of pages. A form with radio buttons in an htm page feeds into a similar php page where a session is created - and feeds through to another similar page where a second session is created – with the posted information and the 2 sessions being fed to the final php page for processing. I did not want to use viewers’ cookies – they are often disabled, I’m told. It works. But I am brand new to sessions, and wondering if I have done this correctly. Page1.htm contains a normal radio button form, which posts ”size”. Page2.php has the following at the very top (pre Doctype):
Correct Way To Write A Variable In A Loop
I have a form with variables names that are created from a loop. This is easily done as the names of the variable are output to the name part of an input field. however, i now am working on some error checking. I have made a loop that is supposed to loop through the submitted variables and check if each one has a value, if it doesnt have a value then an error message will be created. This is ok if I hard code the variable but i need to do something different. PHP Code:
Correct XML String Creation Function
Is there a php function that can translate any string to it's correct XML equivalent? Like for instance when I have the following script: PHP Code:
Sql Query Not Returning Correct Results
i'm using an entry in an sql database as a semaphore and it, unfortunately, doesn't appear to be working. the script that spawns the child processes has a for loop that performs the same basic sql query over and over again until the value has changed (there's a one second delay between each query). unfortunately, the resultant row is always the same, even when the other process *has* changed it. as an example, if the orig. value was of the entry was 0, and one second into the execution of the second process, the entry was changed to 1, my program would, even 10 seconds later, fetch 0. in other words, it'd never be aware of the change. any idea as to why this is and what i can do to fix it?
Correct String-split And Reassemble?
I need to split a long piece of text from a textarea box into small chunks, then POST these chunks to my credit-card provider, whereupon he will POST them back to my script, which will reassemble them into the original text and display it. This is necessary because my credit-card provider has a limit on all POSTed variables, which must be 255 characters or less each. I thought that this would be simple to do. I used substr to take bites out of the string, then included each piece as a hidden variable in my form. When I received the return POST, I reassembled all the strings using the (.) concatenator, then printed this out. The problem is, pieces of the original text are missing, and there are numerous // escape elements present in the text. Here is my code: $questions = $_POST['questions']; // coming from a previous POST $questions=substr($questions, 0, 3556); // I put a limit on the total string size. $questions0=substr($questions, 0, 254); $questions1=substr($questions, 254, 254); $questions2=substr($questions, 508, 254); $questions3=substr($questions, 762, 254); // etc. <INPUT TYPE="HIDDEN" NAME="questions0" value="<?=$questions0?>" > <INPUT TYPE="HIDDEN" NAME="questions1" value="<?=$questions1?>" > <INPUT TYPE="HIDDEN" NAME="questions2" value="<?=$questions2?>" > <INPUT TYPE="HIDDEN" NAME="questions3" value="<?=$questions3?>" > // etc. Then I POST the data, and then it comes back to my redirect page, which uses the following code: $questions0=$_POST['questions0']; $questions1=$_POST['questions1']; $questions2=$_POST['questions2']; $questions3=$_POST['questions3']; // etc. $questions=$questions0 . $questions1 . $questions2 . $questions3 . $questions4 . $questions5 . $questions6 . $questions7 . $questions8 . $questions9 . $questions10 . $questions11 . $questions12 . $questions13 .. $questions14; // concatenate it print ($questions); // I display $questions. It is mostly there, with parts missing, and many //s here and there.
Protecting Files And Directories With Php
I've got a situation where i have a directory called "example". In this area i have three files, an index page that has a form on it in to which user's can authenticate, a page displaying either success or failure and if success redirects to a downloadable file. I don't want this downloadable file to be had by a direct url access, user's should have to authenticate to get it. I want to use php4 for this and if possible since this is a lightweight requirement i don't want to implement a database solution.
Safe Mode / Directories
I created a directory with PHP mkdir (mode 0777). Then I try to move_ulpoaded_file() to move a file into this directory. I get an error: Warning: move_uploaded_file(): SAFE MODE Restriction in effect. The script whose uid is 1999 is not allowed to access /home/www/ww4592/html/fs/PHP/Dateien/Bereich_1/NEUER_ORDNER owned by uid 33 in /home/www/ww4592/html/fs/PHP/File.php on line 57 The webspace is at a webhost-company, not on my own server. I think I understand the restrictions of SAFE MODE, but I do not understand why a script has another uid than a directory created by the very same script! Is the error above the "normal" bevaviour if SAFE MODE is on? If it is: That is a drastic limitation. If I say to a client "I need webspace with PHP" and I get that SAFE MODE-stuff would it not be right to say that that is no fully working PHP-Webspace? I mean a webspace that does not allow a directory to be created and a file moved into it does not really support PHP -- it's a joke! Any opinions?
Copying Entire Directories
I need to copy all of the files from one directory to another. This has to happen on the fly. The files that are being copied are actually templates for another site that will be created. I have seen the example on php.net under the fopen section but it doesnt work.
|