Jump to content

requinix

Administrators
  • Posts

    15,229
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. Oh. Here's a question I'll pose for you: If the browser is currently displaying the page at http://www.example.com/items/p/123/and you tell it to make an AJAX request to search.php url: "search.php",what do you think the full URL to that page will be?
  2. As you can tell, RewriteRule ^items/p/([0-9]+)/?$ /items.php?page=$1has absolutely nothing in common with url: "search.php",So what do you mean by it's "blocking" scripts? Are you getting 404s? Or what? What else have you changed in the .htaccess recently?
  3. Fix the code? You didn't post that part.
  4. First, can you verify whether and when the cookie is being set? Forget the appearance of the page and look at the cookie directly through your browser's developer tools.
  5. The cookie parameters need to be the same every time you access it. That means including path:/ when setting the cookie, not just when removing it. Are you sure that the cookie is not set? You've manually checked the value in your browser? So it's definitely not the case that the cookie is set correctly but the page is not showing the right... whatever it shows?
  6. You'll need to use imagettftext instead: give it a path to a bold font (yes, the font itself must be bold) and whatever size you want. For centering you'll need imagettfbbox to determine the size of the rendered text, then you can calculate the correct offset for imagettftext so that the text is placed in the center. Google has suggestions on how to do that.
  7. And saving uses the filename? Huh. Didn't know that.
  8. Ubuntu probably means you're using Apache for the web server. (Or is it nginx?) Can you edit the virtualhost configuration? Are you using .htaccess files? And you should verify the caching thing I assumed first. Open up your browser's developer tools, look for a "network"-type thing that shows page requests, make sure it's enabled or activated or whatever so that it's working, then load up a page from the intranet site. The tool should then show you information about each page that was requested, including the Javascript and CSS files. Pick one of those. Somewhere in the details will be a list of the request and response headers - what are they?
  9. Can you ask whether the mail is being sent immediately or being queued through a sendmail service? If immediately, is there a way you can make your emails be queued instead? Queuing will be much faster: sending requires connecting to the remote mail server, sending the contents of the mail, waiting for the server to validate everything and check you against spam services and whatnot, while queueing is just the amount of time it takes to save the email to the server (so it can go through the sending process later without impacting your script). Otherwise, short of moving to dedicated hosting where you could manage all this yourself (for better or worse), something like MailChimp will probably be your safest bet. Unless you wanted to implement the mail queue yourself, but I don't think I would recommend that in this case - if it's even possible given what you have access to.
  10. Caching is set by something. Generally the server, since that's the one handling the files, but if you're passing these files through PHP code first (for some weird reason) then you'd have to be explicitly doing something about caching in there. If you didn't do anything then the server is likely using Expires: it instructs the browser to not even attempt to redownload the resource until some specific time has passed. That works well... up until you change the resource, so all in all it doesn't work well. What web server are you using? Are you the one who manages it?
  11. If you don't mind forcing a download instead of presenting it in the browser then you can do header('Content-Disposition: attachment; filename="quote-123.pdf"');Otherwise make the URL to the PDF be something that ends in /quote-123.pdf. You can use URL rewriting (nicer) or change your /path/to/script.php to be like /path/to/script.php/quote-123.pdf which should still invoke your PHP script (easier).
  12. Based on those numbers (which you got from code that I revised... but not fast enough) it took six seconds to send the email. That's slow. Talk to your hosting provider.
  13. Oh, not your own hosting? Perfect. Complain to them that sending emails is slow and they can look into it. But first, be sure that it's not your code. Try a simple mail script <?php function udate() { list($us, $s) = explode(" ", microtime()); return date("Y-m-d H:i:s" . ltrim($us, "0"), $s); } header("Content-type: text/plain"); echo "Time before sending mail is: ", udate(), "\n"; mail("youremail@example.com", "Test", "The time is " . udate(), "From: noreply@mysite.com"); echo "Time after sending mail is: ", udate(), "\n"; and see how long it takes.
  14. Fix your caching so that it correctly indicates when and when not to refresh a resource. How does it work right now? Maybe there's a site you can point us to?
  15. Why do you need a database? Why do you need anything more complicated than something like function get_months() { return ["January", "February", "March", etc]; }Internationalization/support for different languages is an acceptable answer, but doesn't seem to be the case here.
  16. Not sure you understood what I said... What is installed on your system that is sending the email? It's probably not PHP, rather PHP is telling the thing to send the email.
  17. Do you know it's the mb_send_mail() and underlying mail() that's slow? Could it be the machine's MTA that's being slow - perhaps trying to send the email immediately instead of queueing it up locally to send later?
  18. Use strptime to read in the date string, then date to output it in whatever format you want. Or DateTime::createFromFormat followed by ->format.
  19. How To Ask Questions The Smart Way When you come back to fill in the missing details, include your code inline in your post - attachments are annoying to deal with.
  20. How To Ask Questions The Smart Way When you come back to fill in the missing details, include your code inline in your post - attachments are annoying to deal with.
  21. It's easy to make PHP look bad when you don't try to use it well. <?php foreach ($data as $eid => $cdata) { ?> <tr> <td class="eid"><?=html_escape($eid)?></td> <?php foreach ($cdata as $content) { ?> <td> <ul> <?php foreach ($content as $file) { ?> <li><a href="#"><?=html_escape($file)?></a></li> <?php } ?> </ul> </td> <?php } ?> </tr> <?php } ?> First of all, do you understand what the code you have already is doing? How it works?
  22. If you can turn the string A.pdf; B.pdf; C.xlsx into a prefix A.pdf separator B.pdf separator C.xslx suffixformat, all with the same "separator", then it fits into the code you already have. Do you see how you can do that?
  23. Thank you page? Where is that? I don't see any message in the PHP: if everything works then you should get a blank page.
  24. Given how you're borrowing Youtube videos for the playback, we are not going to help you.
  25. You also need a line of code that adds the month category into the array. Outside of the loop. $out[$element['category']]['category'] = $element['category'];Take a look at the documentation for array_values. Do you see what it does to arrays? It strips off the custom keys and replaces them with regular numeric keys. You need to do that to your array before you json_encode() it - those custom keys vs numeric keys are what makes the difference between getting {} objects or [] arrays in the JSON.
×
×
  • 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.