-
Posts
15,229 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
access denied problems with external executable
requinix replied to abacus2015's topic in PHP Coding Help
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? -
access denied problems with external executable
requinix replied to abacus2015's topic in PHP Coding Help
That iwam_plesk user needs execute permissions for test.bat, and probably on anything it may try to execute too. -
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).
-
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?
-
array_replace_recursive works.
-
linux-file-structure: what needs to be saved while moving the installation
requinix replied to Maze's topic in Miscellaneous
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.) -
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...
-
linux-file-structure: what needs to be saved while moving the installation
requinix replied to Maze's topic in Miscellaneous
Sounds adequate. Depends on your needs. I myself have never needed (or wanted) any special partitioning besides root and swap. -
Placing Users First name in the e-mail message!
requinix replied to demeritrious's topic in Applications
Loop what? There's only one billname in each row... -
Placing Users First name in the e-mail message!
requinix replied to demeritrious's topic in Applications
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"; -
Placing Users First name in the e-mail message!
requinix replied to demeritrious's topic in Applications
$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. -
linux-file-structure: what needs to be saved while moving the installation
requinix replied to Maze's topic in Miscellaneous
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. -
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)
-
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.
-
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).
-
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.
-
security issues in the extract ( ) in php coding ?
requinix replied to hairulakli's topic in PHP Coding Help
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. -
Have you noticed that the forum adds syntax highlighting to code? Makes it easier to spot syntax errors like, say, getting quotes mixed up.
-
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.
- 6 replies
-
- htaccess
- mod_rewrite
-
(and 1 more)
Tagged with:
-
Log them in after registering. Which entails putting stuff into the session. Which is how you recognize them.
-
Are you using URL rewriting? What do you have in place?
-
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.
-
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.
-
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().