Jump to content


  • Posts

  • Joined

  • Last visited

  • Days Won


Community Answers

  1. requinix's post in creating an array list to become $variables was marked as the answer   
    PSA: I will remove any further posts which tell OP how to do the task as-asked. As well-intentioned as the question and its direct answer is, using variable variables is not a good thing.
  2. requinix's post in How can I anchor to a <h1 id="title1"> tag of external url? was marked as the answer   
    I don't see any H2s with ids on the page. You can't link to one of them until they are given ids.
    Why do you not have a page dedicated to showing a single article? You should be linking to that, not to some anchor buried deep on a paginated page.
  3. requinix's post in PDO not working in my function (error: "Undefined variable '$pdo'.intelephense(1008)") was marked as the answer   
    Variables defined outside of functions are not available inside of functions.
    If you need $pdo then pass it as an argument like you're already doing for $id.
  4. requinix's post in Why drawing on canvas resizing/scaling with canvas size? was marked as the answer   
    The width and height of the canvas are different from the width and height of the canvas element. What you've done is resize the element, however it will remain at its default drawable dimensions of 300x150.
    If you want to resize the canvas itself then you need to update its .width and .height.
  5. requinix's post in Null Safe Operator was marked as the answer   
    Fix what? A null will be coerced to false.
  6. requinix's post in storing in SESSION vs dbTable was marked as the answer   
    No. The session is stored on the server so as long as the server isn't compromised then the session data won't be compromised.
    It's like my refrigerator. There's no lock on it so anyone could take and leave what they wanted at any time, so in that sense it's insecure, however the doors to my home are locked so people can't get inside.
  7. requinix's post in How to use namespace in PHP was marked as the answer   
    You'd use namespaces with your classes for the same reason that you'd use directories with your files: because giving each thing some long and complicated name just so that they all stay unique is a pain.
    Practically speaking, if you use underscores in your class names then you're already using namespaces.
  8. requinix's post in Removal was marked as the answer   
    By policy we don't delete accounts, except to comply with laws like GDPR.
    If you don't want to use your account then you can simply not use your account.
  9. requinix's post in Activity was marked as the answer   
    Didn't notice this thread earlier. If you didn't see the answer elsewhere, there were problems with Elasticsearch staying alive: kernel kept killing it due to memory problems. Then a reindex or two.
    Everything seems fine and stable now.
  10. requinix's post in Profile status was marked as the answer   
    I've tweaked some permissions. Do you see editing options in your list of status updates now?
  11. requinix's post in RecursiveIteratorIterator: exclude file was marked as the answer   
    Take a look at your output: the MD5 hash on the left and the value of $element on the right. If you want to skip the md5-container then that would be when $element is...?
    For a more useful solution, if what you care about is when the filename is "md5-container" and not what directory it's in then use a function like basename to get just the filename portion of $element.
    But perhaps a smarter solution would be to not put your md5-container inside the directory you're trying to inspect. Don't have to skip over something if it's not there in the first place.
  12. requinix's post in Warning: hex2bin(): Input string must be hexadecimal string in was marked as the answer   
    You should find another tutorial: the code they've convinced you to use is... well, it's silly. It pointlessly uses encryption for something that doesn't need to use encryption.
    If you want a remember me cookie then all you need is to store a long random token in your database and associate it with the user - preferably in one-to-many form so the user can have multiple tokens for multiple devices. Store it in the browser with the Secure and HttpOnly flags. Then, every time the token is used to log someone in, you generate a new token and replace the old one.
  13. requinix's post in Differences between "#.exa" and only ".exa" was marked as the answer   
    * means any element.
    div.font only applies to DIVs with a "font" class while .font applies to any type of element with a "font" class.
    # is for IDs.
    These are fairly basic CSS questions...
  14. requinix's post in Coordinate Grid Mapping (Battleship) was marked as the answer   
    I'm not really sure what the complexity is here, but I'm also not sure quite what it is you're trying to get.
    So you have an image with pixel dimensions WxH. You want to place circles on there, but I guess you don't want to place them on individual pixels but rather on grid "cells" to reduce the number of locations. So like a 100x100 image could be split into 10x5 cells (each is 10x20 pixels), reducing the number of locations from 100*100=10000 center points to 10*5=50 center points.
    Easy answer? Generate the set of cells you want to choose from, shuffle the set, then go through the first <?> of them and draw the circle appropriately.
    $cells = []; for ($x = 1; $x <= CELL_COUNT_X; $x++) { for ($y = 1; $y <= CELL_COUNT_Y; $y++) { $cells[] = [$x, $y]; } } shuffle($cells); for ($i = 0; $i < NUMBER_OF_CIRCLES; $i++) { list($x, $y) = $cells[$i]; // draw circle on the cell at ($x,$y) }  
  15. requinix's post in Help With Ordering An Array Vertically Into HTML Columns was marked as the answer   
    Then array_chunk won't be quite as helpful: it'll create 3 chunks of the same size and 1 of a remainder.
    I can't think of an easier way of doing this than creating your own chunks:
    <?php const COLUMNS = 4; $items = range(1, 98); $count = count($items); $base = floor($count / COLUMNS); // 24 $remainder = $count % COLUMNS; // 2 // so $base * COLUMNS + $remainder == $count $chunks = []; for ($start = 0; $start < $count; ) { // the base amount, plus one if there are any remainder to include $length = $base + ($remainder-- > 0 ? 1 : 0); $chunks[] = array_slice($items, $start, $length); $start += $length; } print_r($chunks); // [1-25, 26-50, 51-74, 75-98]  
  16. 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.
  17. 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.
  18. requinix's post in Removal was marked as the answer   
    Alright, then I'll do it in about 10 minutes.
  19. 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.
  20. 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; }  
  21. 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.
  22. 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?
  23. 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.
  24. 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.
  25. 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.
  • 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.