Jump to content

PFMaBiSmAd

Staff Alumni
  • Posts

    16,734
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by PFMaBiSmAd

  1. LOL, I came up with almost the same code changes - <script type="text/javascript"> NavName = navigator.appName.substring(0,3); NavVersion = navigator.appVersion.substring(0,1); if (NavName != "Mic" || NavVersion>=4) { entree = new Date; entree = entree.getTime(); } function calculateloadgingtime() { if (NavName != "Mic" || NavVersion>=4) { fin = new Date; fin = fin.getTime(); secondes = (fin-entree)/1000; window.status='Page loaded in ' + secondes + ' seconde(s).'; document.getElementById("loadgingpage").innerHTML = "Client side page generation time " + secondes; } } window.onload = calculateloadgingtime; </script> <style type="text/css"> li {width: 5px; height: 5px; float: left; display: inline;} </style> <?php $s1 = microtime(true); $col = 1; $c[1] = "#ffcc00"; $c[2] = "#ffff99"; $c[3] = "#cfeef6"; $c[4] = "#b2ebc5"; $c[5] = "#ffffff"; $c[6] = "#d7ebff"; $c[7] = "#dfceb9"; $c[8] = "#b3ccc5"; while ($col <= 200) { echo("<ul style=\"width: 1000px; height: 5px; border: 0px; margin: 0px; padding: 0px;\">"); //echo "<ul>"; $row = 1; while ($row <= 200) { $number = rand(1,; $bgcolour = $c[$number]; //echo("<li style=\"background-color: $bgcolour; width: 5px; height: 5px; float: left; display: inline;\"></li>"); echo "<li style=\"background-color: $bgcolour;\"></li>"; $row++; } echo "</ul>"; $col++; } $e1 = microtime(true); $t1 = $e1 - $s1; echo "Server side page generation time: $t1"; ?> <div id="loadgingpage"></div> I did find that reducing the inline css in the li tag helped by reducing the amount of characters that are being sent (edit 3.9M down to 1.7M.) I have not tried it, but using a single image either as an image map or simply getting the coordinates where it is clicked seams to be like it would be a faster method. edit2: Or perhaps using a separate image per row.
  2. If you didn't get the min and max values, then your date column is probably not just the date and you would need to put the mysql DATE() function around it.
  3. display_errors should be OFF for a live site. log_errors should be ON so that you capture the errors into the log file. Also see the error_log setting that determines where the errors are written to.
  4. Doesn't that suggest to you that you should put it on the outside of a php string?
  5. BETWEEN is inclusive of the min and max values. Did you even try the query that you posted?
  6. gmdate() is a php function. You cannot put it inside a php string. When put inside of a string, your code is the characters 'g','m','d','a','t','e','(','$,'d','a','t','e',')'.
  7. Not if you concatenate what is already there with the additional information. See the mysql CONCAT() function I used in that single UPDATE query. Based on the code you have posted and the var_dump's your update query should be working. What exactly makes you think it is not?
  8. How about var_dump($_SESSION[ticketid]) ? Since you are apparently not getting the or die() message, the query is being executed without error and something is causing the WHERE clause to be false. Also, after looking more closely to what your code is doing, you don't need to SELECT the data in order to UPDATE it, just use one query to UPDATE it - $newtechcomments = " Ordered Parts {$_POST['part']} {$_POST['pprice']} From:{$_POST[pfrom]} $today"; $sql11="UPDATE tbl_ticket SET col_techcomments= CONCAT(col_techcomments, '$newtechcomments') where id = $_SESSION[ticketid]";
  9. $_POST['ticketid'] probably contains a non-printing character. What sets $_POST['ticketid'] in the form and what does using var_dump($_POST['ticketid']) show?
  10. Based on where the error message states the output is started at - You likely have 6 new-lines before the first opening php tag <?php or you have some html before the first opening tag and you didn't post it with the rest of the code in the file.
  11. Tables hold rows. Databases hold tables. The limit is more of a size limit of how much data you can store in a file under the operating system you are on. If your table has an autoincrement key, the row limit would be that of a BIGINT value - 18,446,744,073,709,551,615
  12. Using GD functions to just output an image is a waste of resources. If you are not manipulating the image, just output the correct content type header followed by the image file. See this function - readfile The GD functions create and operate on a uncompressed bitmap image of your original file (jpg, gif, png... are compressed image formats) and require a large amount of memory.
  13. Why don't you just read the php.net documentation to find out what it does do - is_uploaded_file
  14. You cannot rely on $_SERVER['HTTP_REFERER'] for any security purpose. It is an optional header that anyone can set to make it look like they came from paypal. Soon after you start doing what you are attempting, you will find that all kinds of people and scripts will access the page on your site for free. You must check and record the information that the paypal IPN sends back to you to determine if the visitor actually paid. There are countless php/ipn scripts that you can use to capture this information into a database. It would then only be necessary to put code on your protected page to check against the database information if the visitor has paid.
  15. You are going to find that when you get to this step - that you have a different number of fields listed vs the amount of data values. Putting error checking/error reporting(logging) logic in an application is important for a couple of reasons - 1) It will make debugging go quicker because you will get immediate feedback both if and where a problem is occurring. There won't be this - my code does not work and I don't know why feeling, because your code will already be telling you which statement is failing and what error is occurring. 2) In a real application on a live server you need a record of problems so that you can find and fix them. You also need to output a 'user' error message to tell them that an action cannot be completed, rather than leave them with a blank or broken web page.
  16. What have you done to debug where your data is what you expect and where it is not? What does the following show (you may need to temporarily submit the data using an actual GET method form) - echo '<pre>',print_r($_GET,true),'</pre>'; Also, form your query string in a variable ($query) and echo it so that you can see what it actually contains. I suspect the problem is actually that you are not escaping any of the data being put into your query and some ' or " is breaking the query syntax. You need to use mysql_real_escape_string() on each value being put into the query. And your code does not have any error checking or error reporting logic in it to even tell you if the query failed due to an error or what the error is.
  17. The end of life and end of support for php4 was over two and a half years ago. Your web host should have provided a way of upgrading to php5, either through your web hosting control panel or through a setting in a .htaccess file...
  18. On your first page (every page that sets or references a $_SESSION variable), you need a session_start() statement.
  19. Then you should be well aware of the short-cuts that php has that you should never use in code that is intended to be put onto servers that are not under your control. Your code is using lazy-way short open tags.
  20. You do realize that dynamically adding/duplicating a form on a page would serve no clear useful purpose because you can only fill in and submit one form on a page. If you had the original plus two dynamically produced duplicates, you can only fill in one of them and submit it, you might as well just fill in the first one that was already there and not bother with the dynamically produced ones. However, if you are trying to dynamically add fields to a form, that makes sense and there are countless examples posted all over the Internet. Which are you trying to do?
  21. The From: email address must be a valid mail box at the sending mail server. The email address that a visitor enters should be put into the Reply-to: address in the extra header.
  22. There is no SHA hash, but SHA would generally be referring to SHA1 - http://en.wikipedia.org/wiki/SHA-1 You don't. SHA/SHA1 is not encryption. It is a one way hash (checksum) and it cannot be decrypted.
  23. Scripts that resize compressed images (jpg, gif, png) must first make an uncompressed bitmap image of the file so that the actual image data can be operated on. This takes a large amount of memory. If the script uses the GD php extension, it will be limited by the amount of memory available to php. If the script uses ImageMagick, a separate executable/command line utility, or any other utility program, it can resize images subject to the amount of memory made available to that utility program. Have you determined how much you can increase php's memory limit and/or if a utility program like ImageMagick is available on your server?
  24. The INSERT query has an ON DUPLICATE KEY UPDATE option that will allow you to do this -
  25. As I posted in your other thread you started for this same problem (why did you do that), if you perform the date math inside of the mktime() function it will rollover the months/years correctly. You won't even need to use the if(){}else{} code to test when the month needs to be reset back to 01.
×
×
  • 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.