Jump to content

sn00pers

New Members
  • Posts

    8
  • Joined

  • Last visited

sn00pers's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thanks for the explanation. I haven't used really used $x && $y types of evaluations before so now I need to start thinking about where I can incorporate that.
  2. I think I used that regex before I posted this thread, but was trying a preg_split with it so that might be why I wasn't able to get it to work. I often use preg_match and then an additional line to get a string from the output array. What you did here looked really interesting. How does the and part work here? I like that it's one line because it makes it clear that it's all part of the same operation.
  3. Sorry if I was confusing. I was looking to end up with two strings. The IP, and the Port. I just had to add a little tweak to remove the colon from the port number, but all is working.
  4. Thank you so much. I hadn't thought about doing it in two steps (one for first part, one for second part). Makes sense! EDIT: I had the browser window open over night and did not refresh it to see there were additional responses since requinix. So thank you everyone who responded.
  5. Hi! I am trying to figure out how I can split a string based on the last of several instances of a character that exists within a string and return just the two parts. For example: netstat displays IPv6 addresses with the port number attached via a colon. But the colon is also used for the hextets in the address. 2001:db8:a0b:12f0::1:25 While this IP/Port have many colons, I am trying to split by the very last one to get the results: 2001:db8:a0b:12f0::1 25 This doesn't seem like it should be difficult, but yet I am struggling to get it to work with various combinations of preg_split or strrchr. Can annyone offer any advice? I have a feeling the answer is going to make me go "duh, of course!"
  6. At some point the hash in the DB had to be created from a password and perhaps the method was slightly different? Why not print both hashes to confirm they don't match?
  7. Jacques1 What do you use to decide between sending the parameter into the statement via an array in the execute statement vs using bindParam() (Or bindValue() if you don't want a reference)? Is it creating the variable inside the code/script vs using input from a web form? Is one faster than the other, or one more secure from injection than the other? bindParam allows you to use PDO constants to specify Int,String, etc, but many times I have caught myself using the wrong one only to see no difference (example using PDO::PARAM_STR when I meant to use PDO::PARAM_INT due to copy/pasting). I think I also read that all parameters going through the execute array are strings, but not sure when that matters if true. If it's not too off topic, do you mind touching on that?
  8. I haven't gotten to really look thoroughly through the code. However at first glance I notice that on line 39, you have hard coded a single question mark to bind a value to. But at the same time you allow for a variable number of values to be bound. This makes me think that any time more than one value, you will get this error. The question mark represents value 1 (provided by $x). if you bind a second value ( #2), there is no '?' in the statement to bind that value to. Again, I may have missed somewhere in the code where this is taken care of, and haven't spent enough time to be completely confident that this is the issue, but thought it worth mentioning.
×
×
  • 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.