Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. ^^^ If that means database records, why not just get your query to return the results in the order that you want them and then simply iterate over the records (once) and display them the way you want?
  2. The complete php documentation is available online or via download - http://us.php.net/docs.php The page for the date() function would be a worthwhile read.
  3. There have been at least two different error messages mentioned above. In programming help forums, you must be exact in your statement of what your code is doing or not doing and what you specifically need help with because we are not standing right next to you. So, statements like 'still it isn't working' and 'mentioned above' when more than one error/problem has been mentioned above are a pointless waste of bandwidth.
  4. Kind of a general answer - yes you could modify the form processing code of your current mad4joomla extension to insert the data into your table. This would allow you to keep getting the information via email while you get the database part working. I assume that the current script validates the data before putting it into the email and sending it. All you would need to do is escape the string data (see the mysql_real_escape_string() function), form the INSERT query, and execute the query.
  5. You would use ORDER BY FIELD(....) - http://dev.mysql.com/doc/refman/5.0/en/string-functions.html#function_field ORDER BY FIELD(status, 'New', 'Today', 'Tomorrow', 'Soon', 'Future', 'Complete')
  6. Is your existing form to email page done using a Joomla extension? Because, there are form to database extensions that look like they can do everything you want. In fact, your existing form to email extension might have the ability to store the information to a database table.
  7. You should add a status or approved column to your table, since you probably don't want to automatically display new submissions without reviewing (moderating) them first. I'm sure you probably have filtered out a number of spam submissions and corrected spelling and what-not in others before you put the information onto your live site. When your code inserts the row into your table, either leave the status/approved column empty or put in a value that indicates the information has been submitted but not reviewed. After you review the newly submitted information, you can change the status/approved column value to one that indicates the data should be displayed on your web site. Your code that dynamically produces the menu and displays the requested field information would check the status/approved column value and only process the ones that have been approved.
  8. $_POST['image.x'] doesn't exist and won't ever be set. From the link I posted - All you need to use is - if(isset($_POST['image_x'])){
  9. From the mysql_query() documentation -
  10. If it's got php code in it, no matter what you name it or how you request it, it IS server-side scripting. It's not actually HTML until it has been processed on a web server and sent out to the browser. Any HTML validation errors you are getting from your editor don't apply until after the php code in it has been parsed, tokenized, and interpreted.
  11. You are attempting to validate php source code as though it was HTML. It is not.
  12. You can either create an instance of your class in a session variable or you can simply copy the instance to/from a session variable. The class definition needs to exist before the session_start() statement so that the object can be recreated. It is not and never was necessary to serialize an object to store it in a session variable.
  13. ^^^ What exactly does that involve and what is the data structure or method used to store that information?
  14. Where would the missing rows occur in that output? All at the beginning, all at the end, or randomly through out the data? Post the missing rows, so that someone could possibly identify if there is something about them that would cause this? Also, what is the complete code in your while(){} loop? What does a 'view source' in your browser show, because you could have something in the data that looks like HTML tags and is causing the missing rows to show up in the source in your browser but are not being rendered by the browser? If you wrap your print_r() statement in HTML <pre> </pre> tags the output will be formatted and easier to read.
  15. Use - ORDER BY strDate The YYYY-MM-DD format can be sorted because the fields making it up are left-to-right, most-significant-digits (year) to least-significant-digits (day). Your B d, Y formatted value cannot be sorted.
  16. mysql_query() can only execute ONE query statement at a time.
  17. The query that's failing is the one after the extract($row) statement and the $title at that point is not escaped, it is the raw value from the extract() statement. If you have already queried for the matching information, that includes the author, why on earth are you executing another query to get that same information?
  18. You apparently have a blank line before the <?php tag. That is output that is sent to the browser and will produce a header() error. At the risk of being repetitive, someone has previously suggested to you to set error_reporting to E_ALL and display_errors to on so that php will help you when you are developing and debugging your code. You will save a TON of time.
  19. Uploaded file information is in $_FILES, not $_POST and given that your $_POST array has something in it suggests that your form doesn't have the correct enctype= parameter in it.
  20. array_walk_recursive($_POST, 'filter'); extract($_POST,EXTR_SKIP);
  21. Someone gave two different ways of doing this, that are secure, in your first thread for this - #1 can be accomplished by making an array of the expected index names and use that to iterate over the $_POST array. #2 can be accomplished several different ways - a) Using the $_POST['....'] variables directly in your code (after applying your filter function to them.) b) Using your $mydata['....'] variables. c) Using extract() with either the EXTR_PREFIX_ALL or the EXTR_SKIP flag.
  22. Variable-variables are three times slower than using an array variable. Why did you switch what you are doing, from your existing thread for this problem? Also, the code you current have exhibits the same security hole that was mentioned in your existing thread and will allow a hacker to set any of your existing variables. So, for example, if you have a variable $admin that determines if I am an administrator to your script, a hacker can set that by including a $_POST['admin'] value when he submits to your code and he can do anything that your script allows an administrator to do. You are trying to execute a filter function on the post data to make it safe, but you are opening up a security hole that is more serious than what the form data could possibly do.
  23. strtotime() and date() are fairly slow and you have a ton of extra ones. This is all you need - date("Y-m-d", strtotime(date('Y-m') . "-01 +1 Month"));
  24. You are producing the $header variable before you have assigning anything to the $email variable that it contains and the Reply-to: header is an empty value. You would want to produce the $header variable after any variables it contains have been assigned a value.
  25. You can use array_map() instead of your foreach() loop (which will leave the filtered results in the $_POST array). It will be 2-3 times faster and won't double the about of memory needed to store the data in memory. Why do you want to make individual variables? The $_POST variables are perfectly fine variables. If you still want to use individual variables, you should only convert expected variables (so that hackers posting data to your code cannot inject their variables into your code, possibly bypassing security on your site and taking it over) or you should insure that the variables you create have their own unique name-space so that they cannot overwrite any of your existing program variables. You can use extract() to do this on the original $_POST array or your intermediate $mydata array, but please use the EXTR_PREFIX_ALL parameter so that the created variables cannot overwrite any of your existing program variables.
×
×
  • 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.