Jump to content

requinix

Administrators
  • Posts

    13,982
  • Joined

  • Last visited

  • Days Won

    351

Community Answers

  1. requinix's post in Catching All HTTP Requests to Apache and Storing Them in DB was marked as the answer   
    Or it could be Apache couldn't log anything useful there because the client did not send a request in a timely manner - which is exactly what 408 means.
    Ignore that line, possibly by a regex or something, or ignore the warning from AWStats itself.
  2. requinix's post in Filtering data values according to multiple dropdowns was marked as the answer   
    Use one single onchange handler for all the dropdowns: put the filter inside a <thead> so you can use a simple selector to find them all (without any IDs). Then make that single handler retrieve and submit the values for all the dropdowns.
    And for crying out loud, learn how to name things. "your_id_name"? "selected" versus "selected_contact"? "selected_input" and "selected_input2"? Give those things actually meaningful values. It'll make your life easier.
  3. requinix's post in Removal was marked as the answer   
    Alright, then I'll do it in about 10 minutes.
  4. requinix's post in Passing data between 2 controller functions was marked as the answer   
    ajaxleadsreport is an action (not a controller) which means it gets invoked by the controller (which is the class) when it handles the route.
    If the indexreport view needs to render the ajaxleadsreport view then the listsreport action (method) should pass the necessary information into the indexreport view which will eventually pass the necessary information into the ajaxleadsreport view.
    So the ajaxleadsreport action (method) is not going to be used. Action renders view which renders another view.
  5. requinix's post in Conditional style for specific data in PHP was marked as the answer   
    Like how $inactive_status is never assigned a value. Or how it would be set to true if any of the agents are status=N.
    And I don't understand why you have all this stuff dealing with $statuses and $display_names.
     
    That's the general idea, though what you have there won't work (see what I said above).
    You can throw class names onto whatever elements you want to represent whatever information you want, then add CSS rules to target things you care about.
    Consider this:
    $month = 10; $year = 2021; $daysinmonth = date("t", mktime(0, 0, 0, $month, 1, $year)); for ($day = 1; $day <= $daysinmonth; $day++) { $date = mktime(0, 0, 0, $month, $day, $year); list($monthname, $dayname, $weekday, $fulldate) = explode("/", date("F/l/N/F jS", $date)); $isweekday = $weekday <= 5; ?> <span class="month-<?=$monthname?> day-<?=$dayname?> <?=$isweekday ? 'is-weekday' : 'is-weekend'?>"> <?=$fulldate?> is a <?=$dayname?> </span> <?php } ?> outputs
    <span class="month-October day-Friday is-weekday">October 1st is a Friday</span> <span class="month-October day-Saturday is-weekend">October 2nd is a Saturday</span> <span class="month-October day-Sunday is-weekend">October 3rd is a Sunday</span> <span class="month-October day-Monday is-weekday">October 4th is a Monday</span> ... and then you can do things like
    .day-Monday::after { content: "ūüėĘ"; } .day-Friday::after { content: "ūüéČ"; } .is-weekend { background-color: #ccc; } ¬†
  6. requinix's post in Passing data between pages to get a filtered output was marked as the answer   
    You can't detect what the user clicked on, but you most certainly can have the link tell the page what was clicked on.
    Such as by a query string of ?status=Hot.
    Grab that status from the query string and incorporate that into the query and page.
  7. requinix's post in Calculate numbers with comma was marked as the answer   
    I see that you're using the parseInt function. What does it do?
  8. requinix's post in PHP: How to read/ parse JSON so I can style the text in HTML was marked as the answer   
    You already have a thread for this.
     
  9. requinix's post in Image Not Uploading was marked as the answer   
    Step away from the computer, make yourself a sandwich or watch some TV or whatever you like, then come back to your code and look at the first line.
  10. requinix's post in printDiv is not defined? was marked as the answer   
    That's the code for printDiv but obviously Javascript doesn't think you've defined it. Which could mean anything from that code living in a completely irrelevant file to that function being defined inside of some other code that hasn't run and/or runs in a different context than the window. Hard to say which without knowing more.
  11. requinix's post in Help whit what its caled in the PHP envirinment when you call up was marked as the answer   
    It's not exactly easy to tell what it is you're describing, but I think the general term you're looking for is "front controller": where most/all code doesn't start off by executing individual .php files but instead everything goes through one file (typically index.php) which then has some amount of logic to determine what code should be running. That process can start with URL rewriting (telling the web server that everything should go through index.php) or simply using specially-crafted URLs (such as query strings like /my_directory/?stuff or PATH_INFOs like /index.php/stuff); the former is the modern approach.
  12. requinix's post in Slim CSRF session not found was marked as the answer   
    Read the error messages.
    The first one says that "use SlimCrf" is a pointless statement. It doesn't do anything.
    The second one says that it couldn't session_start() because there was output. Which there was: the first error message.
    What course of action do you think you should take?
  13. requinix's post in Need help with accessing an array within JSON that contains a dash was marked as the answer   
    While possible to do in object form like that, it would be easier to have json_decode give you an array instead.
    $json_string = '{"name":"Jeff","age":20,"active":true,"column-names":["title1","title2"]}'; $array = json_decode($json_string, true); printf('All done! Welcome to Homepage %s', $array["column-names"][1]);  
  14. requinix's post in Browser "Undo" Broken After preventDefault() in Custom Event Handler was marked as the answer   
    Undo doesn't work to go earlier than that new state? As in you can paste text, then make changes and undo those up to the point where you pasted?
    Looks like the answer is document.execCommand. Deprecated, but seems to be still supported by most browsers, and I haven't found an alternative.
  15. requinix's post in Regex lookaround to prevent adding a link inside another link was marked as the answer   
    Basically, my solution is that you set up a state machine to deal with the markup. After you've split on tags and non-tags, you go through the array while keeping track of where you've been.
    But forget it. I fell for a classic mistake again: processing an HTML string like text. HTML should be treated like the structural thing it is.
    1. Load your HTML string into a DOMDocument. That will also help clean up invalid markup, which regular expressions and string processing cannot do.
    2. Loop through all the nodes. If it's a link, skip it. If it's text, do the replacement (which involves creating a new node, not simply adding a string). If it's some other element, go through its nodes recursively.
    3. When you're done, dump the document back out.
    Doing that isn't exactly the easiest thing when you're not familiar with this kind of work, so https://3v4l.org/sehhK
  16. requinix's post in Opinion? Address Verification was marked as the answer   
    For these sorts of questions it's often a good idea to see what other sites (eg, Amazon) do, then consider whether their solution makes sense to your site.
    No.
    1. Don't change stuff the user inputted without them knowing. It's confusing.
    2. The address verification service could be wrong. It's happened to me.
    Not sure what you're describing.
    Showing the "fixed" and original addresses and asking them to pick (or to edit/enter a new one) is probably the most common solution.
  17. requinix's post in Function md5_file() Limits? was marked as the answer   
    Here are some relevant facts:
    1. max_execution_time has some nuances in exactly what counts towards the limit. For instance, on Linux systems it counts only the time PHP itself is working, and therefore will not count time for disk reads which are performed by the system.
    2. The average hard drive can stream data at about 125 MB/s. An 8 GiB file would take about 8000/125 = 64 seconds to read in full.
    3. PHP's memory usage is not a perfect correlation to the underlying source - especially given that md5_file() will be performing some amount of hashing work in addition to the literal file reads.
    4. PHP claims memory in blocks. 8MB = some number of blocks taken * the memory used per block.
    Do you want to know the exact truth of what PHP is doing, or would you like to continue investigating to see if you can discover it for yourself?
  18. requinix's post in Updating Textbox2 based on Textbox1 Autocomplete was marked as the answer   
    $query = "SELECT * FROM locations WHERE location_name LIKE '{$_GET['term']}%' LIMIT 25"; Stop that. You have mysqli so use its prepared statements.
     
    If you want the phone number to show up somewhere then you're going to have to return it with your AJAX. Look into the documentation for your autocomplete plugin to see how you should proceed.
    For example, one possibility is that your AJAX (autocomplete.php) returns an array of [location_name, phone number], you tell the plugin that it should use the "location_name" value, and you provide a callback function when an entry is selected so you can take the phone number and set it in the textbox.
  19. requinix's post in Push notify to a browser on mobile phone was marked as the answer   
    You can do it on mobile the same way you can do it on the desktop: with AJAX polling or websockets.
    Polling is easier to implement but not instantaneous - which is probably fine for you.
  20. requinix's post in Re: july 2021 version update was marked as the answer   
    Fixed.
     
  21. requinix's post in I would like to grab the ID of an edited record and insert into another table. Is this possible? was marked as the answer   
    Are you talking about project_edit.html? Is that where the form with task_lead and task_title and such are?
    That page gets the ID from the URL, right? Put the ID into the form as a hidden input so that you get a copy of that along with all the other data you want.
  22. requinix's post in I would like to grab the ID of an edited record and insert into another table. Is this possible? was marked as the answer   
    Are you talking about project_edit.html? Is that where the form with task_lead and task_title and such are?
    That page gets the ID from the URL, right? Put the ID into the form as a hidden input so that you get a copy of that along with all the other data you want.
  23. requinix's post in I need help with my select on my search box was marked as the answer   
    You entered "j" and it's listing records with user containing "j". So I don't see what's wrong with that.
    Are you talking about getting all those duplicates? It's because you're joining the login and dados_user tables together without telling MySQL how to join them together.
    You need a query that looks like
    SELECT login.user, dados_user.nome_proprio FROM login JOIN dados_user ON login.??? = dados_user.??? WHERE login.user LIKE '%$procura%' AND login.eliminado = 0  
  24. requinix's post in Form mail help to a beginner was marked as the answer   
    You check if the value "is set". Being empty or being zero counts as "set".
    If you want to check that the value is >0 then try doing exactly that.
     
    It is very much possible. You're misunderstanding the recommendations to use loops and otherwise change how your form processing code works.
  25. requinix's post in Trigger change event was marked as the answer   
    1. Events do not cause recursion, and so shouldn't cause any stack size problems.
    2. I don't see any recursion in the code.
    What's all the code for this form?
×
×
  • 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.