Jump to content

AyKay47

Members
  • Posts

    3,281
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by AyKay47

  1. From the manual:

     

    'w+' Open for reading and writing; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.

     

    'a+' Open for reading and writing; place the file pointer at the end of the file. If the file does not exist, attempt to create it.

     

    'r+' Open for reading and writing; place the file pointer at the beginning of the file.

     

    each mode has different settings that control where the pointer is to be placed, whether or not to truncate data etc..

  2. Comment out the lines that are relevant to sending data to the log?

    I don't recommend removing them altogether as you may need them in the future, there is a reason the logic was implemented the way it was.

  3. $_GET and $_POST values are stored as strings so you cannot perform a strict comparison using a string and an integer, it will always equate to false. You can either use the loose comparison operator as Gristoi has done above, or you can cast the value stored in $_GET['error'] as an integer and use the strict comparison as you have done.

     

    As a side note, always check that $_GET and $_POST values isset before assigning their value to a variable.

  4. Use stripos which is the case-insensitive version of strpos(), will save you some writing.

    Also, in the elseif block conditional statement, place parens around each && condition for correct order of operations:

    (this && that) || (this && that)

     

    I don't quite understand you logic, I believe you want the post_cbox() function to execute but do not want any data to be written to a file?

  5. You are referencing index values that do not exist. You must first verify that both indices are set before using them.

     

    Pseudo code:

     

    if(isset($_POST['index']))
    {
     $i = $_POST['index'];
    }

     

    or the way I prefer:

     

    $i = (isset($_POST['index'])) ? $_POST['index'] : null;

  6. Not to be crude, but there are so many things wrong with this code that I cannot take the time at the moment to look through it all line by line.

    There is only one method that modifies the _errors property, i suggest looking there first and implementing proper error checking logic into your code during development.

  7. I thought the initial problem was that the called php file was not found?

    The foreach error is being triggered because you are passing the construct an object instead of an array. By default, if json_decode() is passed an object, it returns an object unless the second "assoc" parameter is set to TRUE.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.