Jump to content

iwato

Members
  • Content Count

    1,506
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by iwato

  1. This is a nifty bit of code, but I am not sure why it returns an empty initialized array as an associative array.A more important personal dilemma: What is the best way to globalize the is_assoc( ) function so that I may draw on it anytime and anyplace?In Action Script I would likely create a class for it. How is it best done in PHP?Roddy
  2. MYSTERY SOLVED These changes had no effect. Using the var_dump() function proved very beneficial. What I discovered is the following:1) $ownerArray is an associative array with keys and values.2) $newArray is an index array with numbers and values.After entering the key obtained from the var_dump() function between the brackets of $ownerArray[] the first and second sets of code produced identical results.So as to avoid this sort of problem in the future, do you know of a function by which one can discover the array-type without having to dump the array's entire contents to find out? I chec
  3. iwato

    Select Option value

    Your error taught me how to read a $_POST array without first having to parse.Roddy
  4. PROBLEM: Please consider the following two blocks of code (they differ only in their last line) and explain why the first echoes the number of the discovered group name, and the second produces nothing at all.COMMENT: I am teaching myself how to work with PHP arrays and am baffled by the result. <?php $owner = fileowner("../copy/nonPHP_file.txt"); echo $owner . "<br />"; $ownerArray = Array(); $ownerArray = posix_getpwuid($owner); $count = count($ownerArray); echo $count . "<br /><br />"; foreach ($ownerArray as $ownerInfo) { echo $newArray[]
  5. Yeah, the backslash is a handy escape character, but does it only work with double quotes?Roddy
  6. I noticed a question related to the use of quotation marks on the W3Schools PHP exam and could not answer it. This is when I realized that I needed to study more. I have tried both of your examples and got them to reproduce your output.Thanks, I am very happy that this forum is here. It makes self-study so much easier when knowledgeable people are around to answer questions.Roddy
  7. The problem appears to have resolved itself when the permissions were changed. I can now copy files with the copy() function as prescribed by the function's specifications. Simply there was a delay in Dreamweaver's updating mechanism, and I did not see the file appear until later.Hooray!One small step for neophyte PHP user, but not yet a giant leap for human kind.Roddy
  8. It shows up on the line after the final PHP tag ?>. The line contains a pair of HTML paragraph tags. Bizarre!Roddy
  9. You really like NetBeans. Is it easy to get started? I am already awash in getting started with PHP.No, there is no strange or unusual highlighting in this file, although I have discovered yellow mark-up warnings in other files that I could not explain. No, I am running XHTML Strict, and it begins with the following:<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> I turned the short_open_tag to Off. Judging from the PHP website explanation use of the the short tag will surely cause me more trouble than its shorthand coul
  10. Yes, these are slick improvements. I tried both with minor modification, and they produced very nice results. Still, it was important to learn how to generate a sequentially numbered variable list. Many thanks!Roddy
  11. I am still confused about how to proceed with the issue of permissions and am attaching an image of my current MAMP PRO permission settings. The confusion arises because of the following lack of conformity between my MacOS and MAMP Pro:When I check folder permissions using the GetInfo command of my MacOS, group permissions are not an issue, rather the emphasis is on the user, the administrator, and others. When I check permissions using MAMP Pro, however, there is no mention of the administrator, and the emphasis is on the user, the group, and others ( see image ).Could someone help me sort
  12. This is, of course, good news, but it would still be a very big step, as I have just spent the past year getting use to Dreamweaver after having been informed by Adobe that GoLive would not undergo further development. Well, yes. The file is replete with HTML code, but it is only a laboratory framework for unfamiliar PHP code that I test. Other PHP code has been housed in the same HTML framework without consequence.Roddy
  13. Yes, it is all of my code. I tend to work in increments so as to avoid creating enormous puzzles that I cannot unravel. As you can see, however, even this precaution is not fail safe. I have explored the NetBeans webpage and bookmarked it. Although I can well appreciate what you are recommending, I am still a novice when it comes to web application development and fear that NetBeans and my newly acquired and installed MAMP Pro software are likely to come into conflict. So, I must wait until I have better understood the problems associated with my current developing environment. My curren
  14. Thank you for replying.If I remember correctly the copy() function is suppose to create the destination file if it does not already exist. What I have learned since I began using the copy() function is that my administrator's write permissions are automatically suppressed when I create a folder using Dreamweaver in the MAMP webserver environment -- this, despite the fact that as the computer's user I am allowed both read and write permissions.My computer has two accounts that share administrative rights. Could this be a source of my difficulty?
  15. Thank you for the very thorough response to my many questions. I am a little embarrassed by the fact that I was unable to find the getcwd() function in the list, though. Certainly my lack of understanding about the alphabetization of the underscore played an important role in my oversight.This said, I do have one more very important question regarding the use of the getcwd() and chmod() functions. When setting the permissions for a particular file using the chmod(getcwd(),0###) are the permissions made the same for all of the folders along the path or only for the file containing the comman
  16. iwato

    PHP/SQL Security

    I know that this is not my topic, but security is a matter of important concern for me, as I have been the subject of hackers in the past. Could you please be more specific about how the adding of HTML special characters can deter the unwanted appearance of php scripts to get and post data transfers? Or, have I misunderstood?Roddy
  17. QUESTION ONE: What is getcwd( )? I looked this function up in the function reference of the PHP website, and it did not appear.QUESTION TWO: Does setting my permissions to 0777 affect anything besides the PHP environment of my webserver?QUESTION THREE: In so far as online security is a problem would it not be wiser for me to reset my permissions as follows: 0774 or even 0770?Roddy
  18. I ran phpinfo(), but a keyword search did not reveal anything called USERNAME. What I did find among other things, however, is the following:PHP COREignore.user.abort : Offuser.dir : no valueMYSQL/MYSQLImysql.default.user : no valuemysquli.default.user : no valueSTANDARDuser_agent : no valueENVIRONMENTUSER : iwatoHOME : /Users/iwatoBy the way, MAMP Pro does give me access to a file called php.ini in which a search for the term USERNAME revealed the following:; The directory under which PHP opens the script using /~username used only; if nonempty.user_dir =Is the above helpful?
  19. Thanks for responding, but this cannot be. These results are arising from a test server on my own machine. In the event that it could a source of trouble and a solution I am using MAMP Pro.Roddy
  20. QUESTION: What could be causing the following error message? Once again the file that contains the PHP code is in the same folder in which $file should be copied.ERROR MESSAGE: "Warning: copy(nonPHP_file.txt) [function.copy]: failed to open stream: Permission denied in ..." <?php $filepath = "../fopen/nonPHP_file.txt"; $file = "nonPHP_file.txt"; copy($filepath,$file); ?> Roddy
  21. QUESTION: Is it a problem of path, file name, or something completely different all together? The following code fails, and I do not know why. <?php $file = "../fopen/nonPHP_file.txt"; $newfile = "nonPHP_file.txt"; if (!copy($file, $newfile)) { echo "Failed to copy " . basename($file) . "."; } ?> BACKGROUND: The PHP file in which this code resides is located in the same folder into which $file is to be copied. Also, $newfile already exits with the same indicated name in the folder into which $file is to be copied.ERROR MESSAGE: Parse error: syntax error, un
  22. Unfortunately, the elements were of a mixed bag. The goal was to extract a comma delimited line from a larger body of text and parse the various elements of the selected line. This is what worked thanks to everyone's input. Of course, there may be a better way to do it of which I am not aware. Still, I am very happy! Hooray! Hooray! <?php $i = 1; $n = 6; $file = fopen("mixed.txt", "r"); while ($i < $n) { $varName = 'element' . $i; $$varName = fgetcsv($file); $i++; } echo count($element3); foreach ($element3 as $greeting) { echo $greeting . "&l
  23. Thanks, jkloth. I made some minor changes to your code, so that it would better reflect what I believe you meant it to say, and it works fine.1) What I find amazing about this code is the double use of the dollar sign. Does this mean that you can make the value of any variable into a variable name by simply doubling the $ sign of the variable name and initializing the new result?2) Also, I am very surprised that the presence of the dollar sign inside a quoted string retains its character of a variable. Notice that I had to insert the special character $#36; in order to get the phrase $eleme
  24. Being the PHP novice that I am, I purchased MAMP Pro and am running a Dreamweaver test server with Apache as my webserver.Roddy
  25. PROBLEM: I have an array of undetermined size whose elements I wish to split and assign each to a separate sequentially numbered list of variables. How does one dynamically create a sequential list of variables.The output should appear as follows:element1, element2, ... , elementnwhere n can be any finite number.I have tried the following, but it fails to recognize the concatenation as a new variable name and results in an infinite loop of error messages. <?php $i = 1; $n = 6; while ($i < 6) { $element . $i = $i . "<br />"; echo $element . $i; $i++; }?> Roddy
×
×
  • Create New...