Jump to content

requinix

Administrators
  • Posts

    15,066
  • Joined

  • Last visited

  • Days Won

    414

Everything posted by requinix

  1. Order does not actually matter. What did you have that wasn't working and what do you have now?
  2. \r and \n are easier than the \u syntax, but they'll be interpreted by Javascript and you'll get those characters inside the actual string. Escape the backslashes like "\\r\\n".
  3. $entry is only an . There is no and such in it. You have to go down into the to get those. foreach ($xml->entry as $entry){ $Fnum=$entry->content->{'filing-type'};
  4. There is a way to do it as you describe, so if you want that solution for academic reasons there's that. However it uses references (PHP does not have pointers but references are close) and I try to avoid references unless I know my audience (eg, coworkers) will be comfortable working with them. For normal code I would go with either a) The recursive version, as posted by Barand, or b) A loop-based version where you construct the array backwards, as in array() array('key3' => array()) array('key2' => array('key3' => array())) array('key1' => array('key2' => array('key3' => array())))
  5. "The file input"? rename (which does moves too) Figure out the path to the file in directory A, figure out the path you want it for in directory B, and pass both to rename().
  6. Okay, you got the "and a description of what's going wrong" part but you forgot about the "post the code you have". No, that's milliseconds. Probably to do with timezones.
  7. So if you go into a MySQL client program (like phpMyAdmin) and execute SELECT * FROM reactions WHERE topic_id = 1then you only get three rows? Dump out or log the value of $row2 somewhere. If it shows three rows then you're looking in the wrong place, and if it shows more than three rows then Doctrine is doing something spooky.
  8. Should be pretty straightforward: take the lines that deal with hours/minutes/seconds, create a duplicate fourth line for the hours, and make sure you get the math right. Example 1: <span class="hour">00</span> <span class="min">00</span> <span class="sec">00</span>becomes <span class="day">00</span> <span class="hour">00</span> <span class="min">00</span> <span class="sec">00</span>Example 2: var hoursContainer = $(container).find('.hour'); var minsContainer = $(container).find('.min'); var secsContainer = $(container).find('.sec');becomes var daysContainer = $(container).find('.day'); var hoursContainer = $(container).find('.hour'); var minsContainer = $(container).find('.min'); var secsContainer = $(container).find('.sec');Go ahead and give it a shot. If you have problem, post the code you have and a description of what's going wrong.
  9. Opinion? You should have upgraded YEARS ago. Because 5.2 stopped being supported YEARS ago. No updates since then. Not even security updates. Who knows how vulnerable the application is! It will take time and lots of testing but it needs to happen: upgrade to PHP 5.6. There are migration guides available to help with the process.
  10. You also need to be putting $new_recipient back into the array, not the original $recipient. Another thing. Keep in mind that strpos() can return 0 if the string starts with a @. And 0 == false. So you'd get something like "@foo@xyz.com". The alternative is "@foo" (looks like an email so don't change it), which isn't good either but it would probably be better to keep that. So use === false for an exact comparison.
  11. So you've got $new_recipients. explode() that into a new variable. It'll be an array, so you can foreach over it to get the various bits inside. foreach ($exploded_new_recipients as $key => $recipient) {Each $recipient bit will be an email address or name. If you exploded on just a comma (which I suggest) then there could be some spaces too that need to be trimmed off. Once you have the "plain" value, you need to tell if it's a name or email. The easy way to check is to see if there's an @ sign, given that the user should really only be entering names or email addresses. (You could really scrutinize them if you wanted to, though.) For email addresses you'd just leave them alone. For names you'll want to modify them to be email addresses instead: update $recipient with the new value (replace spaces and add "@xyz.com), then update the original array too with $exploded_new_recipients[$key] = $recipient;(Because updating $recipient won't also automatically update $exploded_new_recipients.) After all that, the array should be just email addresses. implode() it back together (using comma+space this time, for a more nicely formatted list) and you're back to a single string of everything.
  12. 1. explode() on commas and foreach 2. Trim extra whitespace 3. If the thing isn't an email then replace space->period and add "@xyz.com" 4. implode() back together into a string
  13. You're suffering from PHP's loose typing. ^ is not a logical operator but a bitwise operator. It acts on numbers. true^true is interpreted as 1^1. The answer is, of course, 0.However ! is a logical operator. !true is false, but PHP decided that the string representation (ie, what you get when you try to echo it) is empty. Try echo "1 and 1 = "; echo (1 && 1 ? "1" : "0"); echo "<br>1 or 1 = "; echo (1 || 1 ? "1" : "0"); echo "<br> 1 xor 1 = "; echo (1 ^ 1 ? "1" : "0"); echo "<br>Not 1 = "; echo (!1 ? "1" : "0");or function showvalue($expr) { echo $expr ? "1" : "0"; } echo "1 and 1 = "; showvalue(1 && 1); echo "<br>1 or 1 = "; showvalue(1 || 1); echo "<br> 1 xor 1 = "; showvalue(1 ^ 1); echo "<br>Not 1 = "; showvalue(!1);You should also (re)acquaint yourself with PHP's various operators. I suggest you stick with the bitwise operators only, meaning use & and | instead of && and ||.
  14. Yeah, there's more to it than just the nameservers. Say you have a question about your website. You go to Google and search for "where can I find my website?" Google does not tell you what the answer is, but rather it tells you where to find the answers. You still have to look at the search results. You try the first one, and you get the answer you need. Great. But maybe it doesn't have it. If not then you go to the second result. And third. Until you find your answer or run out of results and give up. Google is the domain registration. You asked it about your website and it told you where to look next. Google's search results are the list of nameservers. You try each one until you get the answer you need. All you did was tell Google what search results to show for the question. You still have to make sure that each search result has the right information.
  15. You updated the domain registration to use the new nameserver, great. But did you update the nameservers themselves with the information for the domain? Do the nameservers have that configuration? Because it's not magic: you have to actually tell them the DNS records for the "thepizzacompany.co.uk" and "www.thepizzacompany.co.uk" and so on. Or alternatively, did you do a zone transfer from the old nameservers to the new ones?
  16. If I run nslookup on Windows I get ------------ Server: www.newcastlesedationclinic.co.uk Address: 88.208.228.254 ------------ SendRequest(), len 39 HEADER: opcode = QUERY, id = 2, rcode = NOERROR header flags: query, want recursion questions = 1, answers = 0, authority records = 0, additional = 0 QUESTIONS: thepizzacompany.co.uk, type = ANY, class = IN ------------ ------------ Got answer (39 bytes): HEADER: opcode = QUERY, id = 2, rcode = REFUSED header flags: response, want recursion questions = 1, answers = 0, authority records = 0, additional = 0 QUESTIONS: thepizzacompany.co.uk, type = ANY, class = IN ------------ *** www.newcastlesedationclinic.co.uk can't find thepizzacompany.co.uk.: Query refusedCompare that to the output for that working site. ------------ Server: azzuriuk.com Address: 88.208.228.254 ------------ SendRequest(), len 36 HEADER: opcode = QUERY, id = 2, rcode = NOERROR header flags: query, want recursion questions = 1, answers = 0, authority records = 0, additional = 0 QUESTIONS: justgeordies.co.uk, type = ANY, class = IN ------------ ------------ Got answer (242 bytes): HEADER: opcode = QUERY, id = 2, rcode = NOERROR header flags: response, auth. answer, want recursion questions = 1, answers = 6, authority records = 0, additional = 3 QUESTIONS: justgeordies.co.uk, type = ANY, class = IN ANSWERS: -> justgeordies.co.uk type = MX, class = IN, dlen = 9 MX preference = 10, mail exchanger = mail.justgeordies.co.uk ttl = 86400 (1 day) -> justgeordies.co.uk type = TXT, class = IN, dlen = 19 text = "v=spf1 +a +mx -all" ttl = 86400 (1 day) -> justgeordies.co.uk type = SOA, class = IN, dlen = 46 ttl = 86400 (1 day) primary name server = ns1.prophettech.co.uk responsible mail addr = admin.prophettech.co.uk serial = 1418996338 refresh = 10800 (3 hours) retry = 3600 (1 hour) expire = 604800 (7 days) default TTL = 10800 (3 hours) -> justgeordies.co.uk type = NS, class = IN, dlen = 2 nameserver = ns1.prophettech.co.uk ttl = 86400 (1 day) -> justgeordies.co.uk type = NS, class = IN, dlen = 6 nameserver = ns2.prophettech.co.uk ttl = 86400 (1 day) -> justgeordies.co.uk type = A, class = IN, dlen = 4 internet address = 88.208.228.254 ttl = 86400 (1 day) ADDITIONAL RECORDS: -> mail.justgeordies.co.uk type = A, class = IN, dlen = 4 internet address = 88.208.228.254 ttl = 86400 (1 day) -> ns1.prophettech.co.uk type = A, class = IN, dlen = 4 internet address = 88.208.228.254 ttl = 86400 (1 day) -> ns2.prophettech.co.uk type = A, class = IN, dlen = 4 internet address = 88.208.230.230 ttl = 86400 (1 day) ------------ justgeordies.co.uk type = MX, class = IN, dlen = 9 MX preference = 10, mail exchanger = mail.justgeordies.co.uk ttl = 86400 (1 day) justgeordies.co.uk type = TXT, class = IN, dlen = 19 text = "v=spf1 +a +mx -all" ttl = 86400 (1 day) justgeordies.co.uk type = SOA, class = IN, dlen = 46 ttl = 86400 (1 day) primary name server = ns1.prophettech.co.uk responsible mail addr = admin.prophettech.co.uk serial = 1418996338 refresh = 10800 (3 hours) retry = 3600 (1 hour) expire = 604800 (7 days) default TTL = 10800 (3 hours) justgeordies.co.uk type = NS, class = IN, dlen = 2 nameserver = ns1.prophettech.co.uk ttl = 86400 (1 day) justgeordies.co.uk type = NS, class = IN, dlen = 6 nameserver = ns2.prophettech.co.uk ttl = 86400 (1 day) justgeordies.co.uk type = A, class = IN, dlen = 4 internet address = 88.208.228.254 ttl = 86400 (1 day) mail.justgeordies.co.uk type = A, class = IN, dlen = 4 internet address = 88.208.228.254 ttl = 86400 (1 day) ns1.prophettech.co.uk type = A, class = IN, dlen = 4 internet address = 88.208.228.254 ttl = 86400 (1 day) ns2.prophettech.co.uk type = A, class = IN, dlen = 4 internet address = 88.208.230.230 ttl = 86400 (1 day)So, are you sure the nameservers are configured to serve that domain?
  17. ns[12].prophettech.co.uk? They're refusing DNS queries...
  18. x+y is "#inputList2". A string. [x+y] is ["#inputList2"]. An array. I don't know where you're getting those []s from but get rid of them.
  19. Just use a normal, plain, simple function. Like in your first example. OOP is about object entities, not about using classes for everything. The reason it doesn't work is because the "Log" that you are use-ing in Main.php does not apply to functions.php too. It's a per-file thing. So //functions.php use Company\Project\Handlers\Log; function __log_notice(string $text) { Log::notice(0, $text, true); }or //functions.php function __log_notice(string $text) { Company\Project\Handlers\Log::notice(0, $text, true); }
  20. Are you the owner of the account? Do you know what I did with the account? I made a quick post to let other mods/admins know the OP's request had been addressed. It's not like I can contact the person or they can reply to threads... Not being able to delete one's own account is normal. I know of, like, two websites which let you do that. Or at least claim that you're doing that - I would be surprised how many of them actually remove account data from their systems. Because record-keeping is actually very important. Re: flippant. Yeah, I see that. I tend to react to rude comments and snideness similarly. I've also not been in a good mood lately because of, you know, this whole shitstorm. Re: you don't remember signing up. It's only been 2.5 years and you have more than a dozen posts across three threads spanning half a month. But whatever. Do you want your account suspended too? If you were using your real name or a personal email address then I would have offered to sanitize it along the way (no offense if that is, in fact, your first name, which would be kinda cool).
  21. 30 days of elapsed time or 30 days on the calendar? There is a difference. Are you using times with the dates too? And most importantly, what code do you have written so far and what kind of problems are you having with it? That is no excuse. I'm a fan of those functions too, but there are some things DateTime can do better. Depends how you store the date. The only two good options are as a DATE/TIME/DATETIME or as a Unix timestamp (which would use an INT or larger). For the former you just create a string in the "YYYY-MM-DD HH:MM:SS" format (eg, Y-m-d H:i:s), for the latter you keep the integer values that functions like time() and mktime() and strtotime() return.
  22. Really? You can't remember to type mywebsite.com so you're looking for a technological solution? How about a bookmark? Takes seconds to make one and you, who has a problem typing things, can instead click things instead. The hosts file is what you're thinking of, but it alone won't be enough. All it does is tell your browser which server a website lives at. It doesn't do redirects. Odds are you will have to configure the server that hosts mywebsite.com to be able to handle "my.ebay.com", and then have it issue the redirect. Because there is no way to have a client-side redirect before you've even gone anywhere - unless you make an add-on or extension for your browser.
  23. For all the files, you'll need another loop: use glob to get the list of files you want, foreach over it as $source, and then put that code you have to load a file into it. Dealing with un-namespaced XML elements (like ) is easy: do what you're doing now. Dealing with namespaced elements (like ) takes a bit more work. To do something like ->video:title, which you can't do for a couple different reasons, you need to use ::children. const XMLNS_VIDEO = "http://www.google.com/schemas/sitemap-video/1.0"; // <urlset xmlns:video="..."> echo $url->children(XMLNS_VIDEO)->video->title;Explanation? When you do ->video, SimpleXML will try to find a and won't find it. When you use children() first, SimpleXML will look for the namespace using that URI (an xmlns:video), figure out what XML namespace prefix to use ("video:"), and then begin looking for elements in that namespace. $url->video->title // <title> inside <video> inside $url $url->video->children(XMLNS_VIDEO)->title // <video:title> inside <video> inside $url $url->children(XMLNS_VIDEO)->video->title // <video:title> inside <video:video> inside $url
  24. Have you tried SimpleXML yet? Written any code so far?
  25. First, use an array for the decoded JSON. Having to use that {""} syntax is unfortunate and awkward. $zooelements = json_decode($elements, true); $name = $zooelements["0ad767cantbebotheredtocopypaste"][0]["value"];Second, are you actually using a @ when you call mysql_query? That will hide any errors that may happen. Hiding errors is very bad. Don't use @. Is your question about how to update $zooelements? Surely the answer is just $zooelements["0adblahblahblah"][0]["value"] = "NameEFGH";
×
×
  • 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.