Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. The $r index names will be just the column portion that is being selected - <tr><td align="center">{$r['Date']}</td> <td align="center">{$r['VenueName']}</td> <td align="center">{$r['FirstName']}</td> <td align="center">{$r['LastName']}</td> <td align="center">{$r['Position']}</td> <td align="center">{$r['Points']}</td> And as I have posted too many times, you should be learning php, developing php code, and debugging php code on a system with error_reporting set to E_ALL and display_errors set to ON in your master php.ini so that php will help you. (Confirm the actual settings using a phpinfo() statement in case the php.ini that you are changing is not the one that php is using.) You will save a ton of time. In this case you would have gotten undefined index errors that would have alerted you that the index names you are using are not what the query is returning.
  2. http://www.arraystudio.com/as-workshop/how-to-sort-mysql-results-ignoring-definite-and-indefinite-articles-the-a-an.html
  3. The error basically means that you did not satisfy all the relaying restrictions in place and the mail server resorted to checking the 'white' list of allowed recipient domains (in case you were unconditionally permitted to send email to the recipient domain, for example to your own domain hosted at the sending mail server.) Your web host should have then provided information as to which relaying restriction you are not satisfying. Best guess is that either the From: email address is not a valid mail box hosted at the sending mail server or you are required to use SMTP authentication against a valid mail box hosted at the sending mail server.
  4. ob_start() should only be used if you intentionally want to buffer output. It should not be used to fix header errors. In your case it did not help did it? And frankly, we are tired of people attempting to use it to 'fix' header errors instead of finding the problem with their code and fixing their code. Your problem is that your file either contains characters in it before the opening <?php tag (in which case just check if there are any characters before the <?php tag and remove them) or your file has been saved as a UTF-8 encoded file and your editor has put the BOM (Byte Order Mark) characters at the start of the file (in which case, save your file as an ANSI encode file or save it as a UTF-8 encoded file without the BOM.)
  5. At the risk of causing a huge discussion about what depreciated means and when something actually becomes depreciated (regardless of what the documentation states), register_globals were actually depreciate in php4.2 when they were turned off by default and they were superseded by the use of the correct super global arrays (which is the definition of depreciated - http://en.wikipedia.org/wiki/Deprecated ) The only change in php5.3 is that the register_globals setting being on will now cause an E_DEPRECATED error to be thrown at startup.
  6. Any chance you are checking if the file exists first and that cached status is being returned later in your code? See this note from the filesize() section of the manual -
  7. Usually, the additional server overhead when files are stored in a database is enough to convince anyone, even bosses, not to do it. There are just too many disadvantages and most reasons anyone can find to do it can easily be overcome using correct coding.
  8. I guess I'll post this one more time - You should be learning php, developing php code, and debugging php code on a system with error_reporting set to E_ALL and display_errors set to ON in your master php.ini so that php will help you. (Confirm the actual settings using a phpinfo() statement in case the php.ini that you are changing is not the one that php is using.) You will save a ton of time. In this case you could have probably saved a whole day of your time because you would have gotten an undefined index error concerning the mismatch in the variable name that would have alerted you to which one(s) did not match what the form was sending.
  9. If you are uploading the file using FTP or your hosting control panel, the owner of the file is the user that the FTP server or the control panel us running under. The user that the web server/Php is running under cannot alter the permissions (that would kind of defeat the purpose of having permissions.) You need to change the permissions on the folder and/or file using the same method that you used to upload it.
  10. PFMaBiSmAd

    NOW()

    It's not a Unix Timestamp, so directly adding a numerical amount of seconds to it has no meaning. What exactly are you trying to do?
  11. magic_quotes_runtime is probably on, thereby escaping the data from fread(). What does the following line of code show for both your development system and your live server - var_dump(get_magic_quotes_runtime());
  12. The $_POST[...] variables are already arrays. There is no need to define more arrays, copy each $_POST array into them, then loop through the arrays. Just loop through the $_POST arrays directly. See the 'form processing code" at this link - http://www.phpfreaks.com/forums/index.php/topic,278815.msg1320035.html#msg1320035 (note: the indexes in the code at that link start at 1, not 0 as you are using, so if you use any of the code at that link, adjust it to match your array index values.)
  13. Both a $_SESSION variable and a class variable (with the instance of the class in a session variable) would be available when the session is resumed, assuming your session is actually being started and resumed. It would take seeing the code that is not working to be able to determine what it might be doing that is causing the symptom and are you developing and debugging php code on a system with error_reporting set to E_ALL and display_errors set to ON in your master php.ini so that php would help you by displaying all the errors it detects?
  14. PFMaBiSmAd

    Forum

    See the items listed under the Open Source Demos menu at this link - http://php.opensourcecms.com/
  15. The class definition needs to exist before the session_start() so that the object can be recreated correctly. The only requirement is that the session_start() must come before any output is sent to the browser. Including/defining any classes/functions/settings that are used on the page can be thought of as an initialization/setup step for the page and generally should be done before the page actually does something (like a session_start() statement.)
  16. Umm. What editor are you using to create php code? I worded that the way it is so that you would not attempt to open the file with a native Word editor.
  17. The getTIME() function needs to return the value, not echo it. When you echo something in getTIME(), it is output immediately when getTIME() is called.
  18. Open the file using an ASCII programming editor and see if there are any php generated error messages in it, either at the start or end of the file.
  19. The form in the code you posted, submits data to the form processing code and produces a var_dump($strSQL) that looks like this (tested) - "SELECT r.restaurants_id ,r.restaurantname ,r.image FROM restaurants r INNER JOIN zip_codes z ON r.restaurants_id = z.restaurants_id WHERE z.zip LIKE '%123456%' AND z.state = 'KS' AND r.restaurantname LIKE '%name%' GROUP BY r.restaurants_id" Are you submitting the form on that page to reach that page or are you using some other form/page to get to that page? Also, are you including that code in another page or redirecting to different pages? Short-version: Your $_POST array is empty for some reason, but submitting the form on that page does set the $_POST array and produces 'something' in $strSQL, so how you are submitting to that page is not using that form. It is also possible that your browser is requesting that page twice and you are only seeing the result of the second request, when the $_POST array is empty.
  20. In everything you just posted, you don't show the code that is doing that. However, in looking at your previous threads, you are testing if $strSQL is not empty and echoing it OUTSIDE of the conditional logic that is setting $strSQL. So, it would appear that you should actually be trying to find out why the conditional logic surrounding the code that is setting $strSQL is evaluating as FALSE. And that would be this code - $boolReset = isset($_POST['frmSearch']) && isset($_POST['frmSearch']['reset'])?true:false; if($boolReset === true && isset($_POST['frmSearch'])) { What do you get when you put the following lines of code immediately before that - echo "<pre>"; echo "POST:"; print_r($_POST); echo "</pre>";
  21. The posted code does not produce that error. You are either - A) Not executing the same file on your server that you are looking in (i.e. the file did not get uploaded onto your server), B) Looking at the wrong source file, C) Looking at the wrong query in the file, D) That is not your whole code and something you removed for the post is causing the problem, E) The variable $strSQL that you are setting is not the same as the one you are putting into the mysql_query(), either because you are using a Word Processor or a non-English keyboard and the variable name contains some odd character that is resulting in two separate variables that 'appear' to be the same. Think about it and investigate the possible reasons why you can be assigning something to a variable at one point in your code but that variable has no value at another point in your code. Best guess it that you actually have another query right before the code you posted or right after the code you posted and it is this other query that is producing the 'empty query' error.
  22. The directory uploads does not exist.
  23. http://en.wikipedia.org/wiki/MIME_type
  24. The form processing code in that tutorial is so minimal that it has almost no error checking, error reporting, or error recovery logic to get it to tell you why it is failing. Edit: And even the following code is not checking everything possible. Give this a try (you will need to modify the size settings and permitted mime types to suit your needs) - <?php // upload processing code with full upload-error testing logic ini_set("display_errors", "1"); error_reporting(E_ALL); // check if the page reqeust came from an upload form (to the best of php's ability) and if php can process uploads function check_request(){ // check if a form submitted to this code (exit/die if not) if(strtolower($_SERVER['REQUEST_METHOD']) !== 'post'){ echo "Page was not accessed through a post method form<br />"; return FALSE; // this code was reached via a request that was not a form submission } // check if uploads are enabled - // ini_get(), on gives a string with '1' (off is empty string or a string with '0') if(ini_get('file_uploads') !== '1'){ echo "Uploads are not enabled on this server and nothing can be uploaded<br />"; return FALSE; // cannot continue } // check for exceeding the post_max_size value (both the $_POST and $_FILES arrays are empty) or the form does not contan any named $_POST variable or it does not contain a file upload field $post_max = ini_get('post_max_size'); if(empty($_FILES) && empty($_POST)){ echo "Either the upload exceeded the post_max_size setting: $post_max, or the form is invalid (no enctype and/or no named file/post fields)<br />"; return FALSE; // cannot continue } // check for a form that contains a $_POST variable, but does not contain an upload enctype or it does not contain a file upload field if(empty($_FILES) && !empty($_POST)){ echo "Either the form does not contain a correct enctype attribute or it does not contain a valid named file upload field<br />"; return FALSE; // cannot continue } // $_FILES contains something return TRUE; } // end of check_request function // check the passed $_FILES... array for upload errors, mime type, and file size function check_upload($file){ // test for upload errors if($file['error'] > 0){ echo "An upload error occured, error number: {$file['error']}<br />"; switch ($file['error']) { case 0: echo "The file uploaded to the server OK<br />"; break; case 1: echo "The uploaded file exceeds the upload maximum size directive in php.ini<br />"; break; case 2: echo "The uploaded file exceeds {$_POST['MAX_FILE_SIZE']}, the MAX_FILE_SIZE directive in the HTML form<br />"; break; case 3: echo "The uploaded file was only partially uploaded<br />"; break; case 4: echo "No file was selected<br />"; break; case 6: echo "Missing a temporary folder<br />"; break; case 7: echo "Failed to write file to disk<br />"; break; case 8: echo "File upload stopped by extension<br />"; break; default: echo "An unused error value was returned<br />"; } return FALSE; // cannot continue } // check the mime type $types = array(); $types[] = 'image/gif'; $types[] = 'image/jpeg'; $types[] = 'image/pjpeg'; if(!in_array($file['type'],$types)){ // not found echo "The mime type of the uploaded file: {$file['type']}, is not permitted<br />"; return FALSE; // cannot continue } // check the file size $max_size = 200000000; if($file['size'] > $max_size){ // exceeds max echo "The file size of the uploaded file: {$file['size']}, exceeds the permitted file size of $max_size<br />"; return FALSE; // cannot continue } return TRUE; } // end of check_upload function // main code $target_path = "uploads/"; $files_index = "uploadedfile"; // check if the request for this page can be processed (came from a form and uploads are enabled on the server...) if(!check_request()){ // the request for the page cannot be processed die; } // the $_FILES array has something in it, $_POST array may or may not depending on the actual form fields (should at least have a named submit button) // start normal form processing code if(isset($_POST['submit'])){ // check the uploaded file for errors, mime type, and file size if(check_upload($_FILES[$files_index])){ // the uploaded file can be moved // test if the destination file already exists if(file_exists($target_path . $_FILES[$files_index]["name"])){ echo "{$_FILES[$files_index]['name']} already exists.<br />"; } else { // move the uplaoded file if(!move_uploaded_file($_FILES[$files_index]["tmp_name"], $target_path . $_FILES[$files_index]["name"])){ // the move failed echo "Could not process (move) the uploaded file<br />"; } else { echo "Uploaded file was stored in: $target_path{$_FILES[$files_index]["name"]}<br />"; // other code to process the uploaded file would go here... } } } else { // echo "check_upload() returned FALSE and should have printed an error message why the upload failed<br />"; } } // end of form processing code echo "done"; ?> You will also need to give the submit button a name - <form enctype="multipart/form-data" action="uploader.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="100000" /> Choose a file to upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" name="submit" value="Upload File" /> </form>
  25. Here is something I found that seems relevant -
×
×
  • 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.