Jump to content

requinix

Administrators
  • Posts

    15,075
  • Joined

  • Last visited

  • Days Won

    414

Everything posted by requinix

  1. HTTP, right? It's how the web works: I send a request to you with what I want and you send a response back. Email? SMTP, more or less. Less transactional and more conversational than HTTP where I connect to your SMTP server and we exchange information, including the email content itself. DHCP and DNS? Packets fly around the network with tidbits of information, to and from the various computers and routers connected to it. All that happens over sockets. "BSD sockets" are basically the API to the operating system's TCP/IP/etc. implementation, and it's so common even Windows supports it. Right. "IP" isn't so much an IP address as it is an interface. For example, you can bind to the IP address corresponding to your wired Ethernet port, or to the IP address used by your wireless card, or to localhost. Or to all of them indiscriminately. You can't bind to someone else's IP address and magically receive their traffic. As PHP exposes a socket API to you, yes: you can connect to anything you want at any time and as long as your script is still running you can let anybody connect to you (except on ports SOAP is a protocol in its own right but it isn't the full story. It piggybacks on another protocol, like HTTP: regular web stuff except the request and response bodies are XML with a defined schema. I could write the XML down on a piece of paper and give it to you and that would still be SOAP, with the "another protocol" being reading and writing. Correct. They're just connections that enable you to send and receive data. The format and structure of that data is up to you and whatever you're communicating with.
  2. The browser doesn't know that "www.pchl.org" is supposed to be a domain name. It thinks you have a directory with that name. Use absolute paths but without the domain name. With a leading slash. Repeat that for, well, pretty much every single link and URL you have. Tip: don't upload stuff until it works. Get yourself a development environment so you can see all your stuff running beforehand and fix any problems before you let the world see them.
  3. Alright, let's backtrack some. Are you sure you have PHP installed properly? Naming your files with a .php extension? If you do a View Source of the page, do you see your PHP code?
  4. Find your php.ini and change a couple settings within: error_reporting = -1 display_errors = onThen restart Apache (or IIS or whatever) and try your script again. See any error messages?
  5. The code that does the email is near the top. You put the check near the bottom. It's not going to happen in time to do anything useful. The best thing you can do is restructure the code so that it's easier to work with. Do a series of checks for various types of errors and keep track of them as you go. If, after all the checks, there weren't any errors then you can send that email. It will also help cut down on how many levels of if blocks you nest together. if form was submitted { errors = array() if name or email is empty { add error message about filling in the required fields } if email is not empty and it does not match your regex { add error message about the invalid address } if they did not pass the captcha test { add error message about failing the captcha } if there were no errors { try to send the email. if successful { show the success message } else { show the failure message } } else { show the errors } }
  6. It will recognize them because they're using the same "single username"... Regarding session IDs and the cookie containing that ID, it's the same thing as with your site A: they're different sessions with different cookies. The two sessions simply happen to be referencing the same account - as if they had the same value for $_SESSION["user_id"].
  7. ...Are you talking about deliberately reusing the same session for the same logical user even if they're on separate devices? I thought you were asking about something else. Please don't do that. The session should not be a place where you store temporary data. I don't want my sessions to be the same everywhere I go.
  8. I believe you are. The session ID is stored in a cookie, right? Either the cookies are being shared in the two windows or they're not being shared; if shared then the windows will be using the same session (which is generally what happens), if not then there's no risk of accidentally "reusing" cookies from the other window.
  9. 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?
  10. That iwam_plesk user needs execute permissions for test.bat, and probably on anything it may try to execute too.
  11. 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).
  12. 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?
  13. 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.)
  14. 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...
  15. 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.
  16. Sounds adequate. Depends on your needs. I myself have never needed (or wanted) any special partitioning besides root and swap.
  17. 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";
  18. $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.
  19. 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.
  20. 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)
  21. 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.
  22. 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).
  23. 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.
×
×
  • 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.