-
Content Count
1,227 -
Joined
-
Last visited
-
Days Won
30
maxxd last won the day on January 19
maxxd had the most liked content!
Community Reputation
101 ExcellentAbout maxxd

-
Rank
Prolific Member
Contact Methods
-
Website URL
https://maxxwv.com
Profile Information
-
Gender
Not Telling
-
Location
North Carolina
Recent Profile Visitors
15,445 profile views
-
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?
-
What error have you gotten from both lines?
-
Should you pass models directly to view - Laravel
maxxd replied to Drongo_III's topic in PHP Coding Help
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. -
You're going to have to deal with JavaScript for the fingerprint scanning - try Googling "javascript biometric authentication" .
-
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.
-
add button click when enter key on input text
maxxd replied to nitiphone2021's topic in Javascript Help
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". -
mpdf cann't load on real host at $mpdf = new \Mpdf\Mpdf();
maxxd replied to nitiphone2021's topic in PHP Coding Help
Add error reporting to the top of your script: error_reporting(-1); ini_set('display_errors', true); -
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
-
How to check when a form field is left blank
maxxd replied to SaranacLake's topic in PHP Coding Help
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. -
How to check when a form field is left blank
maxxd replied to SaranacLake's topic in PHP Coding Help
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. -
How to check when a form field is left blank
maxxd replied to SaranacLake's topic in PHP Coding Help
<?php if ($_SERVER['REQUEST_METHOD']=='POST' var_dump($_POST); exit(); This snippet doesn't "definitely work". -
How can I optimize my PHP code for better performance
maxxd replied to djohnstone's topic in PHP Coding Help
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. -
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.
-
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
-
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'.