Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. Your file has been saved as a UTF-8 encoded file and the BOM (Byte Order Mark) characters that your editor placed at the start of the file is the content being output on line 1 of index.php (see the error message) that is preventing the headers from working. Save the file as an ANSI/ASCII file or if you must save it as UTF-8, save it without the BOM characters.
  2. And what URL are you entering in your browser, it should be something like http://localhost/filename.php
  3. Your dbconn file is using short open tags, so the code in it is not being executed and you apparently have a connection being made at some point, someplace else in your code, but not the mysql_select_db(); Only use full <?php tags to avoid wasting your time.
  4. You previously has mysql_error() as part of your die(...) statement. Why did you remove that. It would be telling you why the query failed to execute.
  5. You would use an array, but there is no real good reason for anyone to need more than a few different connections in any one script. Sounds like a bad database table design.
  6. I just read the start of one of your previous threads. One of the main points of php is to dynamically output content where you want it, when you want it, instead of hardcoding HTML that you must change every time you want to update the content on a site. To use php for what you are doing, you would store just the data (a list of images) someplace (flat file, mysql...) or even just use the list of images found in a folder(s) and then dynamically produce the output that makes up any page. Using pagination, you would have a single .php file that is used to display any selected page in the gallery. The php code would determine which set of the available images to put into <img tags on the requested page.
  7. 67M bytes is a significant amount of memory for one script to be using. For the code you posted, you would need thousands of gallery files with thousands of <div...> tags in each one. The questions become, what else is your script doing up to that point and how much memory is in use before the for() loop that starts the posted code, and why aren't you using a database to hold this information instead of parsing through it each time? In order to fix a memory problem, you need to start by finding out which portion of your code is using the memory.
  8. Correction to the above post - mm-dd-yyyy should have been dd-mm-yyyy
  9. Here is a bug report where php had support for the mm-dd-yyyy format at some point, it was removed, then added back in - http://bugs.php.net/bug.php?id=36396 I did not find anything specific where support for that format was first added. [Edit: php.net, it's kind of hard using undocumented features in a programming language.]
  10. The formats containing a "-" that strtotime() understands are - 1972-09-24 # ISO 8601. 72-9-24 # Assume 19xx for 69 through 99, # 20xx for 00 through 68. 72-09-24 # Leading zeros are ignored. 24-sep-72 I have seen the 24-sep-72 format work where 'sep' is actually the month number (probably under php5), but you have likely come across a case where the strtotime() function was 'enhanced' under php5. You can ultimately fix this so that it will always work by rearranging the fields to match the first format on that list.
  11. 1301616000 produces an 2011 date on my php5 system, so there is something wrong with the output from the strtotime(). Is the server's date/time set correctly? Also, I would not put an assignment statement as part of an echo statement. 05/10/2009 produces a Unix Timestamp in the vicinity of 1254722400
  12. Have you echoed $_REQUEST['date1'] right before that code, because it is more likely that you have a same name post/get/cookie that is overwriting the value or that register_globals are on and you have a session variable by that same name that is overwriting the value. A) You should not use $_REQUEST (ever). Use the correct $_POST, $_GET, or $_COOKIE that you expect a value in, B) If register_globals are ON, you should know which of your servers have them on and be aware that they cause same name variables to all be cross-populated.
  13. You would need to provide an example of what you are getting and tell us what it should be.
  14. You are putting a @hotmail.com address into the From: address. Hotmail knows that you are not sending the email from a hotmail mail server and is discarding it. You need to put a valid email address host at the sending mail server into the From: address.
  15. The three values are in the array, just put them into the query and execute it - case "TIME": // this is the tag that is after the end of the stated set of data, complete and execute the query here - // code to build your whole query statement and your mysql_query() goes here ... // print_r($_SESSION['parts']); // contains the three values for sku, part, qty $query = sprintf("INSERT INTO products (sku, part, qty) VALUES ('%s','%s',%d)", mysql_real_escape_string($_SESSION['parts']['SKU']), mysql_real_escape_string($_SESSION['parts']['PART']), (int)$_SESSION['parts']['QTY']); mysql_query($query); break;
  16. To troubleshoot why the mail() function call is failing, add the following two lines of code immediately after the first opening <?php tag in test.php - ini_set("display_errors", "1"); error_reporting(E_ALL);
  17. Unless you bother to state exactly what problem you are having and what you see in front of you when you try your code, no one can directly help you. We are not standing next to you. If you aren't, can't, or won't provide relevant information in your post, you cannot get a relevant reply. For all we know, you don't have php installed on your web server.
  18. Echo $_FILES["file"]["type"] as part of the "Invalid file" message.
  19. Unless you bother to state exactly what problem you are having and what you see in front of you when you try your code, no one can directly help you. We are not standing next to you. If you aren't, can't, or won't provide relevant information in your post, you likely won't get a relevant reply. For all we know, you are not even calling that function in any of your main code.
  20. If you don't display the value that is failing, you will never find out why your test is failing.
  21. The problem is occurring because the process.php file not not being parsed as php code. You have somehow either browsed directly to the file or the file extension is not actually .php or it is in a folder where the php language engine is not enabled.
  22. You need to validate everything possible about the uploaded file if you want your script to be safe. You must test the ['type'] and the file extension and if possible validate that the actual contents in the file matches what the type and extension indicates. You must also put uploaded files into a folder that either has the php language engine disabled or prevents direct http/https request to those files. See the following thread for an example of what can happen when you don't do everything possible to secure what is uploaded and where it gets put on your server - http://www.phpfreaks.com/forums/index.php/topic,270592.0.html
  23. The mime types for .zip and .rar can be - 'application/x-rar-compressed' for rar application/x-zip-compressed' for zip 'application/zip' for zip Unfortunately, different browsers send different values for the same file, so you need to test for all those. It is best to put the accepted values into an array and use in_array to test what was received against the values. I know you probably got that upload code at w3schools.com, but it is WRONG and you need to fix it. When they added the ['type'] test to the example they were developing, they added it before the test of the uploaded ['error'] element. The ['error'] element must be tested first because several of the upload errors won't set the ['type'] element, so that code will report an invalid file type when in fact an upload error occurred and the code to test for and display which upload error occurred will never be executed. The code to display the result of testing the ['type'] should also display the value that failed the test so that you can see exactly what it is (some browsers send different mime types for the same file.)
  24. If the problem is that in the following code, you are only getting one of the emails? - mail("example@mail.com", "{$cleaned['subject']}", $body, "From: {$cleaned['email']}"); mail("example@mail.com", "{$cleaned['subject']}", $body, "From: {$cleaned['email']}"); The problem is most likely because the From: address needs to be a valid email address hosted at the sending mail server. You should put the email address that the visitor entered into the Reply-to: address, not the From: address. Then put a valid email address hosted at the sending mail server into the From: address.
  25. You can put ANYTHING you want in the SELECT list in a query - SELECT *, DATE_FORMAT(your_column, 'actual format string') as formated_date FROM your_table ... If you are fetching the row as an object, you would access the result in the above as $row->formated_date
×
×
  • 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.