Jump to content

Leaderboard


Popular Content

Showing most liked content since 06/26/2013 in all areas

  1. 2 points
    Included files must have <?php ?> blocks around the code.
  2. 2 points
    There's nothing formal to tell you things like that. People do it themselves, and it tends to illustrate the Dunning-Kruger effect. People who just recently started tend to rate themselves highly, and only when you get more into something do you realize how much you don't know. I wouldn't put any weight on things like that. If you want to evaluate someone's capabilities look for a portfolio or things they've actually finished.
  3. 2 points
    You had wrongly referenced a JavaScript function, and wrongly named a css selector so very important position: relative was not applied. <!DOCTYPE html> <html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <style> * {box-sizing:border-box} body {font-family: Verdana,sans-serif;margin:0} .mySlides {display:none; width: 100%;} /* Slideshow container */ .slideshow { /*NOT slideshow-container*/ max-width: 1000px; position: relative; margin: auto; } /* Next & previous buttons */ .prev, .next { cursor: pointer; position: absolute; top: 50%; width: auto; padding: 16px; margin-top: -22px; color: white; font-weight: bold; font-size: 18px; transition: 0.6s ease; border-radius: 0 3px 3px 0; } /* Position the "next button" to the right */ .next { right: 0; border-radius: 3px 0 0 3px; } /* On hover, add a black background color with a little bit see-through */ .prev:hover, .next:hover { background-color: rgba(0,0,0,0.8); } /* Caption text */ .text { color: #f2f2f2; font-size: 15px; padding: 8px 12px; position: absolute; bottom: 8px; width: 100%; text-align: center; } /* Number text (1/3 etc) */ .numbertext { color: #f2f2f2; font-size: 12px; padding: 8px 12px; position: absolute; top: 0; } /* The dots/bullets/indicators */ .dot { cursor:pointer; height: 13px; width: 13px; margin: 0 2px; background-color: #bbb; border-radius: 50%; display: inline-block; transition: background-color 0.6s ease; } .active, .dot:hover { background-color: #f44336; } /* Fading animation */ .fade { -webkit-animation-name: fade; -webkit-animation-duration: 1.5s; animation-name: fade; animation-duration: 1.5s; } @-webkit-keyframes fade { from {opacity: .4} to {opacity: 1} } @keyframes fade { from {opacity: .4} to {opacity: 1} } /* On smaller screens, decrease text size */ @media only screen and (max-width: 300px) { .prev, .next,.text {font-size: 11px} } </style> </head> <body> <div id="wrapper"> <div class="slideshow w3-container w3-half"> <div class="w3-content w3-display-container"> <img class="mySlides fade" src="https://www.w3schools.com/howto/img_nature_wide.jpg"> <img class="mySlides fade" src="https://www.w3schools.com/howto/img_fjords_wide.jpg"> <a class="prev" onclick="plusDivs(-1, 0)">&#10094;</a> <a class="next" onclick="plusDivs(1, 0)">&#10095;</a> <!-- Extra plusDivs parameter refers to first (0) slideshow (start from 0) --> </div> <br> <div style="text-align:center"> <span class="dot" onclick="currentDiv(1, 0)"></span> <span class="dot" onclick="currentDiv(2, 0)"></span> </div> </div> <hr> <div class="slideshow w3-container w3-half"> <div class="w3-content w3-display-container"> <img class="mySlides fade" src="https://www.w3schools.com/howto/img_nature_wide.jpg"> <img class="mySlides fade" src="https://www.w3schools.com/howto/img_fjords_wide.jpg"> <a class="prev" onclick="plusDivs(-1, 1)">&#10094;</a> <a class="next" onclick="plusDivs(1, 1)">&#10095;</a> <!-- Extra plusDivs parameter refers to second (1) slideshow (start from 0) --> </div> <br> <div style="text-align:center"> <span class="dot" onclick="currentDiv(1, 1)"></span> <span class="dot" onclick="currentDiv(2, 1)"></span> </div> </div> <script> var slideIndex = 1; var z = document.getElementsByClassName("slideshow"); for (i = 0; i < z.length; i++) { //set custom data attribute to first current image index z[i].setAttribute("data-currentslide", 1); showDivs(z[i].getAttribute("data-currentslide"), i); } function plusDivs(n, j) { //get custom data attribute value of current image index to slideshow class index j slideIndex = parseInt(z[j].getAttribute("data-currentslide")[0]); showDivs(slideIndex += n, j); } function currentDiv(n, j) { showDivs(slideIndex = n, j); /* showDivs Not showSlides*/ } function showDivs(n, j) { var i; var z = document.getElementsByClassName("slideshow")[j]; var x = z.getElementsByClassName("mySlides"); var dots = z.getElementsByClassName("dot"); if (n > x.length) { slideIndex = 1 } if (n < 1) { slideIndex = x.length; } //set custom data attribute to current image index z.setAttribute("data-currentslide", slideIndex); for (i = 0; i < x.length; i++) { x[i].style.display = "none"; } for (i = 0; i < dots.length; i++) { dots[i].className = dots[i].className.replace(" active", ""); } x[slideIndex - 1].style.display = "block"; dots[slideIndex - 1].className += " active"; } </script> </div> </body> </html>
  4. 2 points
    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.
  5. 2 points
    Like astralaaron said using closest class and the index class in jquery you can get the index of the tr, have a look at the fiddle. https://jsfiddle.net/8hL46ftj/ hope this helps $('img').click(function(){ alert($(this).closest('tr').index()) })
  6. 1 point
    URLs take this form, things in brackets are optional: scheme:[//[user[:password]@]host[:port]][/path][?query][#fragment]
  7. 1 point
    Try this $.ajax({ url: 'newsletter_filler.php', data: {name: 'personal', length: 200}, dataType: 'JSON', statusCode: { 404: function() { alert("Page not found"); }}, success: function(jsonData) { console.log(jsonData); $.getScript('wordcount.js').done(function() { setWordConstraint(jsonData.personal['id'], jsonData.personal['length']); }); } }); The done() make sure script has completed, I don't know why used each function, as it will only loop through one set of json associated index row data? unless you plan to expand on this where multiple row of data will be read.
  8. 1 point
    Because all the menu anchor links are floated left, any non float: left; element placed at beginning will be forced right by these elements. So make it float: left; also.
  9. 1 point
    https://www.w3schools.com/code/tryit.asp?filename=FO133WMN1LUP The position: fixed; nav element (container element) with property top:0; forces IT, menu items, and if you add image like I have done within IT, to be fixed to top of browser window.
  10. 1 point
    That's the basic way people handle stuff like that, there's a reason databases have become so popular as a data store since the 60s and 70s. People don't want to mess with files for that kind of thing, especially in a system with a lot of accesses or simultaneous connections. You don't necessarily need a single table with a set number of columns for all podcasts though. That's the easiest and most simple way to set it up, and works for the vast majority of use cases, but it's not required to set up the database like that.
  11. 1 point
    You save yourself the trouble of making an HTTP request from your server to your own server. It's like walking out the front door of your house and getting into the back door in order to go from the living room to the kitchen. In technical terms it's slow and marginally less secure. Your program should be broken into several modules, each being able to interact with each other within the same environment. You could break your program into a generate_template($vars) function and a verify_email($address, $code) function among others that do different tasks, then you would do the following: $verified = verify_email($_POST['email'], $_POST['verification_code']); if($verified) { $vars = [ 'title' => 'Something', 'name' => 'Something' ]; $to = $_POST['email']; $subject = 'Email subject'; $body = generate_template($vars); send_an_email($to, $subject, $body); } This is, of course, very simplified, but the verify_email(), generate_template(), send_an_email() functions can be used anywhere on your site, just put them in a file and include the file where needed. I usually make more complex programs and use objects with properties and methods rather than just functions. These objects can be used on many different pages, each page just has to include the objects that it needs.
  12. 1 point
    Sanitization depends entirely on how the data is being used. If it's being used inan SQL query it has to be made safe for SQL syntax, if it's being printed on an HTML page it has to be made safe for HTML syntax, if it's being put into a Javascript string you need to escape the string delimiters. The data itself, during processing, is not inherently dangerous in any way; it only becomes dangerous when it can be interpreted as code to be executed. You can't sanitize it when it comes in because you don't know where it's going to be used so you don't know how it needs to be sanitized, there's no single sanitization solution that works for all cases.
  13. 1 point
    Here's a simplified example <img src="data:image/png;base64,<?php echo base64_encode(file_get_contents("../../image.jpg")) ?>" alt=""> It's base64 encoded, the original path won't be viewable, just the encoding of image.
  14. 1 point
    Elements hidden by CSS are still in the DOM and can still be accessed by Javascript. If there are values in the AJAX response that shouldn't be on the page, then don't put it on the page. You can store the result of an AJAX request in a variable instead of printing it.
  15. 1 point
    It just sets a variable to another value. That value comes from $_GET, which holds all of the values that were included in the URL.
  16. 1 point
    Yes, you need the same number and type of columns returned. You don't need to use the same table aliases necessarily, but it makes sense to use the same column names. That's not a correct assumption, if you remove the table aliases but keep them in the list of columns you'll get an error indicating that it doesn't know what p or c is. In that specific example, I don't think so, I think those aliases only apply to the select query where they are used. I could be wrong about that though, you might be able to use one in the other select query, but I don't think that would work. Yes. It won't, it's just being explicit about what you're asking for. If you wanted each ID from the two tables separately, for example, you should give each one a unique alias instead of returning 2 columns with the same name. If you change the data type of a column and there is existing data, MySQL will attempt to convert the data to the new data type. There are various rules for converting data between types. This is also called casting. You can also explicitly convert data during a SQL query, there are functions to do that. Those are the same functions that MySQL would use if you change the data type of a column.
  17. 1 point
    Place the JavaScript code between <head>..</head> OR <body>...</body> not outside of these.
  18. 1 point
    It probably makes sense to use ajax to submit the data to the server, that way you don't have to refresh the page. There's plenty of information about ajax online. When you build that page in PHP and write out the button to call the function to run the ajax request, you can pass the board ID to that function. If you don't want to use ajax then you can have your PHP form processing code on the same page, all of the PHP code like that should go on the top of the page before you display anything.
  19. 1 point
    if you looked at html through developer tools (i used firefox) you will see <div class'hidden_info'="">...</div>, clearly something is wrong! and it won't apply styling cause it does not exist, looking at code that produces this, it shows </div><div class'hidden_info'> which shows the '=' sign is missing, the browser will try its best to determine what you want, but its not perfect.
  20. 1 point
    1) Anything using below class will use pointing finger cursor .style1 { font-family: Verdana; font-size: 10pt; text-align:justify; cursor:pointer; } 2) You said Which means you would have to apply this styling class name to container element, which would either be a Paragraph, or Anchor, or Strong element that surround the text ' Click to Read More'. BUT! you have applied class name to This is outside the scope of what you are trying to target, its scope starts from opening span <span class="style1"> and finishes at </span>, all the text "W3Schools is a popular web site for learning web technologies online.[2] Content includes tutorials and references relating to..." will have the pointer cursor, but anything outside this will work as default styling, which is what is happening to anchor text you are attempting to target, because its outside '<span class="style1">....</span>' scope.
  21. 1 point
    What does that mean? How are you opening it? Are you just double-clicking on a file on your computer or something? If so, the PHP code won't run at all. Or, if it's actually on a web server, then there's always a request. The server responds to requests, that's its job.
  22. 1 point
    It doesn't have a plain reading. You use that question mark because it is a query string. From https://www.freeformatter.com/url-parser-query-string-splitter.html What's the 'query string' in a URL? The query contains extra information that is usually in the key-pair format. Each pair is usually separated by an ampersand & character. It follows the ? character. Examples: http://www.foo.bar/image.jpg?height=150&width=100 https://www.secured.com:443/resource.html?id=6e8bc430-9c3a-11d9-9669-0800200c9a66#some-heade
  23. 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.
  24. 1 point
    The call stack exceeded error is because you've created an infinite loop, and Javascript quits when the maximum recursion limit has been reached. It's because you have some Javascript code to get the #podcast_insert HTML, and replace the contents of #main with that HTML. The HTML includes the Javascript code to do that replacement, so each time you replace the code it tries to replace it again and again until Javascript hits the recursion limit. The Javascript code to do that should not be inside that div, it shouldn't be part of the content that you're moving. The title tag issue is probably in a template somewhere. If you open the page in your browser and view the page source you can see that tag before the doctype.
  25. 1 point
    You're also trying to loop over n. What's n?
  26. 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.
  27. 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.
  28. 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
  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
    I don't know how the recent forum update gets parsing so wrong, but this is what I had for that last part, I didn't have any nested quotes. I'm not sure what you mean. There's only 1 kind of cookie as far as browsers and servers are concerned. The session cookie in PHP is just another cookie, like any other cookie, with all of the same options available to it as any other cookie. You can configure the settings for it just like you can configure the settings for any other cookie you want to set. I don't know, it's probably left up to the browser vendors on how to handle that, I doubt that behavior is defined so specifically by any specification. It wouldn't matter if the session_start function is used, because again the browser doesn't know anything about PHP. What would probably matter is if the browser has anything open to a URL that matches the settings for those cookies. But I don't know if they will immediately delete temporary cookies just when the tabs to those URLs have been closed, or if they wait until the entire application is closed. I assume it's the latter, because vendors probably think that someone might have mistakenly closed a page, and they would expect that if they open the page again then their session is still active. Browser vendors probably think that would make more sense to a user. Yeah, one of the steps in the process is to get the session ID, but that doesn't mean that the session_id function is the only step in the process. The role of the session_id function is only to get or set the current session ID, not get any session data. Other functions do that. Moreover, the programmer does not need to call session_id manually if all they're trying to do is get the session data, all they have to do, again, is call session_start.
  31. 1 point
    Maybe you didn't do the port fowarding thingy correctly, or maybe your ISP is just blocking incoming traffic on port 80.
  32. 1 point
    Instead of printing your own error message, print the actual error message from MySQL. http://php.net/manual/en/mysqli.error.php
  33. 1 point
    The RSS item has a <link> field specifically for the URL of the resource you're sharing. An RSS reader may not necessarily parse HTML, so you should make use of the proper RSS fields. You can't send POST variables from RSS, but a link can contain a query string from which PHP can create $_GET variables.
  34. 1 point
    That looks like a customized checkbox, not your ordinary plain checkbox. Its probably a created element with an awesome font character, so it depends on how this replacement is identified, styled and placed, not how the actual checkbox is identified, styled and placed.
  35. 1 point
    Yes, if you are only communicating via the internet, and not using a browser, but each language is different. You would not use the same code or probably even the same language in Windows as you would in Linux.
  36. 1 point
    It's the same basic theory. You need a way to detect if there is a connection, and a place to store the data until there's a connection. If it's running in a browser then you can use localstorage to store the data until you detect a connection.
  37. 1 point
    Open your browser's developer tools and go to the Network tab, refresh the page and look for any failed requests to see what's missing.
  38. 1 point
    Place both if conditions for setting modal and login to display none, in a single window.onclick function
  39. 1 point
    OK. The advantage of using AJAX is to prevent having to reload the page each time the form is submitted, and the advantage of using PHP is to insure that the submitted data is sanitized and validated. Are implying with this that it is not possible to use Javascript for the purpose of sanitization and validation? If I have understood correctly, AJAX serves only as an intermediary between the form page and the PHP page. In other words, the PHP page should be written, as if the AJAX did not exist, and the AJAX should always refer to the PHP page via the following piece of code $.ajax({ url: 'ajax_comment.php', What is more, the PHP code should only be included in the page, if the following condition is satisfied. !isset( $_SERVER['HTTP_X_REQUESTED_WITH'] ) Thus, it was wrong for Loois to have included the following code at the bottom of his form page include ("jquery.js"); Under the assumption that all of the above is correct, why is the following code not entered at the top of the form page? include ("jquery.js"); My very best, Roddy
  40. 1 point
    So, why use AJAX at all? Since AJAX depends on Javascript being turned on or off, and since this decision is made by the user-client, why not use PHP whose functioning is determined solely by the host-server?
  41. 1 point
    Unless specifically programmed otherwise, the server will serve the same content to everybody. If you have a PHP file that can manipulate files or the database then it's open for everybody to use and is an easy attack vector on your website, if you want to prevent other people from using it you will have to add some form of authentication. In summary, nothing is stopping me from sending a POST request to your web host.
  42. 1 point
    Block elements such as div, h1, p fill the width available to them, any element below them will stack below them, if floated or not. A floated element before a block element/s, will cause the block element to merge within it, and even though the block element still take the full width, the text within them will flow to and around the edges of floated element. #1 If you place img element within the first paragraph, which you can because is a inline element and acts similar to text, It will fall below header h1, the first paragraph text will merge to edge of img element as will the second paragraphs text. For adding a div element to .content class div for extra column, you need to float and set its width to requirements.#2 and #3 <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta name="viewport" id="viewport" content="target-densitydpi=high-dpi,initial-scale=1.0,user-scalable=no" /> <title>Document Title</title> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script> <script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/jquery-ui.min.js"></script> <script type="text/javascript"> </script> <style type="text/css"> * { box-sizing: border-box; } .header, .footer { background-color: grey; color: white; padding: 15px; } .column { float: left; padding: 15px; } .clearfix::after { content: ""; clear: both; display: table; } .menu { width: 25%; } .content { width: 75%; } .menu ul { list-style-type: none; margin: 0; padding: 0; } .menu li { padding: 8px; margin-bottom: 8px; background-color: #33b5e5; color: #ffffff; } .menu li:hover { background-color: #0099cc; } .column.content {float: right;} .column.content > img {float: left; max-width: 25%; margin: 0 8px;} .column.content > div {max-width: 25%;} .column.content > div img {max-width: 100%;} .column.content > div.left {float: left; margin: 0 8px; } .column.content > div.right {float: right; } </style> </head> <body> <div class="clearfix"> <div class="column menu"> <ul> <li>The Flight</li> <li>The City</li> <li>The Island</li> <li>The Food</li> </ul> </div> <div class="column content"><img src="https://www.w3schools.com/w3css/img_lights.jpg" alt=""> <h1>The City #1</h1> <p>Chania is the capital of the Chania region on the island of Crete. The city can be divided in two parts, the old town and the modern city.</p> <p>You will learn more about web layout and responsive web pages in a later chapter.</p> </div> <div class="column content"> <div class="left"><img src="https://www.w3schools.com/w3css/img_lights.jpg" alt=""></div> <h1>The City #2</h1> <p>Chania is the capital of the Chania region on the island of Crete. The city can be divided in two parts, the old town and the modern city.</p> <p>You will learn more about web layout and responsive web pages in a later chapter.</p> </div> <div class="column content"> <div class="right"><img src="https://www.w3schools.com/w3css/img_lights.jpg" alt=""></div> <h1>The City #3</h1> <p>Chania is the capital of the Chania region on the island of Crete. The city can be divided in two parts, the old town and the modern city.</p> <p>You will learn more about web layout and responsive web pages in a later chapter.</p> </div> </div> <div class="footer"> <p>Footer Text</p> </div> </body> </html>
  43. 1 point
    Also, you're never going to see a request in the network console because you're not sending the file over the network, everything is being done in the browser. You're reading the local file and updating the page, not sending it to a server. That's why there's no request to a server.
  44. 1 point
    Use different id for second and just use same code to add content OR use classname instead and use var parentClass=document.getElementsByClassName("timeleftpay"); for(var i=0;i<parentClass.length;i++){ parentClass[i].innerHTML = dy + dytext + hr + hrtext + min + mintext + sec + sectext + eventtext; } Use <span class="timeleftpay"> </span>
  45. 1 point
  46. 1 point
    Here's how you created nested elements: /* Create a container */ var container = document.createElement("div"); /* Create children */ var image = document.createElement("img"); //... Set attributes var paragraph = document.createElement("p"); // ... Set attributes and content /* Add children to the container */ container.appendChild(image); container.appendChild(paragraph); /* Add the container to the body */ document.body.appendChild(container);
  47. 1 point
    <?php session_start(); //start the session for the page include("../include/db.php"); //include database file include("../include/settings.php"); //include configuration file //Check if page was entered by a submit button $email=$_POST['email']; //Get username !!FROM FORM!! $email = ereg_replace(" ", "", $email); //take away all spaces from username (if any) !!FROM FORM!! $password=base64_encode($_POST['password']); //Get name !!FROMFORM!! if (empty($email) || empty($password)) { echo "Empty fields";} else{ //check to see if the username or email allready excists $ck=$flash->prepare("SELECT * FROM `user` WHERE `email`=:email AND `password`=:password "); //get rows where the username or email address is allready registered $ck->bindParam(':email',$email); $ck->bindParam(':password',$password); $ck->execute(); //if email address allready excists if($ck->rowCount() > 0){ echo "user loged in successfully"; } else{ echo "Login or password inccorect";} } ?> use that phpand keep the alert(result); it should be clear now
  48. 1 point
    That would be fine if you were coding for a website, but HTML emails need to be simple. if you want it random, you'll have to create several different images with the pictures in different orders.
  49. 1 point
    Use "==" for comparison. A single "=" is the assignment operator, which changes the value of the variable you're operating with. You can use a switch() statement as well to make your code more readable.
  50. 1 point
    var SelOrderArray=[]; $.each($selected,function(i){ //loop through selected possible multiple selected options if(SelOrderArray.indexOf($selected[i]) === -1){ //if current looped through $selected value not in array then add to array SelOrderArray.push($selected[i]); } }); // loop through ordered array of slected options $.each(SelOrderArray,function(i){ //clone element with specific id to temp storage variable var TmpDivClone = $("#"+SelOrderArray[i]).clone(); //remove current existing element with specific id $("#"+SelOrderArray[i]).remove(); // prepend temp cloned element to div #result wrapping mydiv1 elements so prepending remains below dropdown and show TmpDivClone.prependTo('#result').show(); }); Not tested, written on tablet
×