Jump to content

requinix

Administrators
  • Posts

    15,229
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. Side comment: The path isn't actually C:\test\test.bat, right? You've made sure that you're escaping your backslashes in the path? Because strictly speaking your code is trying to execute C:estest.bat 2>&1. system() goes through cmd.exe. Does the user have execute permissions on that too? And you've verified that it has permissions on whatever test.bat is trying to run?
  2. That iwam_plesk user needs execute permissions for test.bat, and probably on anything it may try to execute too.
  3. I only found out about array_replace() and array_replace_recursive() not that long ago and realized that most of the times I wanted array_merge/merge_recursive() I wasn't actually trying to merge but to replace information (in an associative array).
  4. It's great that you've decided what the problem is, but can you post your HTML and CSS and Javascript and whatever so we can see it?
  5. array_replace_recursive works.
  6. That lsblk output is making a lot more sense now that I realized the commas are decimal points. If you're doing a new installation then the installer should help you set up the partitions at that time. Don't have to do it now. With that said, I don't think there's any particularly difficult process to do it with GParted. Add new partitions for the first three, and for the encrypted volume you choose something "crypt" for the file system type. (Then add an LVM partition to it, and add the root and /home partitions to that.)
  7. The only part to replace is if(session_is_registered("valid_user")) {with if(isset($_SESSION["valid_user"])) { Its use of session_is_registered() suggests that you'll have a lot more work to do in other places...
  8. It will do whatever it wants to do. Apparently eBay doesn't care about case-sensitivity, and I bet it doesn't care about the label at all - just the number at the end.
  9. Sounds adequate. Depends on your needs. I myself have never needed (or wanted) any special partitioning besides root and swap.
  10. Loop what? There's only one billname in each row...
  11. I'm not sure what you're describing but your code should look something like sendEmail($mail_to, $row['firstname'], $row['billname']); function sendEmail($mail_to, $firstname, $billname) { $message = "Dear " . $firstname.", <br><br>" ."You have the following bills due today.<br><br>" .$billname. "<br><br>" ."Please login to pay your bills";
  12. $row isn't automatically available inside sendEmail. You have to pass it as an argument, just like you did with $mail_to. Even better would be passing the individual pieces of data: the firstname and "billname" separately.
  13. Do you have a way to back up everything? Theoretically /home is all you "need" but you may find out (too late) that there were other files or configuration settings that you wanted to keep.
  14. First the explanation. '/(.*?)\((.*?)|(.*?)\||\|(.*?)\)$/'The has to be in a (?P) to have meaning, or else it's literal. And the |s have a special meaning - alternation, where A|B means "match either A or B" - which is how your expression actually matches anything in the first place. Also only use preg_match_all() unless you want multiple matches in the source string - multiple parameter/argument sets; use preg_match() for just one. (I don't know, you might need multiple matches.) A single regex can't get exactly the output you want. Use one to get the parameter and the "arguments" to it, then explode the argument list (on "|") for the individual arguments. Then you can combine everything into one array. '/(?P:\w+)\((.*?)\)/'(adjust the \w+ as you see fit)
  15. echo $res->rows[0]->elements[0]->distance->text;Each of those [0]s is something you could foreach over. However only one, for rows, needs it as the other is "always" just [0]. The data is organized such that each address in origin_addresses has a corresponding key in the rows array; the Hutchinson Park Drive address (0) corresponds to rows[0], and so on. This is the same order that you passed the addresses. Instead of foreach-ing over the rows you can do it over your $records array. Worry about sorting after. foreach ($records as $key => $value) { // find $res->rows[$key]Then you piece together $results. $results[] = array($value[0], $value[1], $res->rows[$key]->elements[0]->distance->text, $res->rows[$key]->elements[0]->duration->text);Now you can deal with sorting. array_multisort can do it but you have to give it an array of values to sort by. Put the distance's "value" into a separate array at the same time - not "text" as that's not a sortable value (well, it is, but not as easily as the raw value). $results = $distances = array(); foreach ($records as $key => $value) { $results[] = array($value[0], $value[1], $res->rows[$key]->elements[0]->distance->text, $res->rows[$key]->elements[0]->duration->text); $distances[] = $res->rows[$key]->elements[0]->distance->value; }Pass both those arrays to array_multisort(): first $distances with sorting options, then $results without options. Afterwards $distances will be sorted in order and $results will be arranged to match.
  16. Then that's getting into "configuration" territory. You need to expose to your end-user a place where they can specify the base URL, then you use that value where needed (eg, the with() and when constructing URLs).
  17. 1. It's bad form to modify values in the superglobals so try to avoid that. It looks like klein has a ->with() that would work for this. $klein->with("/issues/web", function() use($klein) { $klein->respond("GET", "/index.php", function($request, $response) { ... }; }For the "regular" case you may be able to do $klein->with("", function() use($klein) { ... });However can't you just base your site out of /var/www/issues/web instead? 2. Depends on the router.
  18. Too bad that feature of overwriting variables can't be turned off, huh? Oh wait. It can be. Regardless, still don't use it since $_POST['some_parameter'] is such a trivial alternative.
  19. Have you noticed that the forum adds syntax highlighting to code? Makes it easier to spot syntax errors like, say, getting quotes mixed up.
  20. RewriteRule (and mod_rewrite) cannot make substitutions*. If you don't want spaces then you need to make sure your code doesn't output URLs with spaces. As for accepting hyphens in place of spaces, (1) yes it does that but (2) it still accepts spaces so you'll want to remove that part. You also have a stray "x" in there doing nothing, and unless you want to literally accept a period and an asterisk then then ".*" shouldn't be there either. * Easily.
  21. Log them in after registering. Which entails putting stuff into the session. Which is how you recognize them.
  22. Are you using URL rewriting? What do you have in place?
  23. You didn't define $pdo anywhere. And before you say "yes I did, it's outside the function", variables outside a function are not available inside the function - pass $pdo as another function argument.
  24. Another thing: there's more to it than just the functions. Like INI settings have changed, and functions have different sets of arguments. You can't really do anything to protect yourself from that. Honestly, the best thing is to just stay on an old version of PHP until the code is ready to upgrade.
  25. Check the changelog. Removed functions where there are others to replace it? I don't know of any. Lately the removals have been for features that were removed, like import_request_variables() or session_register().
×
×
  • 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.