Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. The submit button will submit the form, along with the data of all the elements within it. You can also submit the form by having the a text field focused and pressing Enter.
  2. Define "message". Is this a string, an array of integers or something else? What do you mean when you say "append"? Do you mean to add a byte onto the end of the message or do you mean to manipulate the last byte of the message? Or by "append" do you mean to put the byte at the beginning of the message? What code do you have? Your code will probably explain your data structure more clearly. To start off, I hope you're familiar with PHP's bitwise operators.
  3. That would be a way to patch it up, but I prefer to solve problems right from their root. Bootstrap's carousel script is supposed to take care of the image sizes without the need of extra styling. The reason the image is returning to its original size unexpectedly is because he is overriding the carousel's "left" and "right" classes in his stylesheet.
  4. I think this is the source of your problem in your stylesheet: moncss.css .left{float: left;}.right{float: right;} The carousel dynamically adds classes "left" or "right" during the transition and your stylesheet is interfering. Change these class names to something else
  5. We can't know what the browser is doing just by seeing a video. We need to see a working page where we can analyze the DOM and check for Javascript errors.
  6. The blowfish algorithm is recommended by the PHP manual. SHA-512 is probably OK, just make sure you're adding a salt and that the salt is different for each password.
  7. The first parameter of the crypt() function is the string you want to encrypt. The second parameter is the salt. The syntax of the salt determines which encryption algorithm is used. $encryptedPassword = crypt($_POST['password'], '$2a$07$usesomesillystringforsalt$'); The salt syntax is explained in the manual. Here's an excerpt explaining the salt I used in the example:
  8. When you change the HTML, you need to change the jQuery selector so that it points to the elements you want to change. Honestly, I haven't had a clear idea of what you really want to happen. Attached is a menu that transforms from an ordinary horizontal menu into an accordion menu when the screen is resized. test.html
  9. This all seems like CSS problems. First, press F12 to open your development tools. Use the DOM inspector to see where the extra margin or padding are coming from, then you can know where in the stylesheet to fix it. If you want the menu to go over other elements instead of pushing them down set the position to absolute. The whole point of an accordion, though, is to separate menu items and put something in between. If you're changing the HTML structure of the menu you will need to update the jQuery selectors accordingly. You cannot put the same ID on more than one element. If you want to do that, use a class name instead of an ID. <div class="accordion"> And to select classes in jQuery: $(".accordion h3")
  10. Watch your jQuery selectors. You have two different things here: $("#accordian h3").off($("#menu span").on(
  11. The crypt() method uses a $salt parameter which is also used to determine which encryption algorithm the function will use. Read the documentation because it is important: http://php.net/crypt While you technically are allowed to omit the $salt parameter, doing so will make the password much less safe. If you have PHP 5.5 or above, the password_hash() function is available which is easier to use: http://php.net/manual/en/function.password-hash.php
  12. You don't use $mysqli->query() anymore because this is a prepared statement. Use $stmt->execute() The sha1() function returns a string. You can see that in the PHP manual: http://php.net/sha1 On that note, don't use SHA1 to encrypt passwords, it's easily broken by brute force. Use PHP's crypt() method for password encryption. Here's PHP's warning right in the manual:
  13. A menu is just a structure of list elements. Style it however you like, use media queries to make it look different on different screens. <nav id="menu"><ul> <li>Home</li> <li><span>Products</span> <ul> <li>Category 1</li> <li>Category 2</li> <li>Category 3</li> </ul> </li> <li><span>Services</span> <ul> <li>Category 1</li> <li>Category 2</li> <li>Category 3</li> </ul> </li></ul></nav> Here's the jQuery code from the second accordion example I linked to, modified to fit this structure. $("#menu span").click(function(){ //slide up all the link lists $("#menu ul ul").slideUp(); //slide down the link list below the span clicked - only if its closed if(!$(this).next().is(":visible")) { $(this).next().slideDown(); }}); What I'm going to do is change it to use the resize() and load() events to decide whether or not this functionality should be used. $(document).ready(chooseMenuType); // Choose menu when loading the page$(window).resize(chooseMenuType); // Choose menu when resizing the pagefunction chooseMenuType() { if($(window).width() > 600) { // Remove event listener $("#menu span").off("click", accordion); // Optionally show all lists. Remove this line if you want to $("#menu ul ul").show(); } else { // Add the event listener // Event listeners aren't duplicated, so there's no harm in doing this on every resize event $("#menu span").on("click", accordion); }}function accordion() { //slide up all the link lists $("#menu ul ul").slideUp(); //slide down the link list below the h3 clicked - only if its closed if(!$(this).next().is(":visible")) { $(this).next().slideDown(); }} Interestingly enough, you might not even have to remove the accordion menu events when resizing the page, meaning the resize() and load() events are unnecessary. If what you want on large screens is a horizontal menu with a dropdown, this accordion script will do exactly that if you change the CSS a little.Just use media queries. On large screens, set the top <li> elements to float left and position: relative, then set the inner <ul> elements to position: absolute. On small screens, set float: none and position: static. #menu > ul > li { position: relative; float: left;}#menu > ul > li > ul { position: absolute; top: 40px; left: 0;}@media screen and (max-width: 600px) { #menu > ul > li { position: static; float: none; } #menu > ul > li > ul { position: static; }}
  14. How are you storing the data into the database, and in what way are you verifying it? The same languages used to store data into a database are also capable of ensuring it's valid and retrieving it from the database to show it on a page. That would be PHP and SQL. You can also use PHP to generate RSS feeds from database information.
  15. It's not valid HTML to have a button as a child of the <a> element. You can style <a> elements to look like buttons with CSS.
  16. You're missing the http:// in the URL on this line of code: xmlhttp.open("GET","gamebattles.majorleaguegaming.com/xboxone/call-of-duty-ghosts/team/never-hide/stats.xml",false); That is a necessary but not sufficient condition for this to work. The other necessary condition is that their server sends a response with a header indicating that cross-domain AJAX requests are allowed. If they are not, then you can't use AJAX to load this data. Learn more about cross-domain requests here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS
  17. Everything is in the PHP manual. Here's the reference page for the bind_param() method: http://php.net/manual/en/mysqli-stmt.bind-param.php The execute() method: http://php.net/manual/en/mysqli-stmt.execute.php First you prepare the statement: http://php.net/manual/en/mysqli.prepare.php In the SQL you use "?" where variables would go. Example: SELECT id, username FROM users WHERE id=? AND password=? Then you bind variables to the placeholders using bind_param(). the first parameter is a string, each letter indicates the type of the variables that are used as the rest of the parameter as in this example: $stmt = $mysqli->prepare("INSERT INTO CountryLanguage VALUES (?, ?, ?, ?)");// $code, $language and $official are stringe, $percent is a floating point number (double)$stmt->bind_param('sssd', $code, $language, $official, $percent); Finally, you execute the query with execute() There are two ways to get results. One is calling the get_result() method, the other is binding variables to the output using bind_result() and calling fetch() Getting results using bind_result: // $name and $code would have the values of the first two fields of the SELECT statement// Possible query: SELECT countryName, countryCode FROM countries$stmt->bind_result($name, $code);while($stmt->fetch()) { echo $name . ', ' . $code . '<br>';} The PHP manual pages I linked to are full of examples.
  18. I don't see how there would be a problem. All an accordion menu does is show or hide parts of the menu using a sliding animation. Here's one implemented in jQuery UI: http://api.jqueryui.com/accordion/ Here's another implementation: http://thecodeplayer.com/walkthrough/vertical-accordion-menu-using-jquery-css3 Five more: http://cssmenumaker.com/blog/5-free-jquery-accordion-menus If one of them doesn't work for you, try another. There are hundreds of them out there.
  19. Did you look up how to implement an accordion menu?
  20. Ingolme

    logo position

    Because it's floated you can't move it relative to the line of text. Try having the image inside the same element as the text is. You can even remove the float: left part, it won't be necessary. <img id="logo" src="img/logo2.png" width="30px" alt="logo" /> <span class="light">Name</span> Last Name#logo { vertical-align: middle;} Vertical-align can take numeric values as well, if you want to be specific with the vertical positioning of the image relative to the text that's next to it.
  21. Comment out the headers for now and check the values of the variables $query, $result and $num using var_dump() to see if they contain what you think they do. Your script is vulnerable to SQL injection. If I use ' OR '1 as the username I can log in without a username or password. Use prepared statements instead of putting variables right in your query. I hope your index.php page is checking the login details before showing any content. There probably are PHP errors on your page, because it doesn't look like you've created the array $_SESSION['admin'] before putting values into it. There should be a line somewhere like this: $_SESSION['admin'] = array();
  22. You need the if() statement inside the function, because if you don't put it there it will happen only once and it won't change after resizing. During the resize event you can add or remove classes. The class should exist in your CSS stylesheet. function resized(e) { if(window).width() > 600) { $('ul.nav').removeClass("small-screens"); } else if(!$('ul.nav').hasClass("small-screens")) { $('ul.nav').addClass("small-screens"); }} Looking at it, I don't think you need Javascript at all. Just use media queries: ul.nav { /* Styles for large screens */}@media screen and (max-width: 600px) { ul.nav { /* styles for small screens */ }}
  23. Mail can only be sent by a server-side language and only if the server has a mailing server installed. The W3Schools tutorial you linked to uses mailto:, which will open a mail client on your own computer where you can write and send e-mails. It will not automatically send the e-mail. HTML is not capable of doing that. It's probable that WIX does not have a mailing server, but I wouldn't know because I have never used their services.
  24. If it works for you then there's no problem. There are two methods for the two different situations you will encounter.
  25. I decided to search for the documentation on Google. Here's something I found about highlighting lines: http://milianw.de/files/geshi-doc.html#specifying-lines-to-highlight-extra It seems to add the class "ln-extra" to the line, so you could choose to manually style that class in your stylesheet.
×
×
  • Create New...