Jump to content


  • Content Count

  • Joined

  • Last visited

  • Days Won


maxxd last won the day on January 19

maxxd had the most liked content!

Community Reputation

101 Excellent

About maxxd

  • Rank
    Prolific Member

Contact Methods

  • Website URL

Profile Information

  • Gender
    Not Telling
  • Location
    North Carolina

Recent Profile Visitors

15,445 profile views
  1. create_callback is the function that's been deprecated - neither preg_replace nor preg_replace_callback have. The second bit of code looks OK from a cursory glance. What's the actual error message you're seeing from it?
  2. What error have you gotten from both lines?
  3. Personally I like to refine and/or finesse the data as necessary in the controller before it reaches the view. This sets up basically very dumb views where any business logic is taken care of before the view is rendered. However, part of the system I'm currently working on does pretty much what you describe and passes raw data directly to the view where it decides what to display and how and it works just fine. As requinix points out, some degree of coupling is pretty much unavoidable so I guess it depends on what's easiest for you reason about.
  4. You're going to have to deal with JavaScript for the fingerprint scanning - try Googling "javascript biometric authentication" .
  5. The first code block doesn't work because of variable scope in PHP. The $fcont inside the class is not the same $fcont as the one outside the class. There are several ways to fix the issue, and given where you appear to be in learning PHP your solution in the second code block is fine albeit not ideal. Another solution is to build the string in the class method and return it to the calling code, which then prints the result. The best and most advanced option is to use a templating language like Twig or Blade, though that's probably going to be a topic for the future.
  6. You shouldn't have multiple elements with the same ID. In your case, your input is being duplicated and the id is "chat_message_{to_user_id}", so when there are multiple instances of the input element they're all assigned the same id - in this case, "chant_message_13".
  7. Add error reporting to the top of your script: error_reporting(-1); ini_set('display_errors', true);
  8. I pretty much agree with kicken, but feel the need to throw in my own two cents. First off, tip #3 is something everyone who codes should live by. To add to it, don't string together a million conditionals - I'm currently dealing with a code base that has a 180-line if-elseif-else tree and it makes me wanna barf. For what is supposed to be a conditional logic operation, this is shockingly devoid of both condition and logic. Personally, I think any sort of hard and fast numerical limit on function/method/class width or length is kinda manufactured. Use judgment and good formatting. Fo
  9. Make an array of the required form fields in php, then loop through that array on submission. If any of the fields are empty, add a message to an errors array. In the end of the actual, full form processing script if the errors array isn't empty, loop through the errors array and print out each individual error.
  10. The snippet you posted is missing a closing parenthesis. Assuming that somehow didn't throw an error, the lack of curly braces means that the var_dump() is only run if the request method is $_POST, but the exit() is always run.
  11. <?php if ($_SERVER['REQUEST_METHOD']=='POST' var_dump($_POST); exit(); This snippet doesn't "definitely work".
  12. AFAIR, if you were timing out you'd be seeing a 504 Bad Gateway error, so it's a problem with the form handling code. If you've turned on error reporting and verified it through phpinfo(), you should be seeing the problem in the browser. Make sure you've enabled 'display_startup_errors' in the same php.ini - your script may be crashing before it even gets to your code.
  13. The way WordPress (and most of the internet, nowadays) works is that it uses a pattern called a front controller. Every request is routed through the 'index.php' file, so https://mydomain.uk is a page, and everything after the question mark is a URL variable. For instance, 's' is specifically what WordPress looks for to know it's being asked to search for something. Click the links in my earlier post and you'll have your answer - use is_logged_in in the template file and the template_redirect action hook. If you don't know how to do that, start here.
  14. While I agree with requinix in theory, it also kinda depends on the business logic. Laravel allows for multiple database connections, and with cloud services like AWS you can redirect to specific servers based on subdomain (as well as path and a variety of other criteria). So, it's possible that companya.project.com can be hosted on a completely separate server than companyb.project.com. If you're expecting each company's data set to get very large it may be best to separate the databases based on those subdomains and either use separate connections in Laravel config or use CI/CD variables to
  15. The answer to both of your questions is is_user_logged_in(). For the first situation, check it in your template before outputting the div or class, and in the second situation check the value using the template_rediect action. Oh, and "uk/?s=fred&post_type=product" is a page (post, in WP's case) - it's '/uk/' with URL parameters 's' and 'product'.
  • 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.