Jump to content

Leaderboard


Popular Content

Showing most liked content since 08/23/2017 in all areas

  1. 1 point
    That class doesn't seem all that useful, it doesn't provide any protection and really only gives a way to send an array of conditions for a select query. I would suggest using PDO instead, or looking into prepared statements with mysqli and using those. The first error message sounds like the database connection failed.
  2. 1 point
    You are not getting the value, but text content of option list? Every time the loop completes a cycle it overrides the previous html, you need to add to previous, then at the end add to label html var join = ""; $.each(tous, function(index, value) { join += value + "<br>"; //return (value !== ""); ///// why? }); $("#label").html(join); I think this is what you are asking for? As I said, you are using innerHTML not value, so you need to adjust this to your requirements. instead of var l = selectliste.options[selectliste.selectedIndex].innerHTML; you could use var l = $(this).val(); // for value or var l = $(this).text(); // for actual text description
  3. 1 point
    That's because you set it to false right before you alert it. Go back and look at the code I posted, notice how the variable definitions are outside the load handler. They first get defined with those default values, maybe at some point later down the page PHP will redefine them, and then once the page finishes loading the rest of the Javascript runs, using either the default values or the values that were set by PHP.
  4. 1 point
    I haven't tested how jQuery handles that, but I assume that it's only going to execute whatever code was just added to the page. The rest of the code on the page will be executed when the browser gets to that point. I'm referring to the 2 links you posted above. The direct link does not have that link to #60, the "proxy" link does even though they go to the same page. Why, because it's longer? There's nothing unmistakable about 60, as far as the computer is concerned. 60 is also unique and unmistakable. Both 60 and any hash will convert to binary values that are unique, the computer will not confuse them with each other. So they are both values in the same address space of all binary numbers, one of them is just an enormous number but that's the only real difference, they're just numbers. Why would one of them be said to be a quantitatively "better" number than another? Hashes are really only used for one thing - verification. Passwords are stored as hashes and then the hashes are computed to verify that the entered password matches the stored one, or a file might be distributed along with a checksum hash to verify the integrity of the file, that the file you actually saved is the one they distributed, there was no error in transmission. Hashes don't really offer anything as identifiers that you can't get with any other numeric value, and a hash is just a numeric value represented in a different base. One problem I see with using both a hash and an ID is that people cannot find the pages if they only know the ID. If I think you said something great in podcast 60 and I want to share it with someone else, I can't just check the URL and figure out where the ID goes in the URL, I also need to know some long hash that I can't calculate just by knowing that the podcast was number 60. So the only thing I can do is try to find a link to that page somewhere else, I can't just type it in manually. If that's your goal, if you're trying to add some sort of protection against people being able to figure out the URL for any podcast, if you're trying to control access in some way where they need the specific URL and not just the ID, then that would be the result of requiring the hash to be in the URL. Don't think of it like that, PHP and Javascript don't share any values or anything like that, the only relationship is that you're using PHP to output Javascript code. They don't run in the same address space, they don't even run on the same computer (PHP runs on the server, Javascript runs in the browser). As far as PHP is concerned, it's all just text being sent to the browser, PHP doesn't care whether it's Javascript text or HTML text or any other kind, it's just output. So all you have to do is output that Javascript code outside of the element that is being cloned or copied. I can't specifically tell you how to do that, I'm not looking at everything that you are. I assume you have templates or something with all of that stuff in it, so just make sure the Javascript code to copy the content is not part of the content that gets copied.
  5. 1 point
    Ha, If you change n to x in function, anything referring to n need to be changed to x as well.
  6. 1 point
    You're also trying to loop over n. What's n?
  7. 1 point
    It is. If you want to get details about a certain item, that's one page. If you want to view the catalog, that's one page. There aren't any redirects or anything else going on, each request results in a response for that request. If you want to have a page where people can click on the details for each item and see things pop up instantly without sending another request you can do that with Javascript, but the issue there is that you're loading everything for everybody even if they aren't going to use it, and it's going to take a while to create that page. It seems like it's more efficient to send a request for each thing the person wants.
  8. 1 point
    Using href="#" will have side effects compared to button in that it will reload the page, taking you to top of page with address bar url having '#' at end. You can prevent this using javascript: void() in href OR by passing 'event' as function called argument you can within that function use event with preventDefault() to stop the anchors normal action triggering. https://www.w3schools.com/jsref/event_preventdefault.asp https://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_oper_void Display Name is a username? doubt anyone but moderator would have permission to do that, IF allowed.
  9. 1 point
    Use a separate field in the table to specify the sort order, and when you insert the data make the sort order field whatever order you want to retrieve the data.
  10. 1 point
    Text-decoration: blink,, is unlikely to be supported in all browsers, as some find if it irritating rather than a useful pleasing feature. You can use css3 animation, to achieve the same effect, similar to using animation to scroll text, which deprecated marquee element used to do.
  11. 1 point
    IF you still want to use console.() to call function with argument, store each value in variable and return THAT final result to console.log function calculate(n) { var results = ""; for (i = 0; i <= n; i++) { var isprime = false; for (j = 2; j <= n; j++) { if (i % j === 0 && i !== j) { isprime = true; } } if (isprime === false) { results += i + "\n"; } } return results; } console.log(calculate(25));
  12. 1 point
    No, I can't, because there's not a single way for every laptop and every fingerprint reader to communicate with a web browser. Maybe some of them have drivers or features to do that, I don't know. Maybe browsers will start to add APIs to access fingerprint readers the same way they can with webcams, maybe that will happen over the next couple of years. There's no standard for that now that I'm aware of. There may be third-party resources you can use though, I haven't done any research on this company or looked carefully at what they offer but maybe they'll have something that works for you: https://www.voltapass.com/index2.html
  13. 1 point
    There isn't really any support for using a phone's fingerprint scanner through a browser. Most applications that use fingerprint authentication will connect to a fingerprint reader attached to the server or another network device.
  14. 1 point
    If you're specifically talking about sending a location header to redirect the user, I just don't understand the technical need for that. I don't see any problem which gets resolved by redirecting the user to another page, I don't understand why you think that's a solution to any problem you think you have. They're already on your site, PHP can do anything you want it to do, I don't understand why you've come to the conclusion that the thing you want PHP to do is to just redirect the user and start PHP over again. It's already running, just do what you need it to do the first time. It almost seems like you've learned a few things about PHP, you have a solution, and now you're searching for a problem for your solution. I just don't see the need to redirect, I don't see any problem that a redirection solves. The only time you need to redirect someone is if you want them on a different page for whatever reason, maybe because they've just submitted a form, you processed the form, and you don't want them to hit refresh and re-submit the form. Or they just logged in, and you're taking them to wherever they go after logging in. Those are the cases when you might redirect someone. You're describing your solution to redirect a user and I'm missing the problem you're trying to solve by doing that. Why? Why do you need to know that? If you're just interested in tracking traffic and things like that, I would suggest something like Google Analytics. Otherwise, why would any page care where the user came from, why is that relevant to what the page is supposed to produce? I'm not sure if we're experiencing a language or terminology barrier or what, but I'm having a hard time understanding why you think you have all of these requirements. A web page, or PHP page, or whatever, typically has a single purpose in terms of what it displays, and that purpose typically does not depend on where the user came from. A certain URL, in general, should always show the same content regardless of how the user got there. You wouldn't want people to share a certain URL and have it show different content for different people, that wouldn't make sense to them. You're talking about setting session variables when the user gets to the page, why? The session is for tracking who the user is, if they just got to your site you don't know anything about them, why do you think you have to use the session? It sounds like you're learning individual tools in PHP and then trying to apply everything to your site even though it's not necessary. Not every page or site needs to use every PHP function.
  15. 1 point
    All you have to do is set the divs inline style display to display: none; make sure it has the id reference, and you are there.
  16. 1 point
    Why should it hide? there is nothing there to cause it to hide.
  17. 1 point
    Like I said though, with a 1-to-1 relationship you usually put all of that in one table. It's not normal to have a primary key that is also a foreign key.
  18. 1 point
    The foreign key should be defined on the second table, not the first one. The second table has a foreign key to the parent table.
  19. 1 point
    The idea of a foreign key is that the database would not allow you to enter a non-existent order_number in your cust_time table. It would only accept order_numbers that already exist in the customer table.
  20. 1 point
    Put the margin on the image.
  21. 1 point
    It's common to use ajax to send a request for partial content and fill that in on the page. I don't know if jQuery's load method will automatically execute any Javascript sent with the HTML, but if not that's something else to consider. A common practice would be to return a JSON structure with an HTML part and a Javascript part, where you would add the HTML then execute the Javascript.
  22. 1 point
    Dots? lines, more like, this seems to be a separator used by this theme for class container, luckily it uses unique id identifier so we won't mess up this separator feature if used somewhere else. #clientes .container::before { width: 0; }
  23. 1 point
    .et_pb_row_1 { max-width: none; width: auto; }
  24. 1 point
    Use string to time function strtotime(), you can multitude textual expression to get the result you want, then loop through each day by increasing by 1 in a loop // set initial start date to next sunday from current date $date = date("Y-m-d", strtotime("next Sunday")); //set from $date value to 1 week ahead for end date $end_date = date("Y-m-d", strtotime("+1 week", strtotime($date))); //'2020-12-31'; while (strtotime($date) <= strtotime($end_date)) { echo $date . "<br>"; //increment to next day $date = date("Y-m-d", strtotime("+1 day", strtotime($date))); }
  25. 1 point
    Yes, you can use !empty() on its own.
  26. 1 point
    Because even though they are empty, if named input exists on submission it is still set with empty value. To check if set and not empty add !empty() if (isset($_GET['phonesrch']) && !empty($_GET['phonesrch']))
  27. 1 point
    In your function declaration you wrote J instead of I.
  28. 1 point
    The length is 3. The indexes go from 0 to 2. That is 3 elements, which is why the length is 3. 0, 1, 2 -> that's 3 elements.
  29. 1 point
    Try last suggestion I added in my post before this one, the previous will work if changed to post method but you would use $this_order = $_GET['order_num']; //would retrieve value of $order_num $this_test = $_POST['testing'] // would retrieve value of 'Edit' because you are using get the input value will overwrite the one set in action (unless you add a '&' at end to include both)
  30. 1 point
    When a get form is submitted it would produce an querystring also You are not adding querystring to form action, example echo '<td><form method="get" action="findorder.php?order_num='.$order_num.'"><input type="submit" name="testing" value="Edit" /></form></td>'; In findorder.php $this_order = $_GET['order_num']; //would retrieve value of $order_num same as $this_test = $_GET['testing'] // would retrieve value of 'Edit'. OR add to hidden input, like I said there are several ways to do this echo '<td><form method="get" action="findorder.php"><input type="hidden" name="order_num" value="'$order_num.'" ><input type="submit" name="testing" value="Edit" /></form></td>';
  31. 1 point
    Last time i checked GET is for query strings (using <a> tag, although can be applied to form via method get) which is what you mentioned in your post. But okay man.
  32. 1 point
    Actually No, there are several ways to do this, and I did not which had been chosen, but the how the querystring and value are used is the important part to get it to work.
  33. 1 point
    You haven't added a index reference name, just the value edituser.php?cust_id=n filename with querystring initialiser : index name : value ($order_mum) So when you need to read value of specific name index $this_order = $_GET['cust_id'];
  34. 1 point
    dsonesuk is referring to using <a> tag. Like: <a href="edituser.php?cust_id=n">Edit User</a>
  35. 1 point
    The second parameter indicates the size of the subsets to search for, not the size of the initial set. The expected output is wrong. The people who provided the exercise mentioned it here: http://www.w3resource.com/javascript-exercises/javascript-function-exercise-21.php#comment-3039932910 The output should only have subsets with two elements.
  36. 1 point
    Send it as GET querystring with customer number edituser.php?cust_id=n where 'n' will be the customer number.
  37. 1 point
    Yes! you can easily reformat the date format from database to whatever you want, with whatever separators you want on output using echo, see https://www.w3schools.com/php/showphp.asp?filename=demo_func_date_format https://www.w3schools.com/php/php_date.asp Its just a matter of swapping YY and DD on desired string format parameter
  38. 1 point
    If you want to list altogether, Either list in JavaScript array, xml file, or server database, then loop through them producing the options within <select>...</select> elements.
  39. 1 point
    Well, my answer is still the same thing. Make sure everything, not just the database connection, is using the same encoding. I've never used that many statements to set MySQL to UTF8, you can do it with "SET names utf8". There's also a mysqli function specifically for that: http://php.net/manual/en/mysqli.set-charset.php Other than the database, make sure that your page is telling the browser that it's UTF8, that it's part of the response headers, and that the text actually is UTF8.
  40. 1 point
    If sessions are set up to only use cookies, then the session ID is stored in the cookie, and either used as part of the filename (if the default session file handling is enabled) or otherwise saved so that the server can look up a session by ID. If the session has not expired and been deleted then the session ID should point to the session data. If cookies are turned off then the session ID can be passed around through page URLs, but that is terrible security. PHP should be configured so that sessions.use_cookies is on, and sessions.use_only_cookies is on. It's also good to have sessions.cookie_secure on if your site uses HTTPS, and sessions.cookie_httponly on. Session_write_close isn't really affected by whether or not cookies are being used. The only time that cookies have any effect on that kind of thing is if you're starting a session for the first time and also redirecting, sometimes I've seen the browser fail to set the session cookie but that was years ago, I assume that browsers have improved since then. Not true. Like the manual says: That's kind of a weird statement. I'm not sure what the point is. The browser is supposed to delete the session cookie when it closes, because it is a temporary cookie. The session expires after a period of inactivity matching the PHP settings. That's also phrased a little strangely, again I'm not sure what you're getting at. Normally you never need to use session_write_close. Like the manual says, the only thing it helps for is if you have multiple pages all loading inside different parts of a frameset, and in each one you would want to close the session as soon as that page is finished with it so that the other pages can open the session and run. It is not normal for the vast majority of scripts to use session_write_close. Also, the session_id function is not used to get session data, its only purpose, like the manual says, is to either get or set the current session ID. The browser doesn't know anything about sessions. The browser doesn't know what a "session" is, and it has no idea that PHP is a thing. The browser just sends cookies, cookies have been a part of the HTTP specification for a long time and PHP decided to use cookies to help support sessions in PHP. All the browser does is save and send cookies just like it does with any other cookie. If you want to know how cookies work in general, there should be a lot of documentation for that. When cookies are set they include the domain name and path, and some other settings, and if the browser requests a page which has matching cookies then it sends those cookies when it makes the request. Cookies are sent as part of the HTTP headers. The browser sends any cookie the server told it to set, as long as the cookies match the URL that the browser is requesting. Regardless of how session data is saved or destroyed, it's less secure because the alternative is to pass the session ID in the URL, and now anyone watching traffic can look at your URLs and hijack your session. Or if you copy and paste a URL to someone else, and don't know about something like a session ID, then that other person clicks the link and now they're logged in as you. There are any number of ways where passing the session ID in the plain-text URL might bite you in the butt. As long as your site is using HTTPS, then the headers sent by the browser and server are part of the encrypted data, so all anyone snooping on your traffic can see is the URL. They can't see any of the data payload, just which page you're requesting. Everything else is encrypted.
  41. 1 point
    Unless you actually echo out the username, password you won't see these.
  42. 1 point
    They can only read your code if they have FTP or shell access to the server. Otherwise, they see the same thing that you see when you open the PHP file in your browser.
  43. 1 point
    Hold on, are you running different versions of that code with only 1 of the console.log statements? If so, I think you're missing the point of having all of those console.log statements. Also, the console.log statement where it prints i should probably go inside that do loop, the point is so that you can use that to see what the calculations are doing. If you have a set with 3 items in it, how many possible subsets can you create? The answer is 8 - 23. If the set has 4 items in it, then there are 16 possible subets - 24. You use Math.pow to get that value from the length of the set. If you don't understand that then work it out on paper.
  44. 1 point
    My mistake, used for testing forgot to remove. change slideIndex = parseInt(z[j].getAttribute("data-currentslide")[0]); to slideIndex = parseInt(z[j].getAttribute("data-currentslide")); //lose the [0]
  45. 1 point
    You have been caught by the same error I made but I was tired, that statement flows on to next line, it end with that second line semi colon; post #4 and #5
  46. 1 point
    I don't know where there's a list. Generally you should never develop for specific devices, you should just make your layout flexible enough (with help of media queries) to wotk on any screen regardless of size. This is usually achieved by testing your page in the responsive mode of your browser and resizing the viewport until it breaks, then you add a media query to correct the layout. But for reference, I start off with a design for the following devices, then make extra adjustments later: Small mobile (iPhone 4):Up to 374px (I usually use this just for specific elements that didn't fit) Mobile or small mobile in landscape): Up to 767px Tablet portrait: 768px Tablet landscape: 1024px (breakpoint usually between 800px and 900px) Desktop: 1025px and above Some people make designs for large desktop computers (1440px and above), but that's up to you. In general, there isn't one specific strategy for responsive design, this is just the approach from the companies I work with.
  47. 1 point
    Where in Brazil?
  48. 1 point
    Hi! My name is Nara. I'm from Yerevan, Armenia. I started to study HTML, CSS for about a month, but I do not feel very good, because I'm 45 ((((. Do you think I have a chance?
  49. 1 point
    4. "Advanced" debugging techniques for any PHP code (In reality, these things aren't "advanced" as in "difficult to grasp", but they do require some extra setup, hence they're not really "basic" either) 4.1. Use an editor with "syntax highlighting" for PHPJust because PHP can be written with just Notepad doesn't mean that you have to use it. In fact, it's a bad idea to do so, unless of course you have no other choice. There are countless other editors, and if you just search "PHP editor", you'll get a large list of editors, all of which have a feature known as "syntax highlighting". What this means is that the editor will color different parts of your code differently, based on what PHP is expected to interpret that part as. It might sound like just a silly cosmetic, but that's in fact the quickest way of finding syntax/parse errors in your code. For example, if you know that your editor colors strings as one color and loops with another, yet see a loop with the color of a string, you already know that you have a string above the loop that you haven't closed. Vice versa? You probably forgot to close another string above the mis-colored string. No colors? Chances are you're not within a "<?php" block. Unconvinced? This forum has a syntax highlighting feature built in if you use the "code" BBCode tag. It tries to guess the language, and color accordingly. An explicit "<?php" is enough to make it turn on PHP. Next time you have a syntax/parse error, "Preview" your post, where the code is surrounded in a "code" BBCode tag, and see if you can spot your error. While we're on the subject of editors... 4.2. Prefer editors with "code completion" for PHP What "code completion" (sometimes called "auto complete", "Intellisense" or other kinds of marketing nonsense) means is the ability of an editor to suggest possible things you may be trying to type. In addition to saving you time in typing new code, this ability is also useful for debugging - if you can't see a variable/function/class/whatever in the list of suggestions, chances are that you've mistyped it and/or that the editor is smart enough to know that you can't use that thing at that point. There aren't many editors with "code completion" for PHP, due to the fact that PHP is loosely typed and interpreted, which means that more often than not, anything could potentially be everything everywhere (simply put, things become known when you run the file, not while you're typing it), which means that editors need to be a lot smarter, and allow themselves the potential of giving you wrong information (and we don't want that, do we?). If you keep your code organized and in small isolated compositions (functions, classes, methods, etc.), use type hinting everywhere it makes sense, and use "DocBlocks" to document all of your code, you probably won't encounter misleading editor hints. Some editors with "code completion" for PHP include Adobe Dreamwaver CS6 (earlier versions only support it for built-in PHP functions and nothing more, while this version also includes support for PHP classes and your own functions/classes), NetBeans (7.2 also supports traits), PhpStorm, Eclipse PDT and Aptana Studio. 4.3. Install XDebugXDebug is the de facto standard PHP debugger, and for several good reasons too. The more you get used to it, the more its absence on other people's machines will frustrate you . The most "basic" thing that XDebug is worth getting for is that it makes the output for var_dump() colorful (using HTML with CSS styles...), which may sound like just a cosmetic fluff, but if you're var_dump()-ing large arrays or objects, you'll find the output is significantly easier to read. Another, more important feature, is function stack traces. What this means is that if an error occurs, you can see the exact sequence of functions that was called to produce the error, starting with one in the file that execution started at. Combined with a var_dump() of the input data (starting with the last called function, and going back one by one to the first), you can quickly find the point at which your code started to behave weirdly (and thus resulting in the error further on). There are other "fancy" features in it too, such as code coverage, line-by-line debugging and profiling, but for best experience, you need additional tools (e.g. NetBeans , PhpStorm, Eclipse PDT and Aptana Studio support line-by-line debugging after you configure them for it; KCachegrind and Webgrind can view profiling information, etc.).
  50. 1 point
    If you posted here, you might find this intersting:http://w3schools.invisionzone.com/index.php?showtopic=456
×