Jump to content

requinix

Administrators
  • Posts

    15,229
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. That kind of markup isn't allowed. It's not how s work: they take s, not any arbitrary HTML you want. What are you trying to accomplish with it? Match the appearance?
  2. For future reference, it really helps if you can explain what your problem is. Like "I included this Javascript but it's not changing the dropdowns". Follow the steps on that page: 1. Add the two 3. Copy that code they give you but change the selector (in $("select")) to match your markup. Since you have a "dropdown_box" class you can use that: $("select.dropdown_box") 4. Add the CSS. That should be all. You don't even need to change the HTML markup for your form.
  3. Did I hear somebody ask for an analysis? No? TOO BAD! Demo: <html><body> <form action="" method="post" class="wpcf7-form testing-forms" novalidate="novalidate" id="test_1"> <p> <span class="wpcf7-form-control-wrap selector"> <select name="selector" class="wpcf7-form-control wpcf7-select selector" id="testing" aria-invalid="false"> <option value="first option">first option</option> <option value="option 1">option 1</option> <option value="option 2">option 2</option> <option value="option 3">option 3</option> <option value="option 4">option 4</option> <option value="option 5">option 5</option> <option value="option 6">option 6</option> <option value="option 7">option 7</option> </select> </span> </p> <p> <span class="wpcf7-form-control-wrap secondselect"> <select name="secondselect" class="wpcf7-form-control wpcf7-select" id="test_more" aria-invalid="false"> <option value="Second Option 1">Second Option 1</option> <option value="Second Option 2">Second Option 2</option> <option value="Second Option 3" selected="selected">Second Option 3</option> <option value="Second Option 4">Second Option 4</option> </select> </span> </p> <p> <span class="wpcf7-form-control-wrap checkTester"> <span class="wpcf7-form-control wpcf7-checkbox" id="checkTesterOption"> <span class="wpcf7-list-item first"> <input type="checkbox" name="checkTester[]" value="Option 1" /> <span class="wpcf7-list-item-label">Option 1</span> </span> <span class="wpcf7-list-item"> <input type="checkbox" name="checkTester[]" value="Option 2" /> <span class="wpcf7-list-item-label">Option 2</span> </span> <span class="wpcf7-list-item last"> <input type="checkbox" name="checkTester[]" value="Option 3" /> <span class="wpcf7-list-item-label">Option 3</span> </span> </span> </span> <br /> <span class="wpcf7-form-control-wrap checkTester2"> <span class="wpcf7-form-control wpcf7-checkbox" id="checkTesterOption2"> <span class="wpcf7-list-item first last"> <input type="checkbox" name="checkTester2[]" value="Option 2-1" /> <span class="wpcf7-list-item-label">Option 2-1</span> </span> </span> </span> </p> <p> <span class="wpcf7-form-control-wrap text_testing"> <input type="text" name="text_testing" value="" size="40" class="wpcf7-form-control wpcf7-text" aria-invalid="false" /> </span> </p> <p> <input type="submit" value="submit" class="wpcf7-form-control wpcf7-submit" /> </p> </form> <pre> </pre> <script type="text/javascript"> function typeofex(value) { var t = typeof(value); return t == "object" && value["constructor"] && value["constructor"]["name"] ? t + "(" + value.constructor.name + ")" : t; } var pre = document.getElementsByTagName("pre")[0]; for (var i in document.forms) { for (var j in document.forms[i].elements) { pre.innerHTML = pre.innerHTML + "forms[" + i + "].elements[" + j + "] is a " + typeofex(document.forms[i].elements[j]) + "\n" + ".name = '" + document.forms[i].elements[j].name + "'\n" + ".type = '" + document.forms[i].elements[j].type + "'\n"; } } </script> </body></html>Output from Chrome 51.0.2704.103: forms[0].elements[0] is a object(HTMLSelectElement) .name = 'selector' .type = 'select-one' forms[0].elements[1] is a object(HTMLSelectElement) .name = 'secondselect' .type = 'select-one' forms[0].elements[2] is a object(HTMLInputElement) .name = 'checkTester[]' .type = 'checkbox' forms[0].elements[3] is a object(HTMLInputElement) .name = 'checkTester[]' .type = 'checkbox' forms[0].elements[4] is a object(HTMLInputElement) .name = 'checkTester[]' .type = 'checkbox' forms[0].elements[5] is a object(HTMLInputElement) .name = 'checkTester2[]' .type = 'checkbox' forms[0].elements[6] is a object(HTMLInputElement) .name = 'text_testing' .type = 'text' forms[0].elements[7] is a object(HTMLInputElement) .name = '' .type = 'submit' forms[0].elements[testing] is a object(HTMLSelectElement) .name = 'selector' .type = 'select-one' forms[0].elements[selector] is a object(HTMLSelectElement) .name = 'selector' .type = 'select-one' forms[0].elements[test_more] is a object(HTMLSelectElement) .name = 'secondselect' .type = 'select-one' forms[0].elements[secondselect] is a object(HTMLSelectElement) .name = 'secondselect' .type = 'select-one' forms[0].elements[checkTester[]] is a object(RadioNodeList) .name = 'undefined' .type = 'undefined' forms[0].elements[checkTester2[]] is a object(HTMLInputElement) .name = 'checkTester2[]' .type = 'checkbox' forms[0].elements[text_testing] is a object(HTMLInputElement) .name = 'text_testing' .type = 'text' forms[0].elements[namedItem] is a function .name = 'namedItem' .type = 'undefined' forms[0].elements[length] is a number .name = 'undefined' .type = 'undefined' forms[0].elements[item] is a function .name = 'item' .type = 'undefined' forms[test_1].elements[0] is a object(HTMLSelectElement) .name = 'selector' .type = 'select-one' forms[test_1].elements[1] is a object(HTMLSelectElement) .name = 'secondselect' .type = 'select-one' forms[test_1].elements[2] is a object(HTMLInputElement) .name = 'checkTester[]' .type = 'checkbox' forms[test_1].elements[3] is a object(HTMLInputElement) .name = 'checkTester[]' .type = 'checkbox' forms[test_1].elements[4] is a object(HTMLInputElement) .name = 'checkTester[]' .type = 'checkbox' forms[test_1].elements[5] is a object(HTMLInputElement) .name = 'checkTester2[]' .type = 'checkbox' forms[test_1].elements[6] is a object(HTMLInputElement) .name = 'text_testing' .type = 'text' forms[test_1].elements[7] is a object(HTMLInputElement) .name = '' .type = 'submit' forms[test_1].elements[testing] is a object(HTMLSelectElement) .name = 'selector' .type = 'select-one' forms[test_1].elements[selector] is a object(HTMLSelectElement) .name = 'selector' .type = 'select-one' forms[test_1].elements[test_more] is a object(HTMLSelectElement) .name = 'secondselect' .type = 'select-one' forms[test_1].elements[secondselect] is a object(HTMLSelectElement) .name = 'secondselect' .type = 'select-one' forms[test_1].elements[checkTester[]] is a object(RadioNodeList) .name = 'undefined' .type = 'undefined' forms[test_1].elements[checkTester2[]] is a object(HTMLInputElement) .name = 'checkTester2[]' .type = 'checkbox' forms[test_1].elements[text_testing] is a object(HTMLInputElement) .name = 'text_testing' .type = 'text' forms[test_1].elements[namedItem] is a function .name = 'namedItem' .type = 'undefined' forms[test_1].elements[length] is a number .name = 'undefined' .type = 'undefined' forms[test_1].elements[item] is a function .name = 'item' .type = 'undefined'Output with Edge on Windows 10 build 10586.494: forms[test_1].elements[selector] is a object(HTMLSelectElement) .name = 'selector' .type = 'select-one' forms[test_1].elements[secondselect] is a object(HTMLSelectElement) .name = 'secondselect' .type = 'select-one' forms[test_1].elements[checkTester[]] is a object(HTMLCollection) .name = 'undefined' .type = 'undefined' forms[test_1].elements[checkTester2[]] is a object(HTMLInputElement) .name = 'checkTester2[]' .type = 'checkbox' forms[test_1].elements[text_testing] is a object(HTMLInputElement) .name = 'text_testing' .type = 'text' forms[test_1].elements[ms__id261] is a object(HTMLInputElement) .name = '' .type = 'submit' forms[test_1].elements[length] is a number .name = 'undefined' .type = 'undefined' forms[test_1].elements[item] is a function .name = 'item' .type = 'undefined' forms[test_1].elements[namedItem] is a function .name = 'namedItem' .type = 'undefined' Chrome: - elements provides iteration over its Collection numerically and associatively: by index in the collection, by id if given, and by name if given. This seems to apply to all Collections. - Accessing duplicate elements in the Collection by name gives another Collection Edge: - elements provides iteration over its Collection associatively by name, using a placeholder value if none is given - Accessing duplicate elements in the Collection by name gives another Collection - Iteration over the Collection does not expose numeric keys, however numeric keys to elements are accepted So actually the behavior you're seeing in IE/Edge is also present in Chrome, but is hidden by the fact that you still get the information you need as its provided via the numeric keys. What doesn't help this is that the HTML/DOM standards don't seem to indicate precisely how iteration should work. At this point I would offer an alternative to your for..in but you haven't said what you're trying to do with this code. Truthfully, since it surfaces all members of an object, for..in actually provides an attack surface for use with XSS and is thus generally discouraged without the developer taking proper protections.
  4. Sounds like OP is using a script that polls a file('s modification time) and needs it to be polling against a database instead.
  5. Since the whole point of password_hash() is so that you don't have to think about what the defaults are, make sure you keep up to date with any changes made to the function. Case in point, PHP will likely switch the default to argon2 soon so a hardcoded bcrypt will be out of date.
  6. Note that the correct hash for that password+salt is $2y$10$YOVX2MCk8KSpUuii5fEQ5.fchxgv0ZkbWxTGnOcHwgqfvspDNsYlmso you do, in fact, have the wrong password.
  7. It's virtual running on hardware owned by our owners - so essentially dedicated. I don't have any information about bandwidth.
  8. Then that means you don't have the ODBC extension installed. Wherever you got PHP 5.5 probably also has a php-odbc package for it.
  9. $status[2] lolwat
  10. By learning what those \us mean and thereby understanding that they're supposed/allowed to be there? And by saving your file in UTF-8 format and getting rid of those calls to utf8_encode. And by dropping the JSON_ERROR_UTF8. If you look at the documentation you'll see it's not one of the allowed options. And really, it has "error" right there in the name: does that sound right?
  11. Ooh, good call. Basically function ifx_connect($database, $userid, $password) { return new PDO("???", $userid, $password); // the DSN is probably like ifx:mydb@ol_srv1 } function ifx_query($query, $link_identifier, $cursor_type, $blobidarray) { return $link_identifier->query($query); // don't know what to do with $cursor_type or $blobidarray }
  12. The informix extension was abandoned years ago. It probably doesn't work with any version of PHP after 5.2. It sucks but you'll need to rewrite the code to work with pdo_informix.
  13. First thing you have to do is get rid of those echo()s and print_r()s. They'll mess up the AJAX. Second, and more to the point, is success: function(data){ $('#hidshippingCost').val(shippingCost); $('#total').val(totalDisplay); $('#hidTotal').val(total); }The only variable you have to work with is data. There is no "shippingCost" or "totalDisplay" or "total". You have to get those values from with the data object. success: function(data){ $('#hidshippingCost').val(data.shippingCost); $('#total').val(data.totalDisplay); $('#hidTotal').val(data.total); }
  14. Actually I was thinking something more... precise. What does a SHOW CREATE TABLE whatever output, and what is the actual SQL for those queries? While I'm here, take each of those queries and execute them with an "EXPLAIN" in front. So EXPLAIN SELECT.... That'll output a table which explains how the query executes and can indicate where potential problems are with (though it's not easy to read if you're unfamiliar with it).
  15. A blob of data (like JSON) vs. relational data shouldn't be a question of performance. It's about use cases. 3M rows isn't actually that large. Well, relative to what other people and companies do with it. What's the structure of the table and what kinds of queries are you running on it that are taking so long?
  16. "Oh I see he's reading the topic. I know he'll reply to this so I'll just wait a bit... (refresh) No, he hasn't replied yet. I'll give him more time... (refresh) Still no... (refresh) Alright, it's been an hour, I have this reply ready so I'll just copy and paste it in here, and voila! there's my po-- DAMMIT" context? I posted a reply just after Barand saying the same thing so I hid mine
  17. I don't follow. You can't tell what someone is doing on another website...
  18. Both of those are already friendly. I would say the "before" one is actually better than the "after".
  19. Option 3: Treat the contents as Javascript code and not JSON. JSON is inherently valid Javascript so anything already existing is still good, and you just consider the string to be (shudder) eval-uatable code. var evaluated = eval("(function() { return " + value + "; })()");At what point does the color need to be (re)evaluated? Is the theme data known server-side too?
  20. We can definitely tell you better ways to do this, but to tell you why it doesn't work for your friend we would need to know what the error message is. He is trying to upload a valid image, right? JPEG/PNG no more than 20MB? 10 is a magic number for the line in the file containing the value of $data.= sizeof($_FILES['file']['name']).'-images'."\r\n";from the earlier code.
  21. a) If the table structure matches up with the CSV exactly - and the use of columnN names suggests it is - then you don't need to specify the columns at allb) If the table does not match up, and if PHP can access the CSV file, then it can determine the columns dynamically: open the file, read the header row, count how many columns there are c) If the table does not match up and PHP can't read the file, then you would have to put that configuration somewhere. Continuing with the INI example, column[0] = id column[1] = column1Throw in the fact that you can read the table structure at runtime and you can probably figure out everything you need to know without having to resort to that third option. But the point is that it could, so you'll need to account for that. You could set up a sort of "default email list" and then override that as needed. But those columnN names aren't so great. Can you change those? Make them mirror what's in the CSV, even if that means having to `-quote them?
  22. Exactly how much repetition is there? Are all the scripts the same except for the input file and destination table? Are the email messages the same, or how do they vary? The "best" case would be that everything but the file and table are the same. You could then get rid of all the script except for one (since they'll all work the same way) and find a way to provide the missing information: my choice would be an INI file like [arbitrary_label] source = DataImport/sourcefile.csv database = mydatabase table = mytable email[] = "Mail 1 <mail1@mydomain.co.za>" email[] = "Mail 2 <mail2@mydomain.co.za>" email[] = "Mail 3 <mail3@mydomain.co.za>"and you invoke the PHP script with the "arbitary_label" argument. @C:\PHP\php.exe C:\path\to\script.php %* Command: C:\path\to\batch-file.bat Arguments: arbitary_label Load the appropriate data into variables and pass them around as needed. The worst case is the scripts are all totally different. Which I doubt is what you're working with. So reality is probably somewhere between the two.
  23. Look just for a case-sensitive "$Fields". It has to be in there somewhere... but if it wasn't then that would explain why the value is null and instead you have to figure out what value should be getting used in there. But it feels like that code is all broken anyways and what you're doing is the correct solution. Yup. Generally an associative array is better to work with (you can reference fields by name) but sometimes the indexed or hybrid versions are more useful to have in code. If the code only needs the primary key then yeah, querying the indexes would be better. No and yes. There can only be one primary key but it could have multiple columns (be a composite key). So in general you would need to get all the rows and possibly reassembly the key using the [seq_in_index]. Which you need to do anyways because of other non-primary keys. ...then why are you doing it? It is quite wrong: in_array() checks if a value is in an array (both of those arguments are strings) and returns true or false accordingly (you're comparing the return value with the key name). All you need is a simple comparison: if ($Array['Key_name'] == 'PRIMARY') I'm not even sure what you're trying to do there, but I'm pretty sure the function is supposed to return an array of key names. Right now you're making an array of arrays containing '0's and '1's. If the key is part of the primary key then $primary[] = $Array['Column_name'];That's it. $primary[] = will add a new value to the array, and that value is the [Column_name]. Using that echo for debugging is fine but it would be more helpful if you outputted the column name at the same time. Like echo $Array['Column_name'], " is in the primary key\n";
  24. Either you shouldn't care about what day is what, or you need to find out (or decide) how the business itself answers the question. Like I said, it's probably about the start date: if I work Sunday 10pm to Monday 6am then I would say my "Sunday" shift was 8 hours long. Maybe I'm not understanding what is so confusing about this?
×
×
  • 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.