Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. Using setcookie() will not delete the cookie data from the current PHP execution, but it will sent data to the client telling the browser to mark the cookie as expired. Also remember that calling setcookie() to delete a cookie will only work if all the parameters (except value and expires) are exactly the same as the ones used when the cookie was set.
  2. That code is really old and outdated, $HTTP_GET_VARS was replaced with $_GET years ago. 1) That line looks for a particular string in the contents of the file. The string starts with "::" and is followed by whatever is in the "nick" GET variable. The problem is that if it happens to be the first thing in the file, the code will think it doesn't exist, since strpos() returns both zero and false values. 2) It's using the first 20 characters of the GET variable called "nick". Because $HTTP_GET_VARS takes data from the URL, some of the characters will be encoded in the form "%XX" where XX represents the hexadecimal ASCII code for the character. $_GET doesn't have this problem, so if you used $_GET you wouldn't need urldecode(). This line has nothing to do with the "::" from before. It looks to me like "::" is used as a separator in whichever file data is being loaded from. This is really old code and doesn't look very good. 3) $i is just a number which is used to keep count of how many lines have been read from the file. That code is wrong, the $i += 1 should actually be before the closing brace "}". while (!feof ($hfile)){ continues the loop as long as the end of a file has not been reached. $line[$i] = fgets ($hfile, 1024); will load a line from the file, but only the first 1024 characters of that line. $cntrl = strstr($line[$i], "::".$sessionuser['user']."::".$HTTP_GET_VARS["nick"]."::".$HTTP_GET_VARS["id"]); This line of code gets the part of the data from $line[$i] that matches the format given by the GET variables and everything that follows it. strlen() is used to count how long the string is that was just retrieved. if (substr(($line[$i]), strlen($line[$i])-8, strlen($line[$i])-1-$len)=="::member") This line, which is way too convoluted for its own good, just checks that the last 8 characters of the line spell out "::member". I don't think there's a way I can simplify this for you, since you already need to be familiar with file reading and string manipulation to understand it. This code is really badly written could probably be done with half the lines of code in a cleaner and simpler way. What the code does is read a file which has data about users, the data is stored a format similar to this: user1::field1::field2::field3::field4 user2::field1::field2::field3::field4 It reads line by line until it finds a line that matches the current data that is being searched for in the HTTP_GET_VARS variable. When it finds the line, it checks whether "::admin" exists and redirects you based on it. It also checks whether "::member" exists and redirects to somewhere else. I can't repeat enough that this is terrible code, though, and I don't think it's a good idea to store user information in a plain text file.
  3. If you're using an FTP client, check the settings to make sure it's uploading in binary rather than ASCII. The only other thing I can think of is that it's related to your code. Can you show some of your code?
  4. Is this on a server? This might be because you uploaded the file to the wrong location. To be sure it's not a caching problem, try visiting the page in a different browser.
  5. It doesn't sound like you understand HTML forms. Both <input type="text"> and <input type="hidden"> send data to the server when the form is submitted. They behave exactly the same, the only difference is that one allows the user to choose its value. The form has two methods: <form method="GET"> and <form method="POST">. Both methods are explained on this page of the tutorial: http://www.w3schools.com/html/html_forms.asp
  6. If you're referring to the W3C validator, that has no relation to W3Schools, that's actually the validator created by the people who invented HTML, the World Wide Web Consortium, or W3C for short. The validator's word is the final word on what is correct HTML, if it says there's an error then there really is an error. The validator is free and so is your right to use HTML because the W3C keeps all web standards free and open to everybody. If you're having trouble getting your code to validate we can help point out what you need to fix.
  7. A single slash refers to the root of the entire system, which on Windows would usually be C:\. What you need to do for each file is to go up one folder using ../ and then choose the folder the other file is in. If two files are in the same folder, just using the name of the other file will link to it. To link to listform.html from home.html: <a href="../adrbook/listform.html>Link</a> To link to aboutme.html from home.html: <a href="aboutme.html>Link</a>
  8. You should not be using tables to arrange content on your page. You should learn CSS. But the structure you're looking for would be this: <table> <thead> <tr> <th colspan="5">Header</th> </tr> </thead> <tbody> <tr> <td rowspan="2">1</td> <td rowspan="2">2</td> <td rowspan="2">3</td> <td colspan="2">4</td> </tr> <tr> <td>5</td> <td>6</td> </tr> <tr> <td>7</td> <td>8</td> <td>9</td> <td colspan="2">10</td> </tr> </tbody> </table>
  9. This is probably too much for somebody who is only beginning in Javascript. You would first need to use setInterval() for animation. You would choose a time interval, like every 100 milliseconds, to run a function that changes the opacity of the element. To set the opacity in Javascript you would use the style property of the element. To choose a random value to set to opacity to, just use Math.random(). This example is very basic, the effect might not look right, but it's the simplest solution. Here's some example code: var element = [access image element here]; // Run a function perioadically var timer = setInterval(updateOpacity, 100); // This is the function that runs on each interval function updateOpacity() { var newOpacity = Math.random(); element.style.opacity = newOpacity; }
  10. I think you need to describe in more detail what you want the effect to look like. Is it just a picture or are other elements on the page meant to be affected?
  11. Are you sure it's a Javascript program you're working with? The URL and all other GET requests have a limit to how much data they can send. If you have a form with a lot of data, make sure to set the <form> element's method attribute to "POST".
  12. There are ways to vertically center elements, but the right solution depends on the case. In the case of your header, if you set the line-height to 200px the text will be centered, however, if the text wraps it will be outside of the box. If you need wrapping text, wrap it inside an inline-block and set the line-height of that block to "normal" <header class="main"> <h1>Vertically Centered <br> Wrapping Text </h1> </header> .main { width: 800px; height: 200px; line-height: 200px; text-align: center; } .main h1 { display: inline-block; vertical-align: center; line-height: normal; }
  13. I'm not sure why W3Schools is telling people about creating new elements in the tutorial, but it's not a good idea. The only good reason people created "new" elements in that fashion was to trick browsers that didn't support HTML 5 into accepting HTML 5 semantic elements. Elements like <section> and <article> weren't properly supported by browsers a few years ago, but by adding them to the page and using CSS to style them people could use them. Internet Explorer 8 and under didn't support adding custom elements to the page except if you used Javascript to call document.createElement(), so that hack was in place to make Internet Explorer 8 use HTML 5 elements.
  14. The body is usually only as large as the content within it, but you can fix that by setting the height of the html and body elements. THe -moz- prefix will only work in Firefox, use -webkit- and the plain CSS property to make sure it works in the widest range of browsers. I believe the first parameter needs to be "to top", "to bottom", "to left", "to right" or a numeric value. html,body { margin: 0; padding: 0; } html { height: 100%; } body { min-height: 100%; background-image: -webkit-linear-gradient(to top, #000029 50%, #000080 100%); background-image: -moz-linear-gradient(to top, #000029 50%, #000080 100%); background-image: linear-gradient(to top, #000029 50%, #000080 100%) }
  15. Ingolme

    Lay Out Property

    That does not seem to be real CSS. The only reliable information I can find about it comes from Microsoft. https://msdn.microsoft.com/en-us/library/ms530770%28v=vs.85%29.aspx?f=255&MSPPError=-2147217396
  16. You cannot create custom HTML elements. If you want to give style to a particular element you can give it a class or id attribute. The <li> elements won't have any height, vertical padding or vertical margins because inline elements do not have any of those. You need to display them as a block to do that. I don't see a particular reason why the header wouldn't have margin, but 15px is not too big, maybe you didn't notice it, or maybe the contentBody element is messing with it, since it's not standard.
  17. In order to move it, the position has to be set to "absolute", "relative" or "fixed" Also, you must specify units in CSS except when the value is 0, since 0 is the same for all units. This rule won't work: top: 80; because you forgot to specify "px" as the unit.
  18. The width of the logo is still 100%, that means as wide as the screen. The max-width will cut it down to 36rem, but it won't ever get smaller than that because the rules tell it to be as wide as it can. If you want it to shrink you will need to give it a percentage width.
  19. The answer to both of your questions is complicated Javascript. However, there may be jQuery plug-ins that people have already developed that do those things.
  20. The server reads BBCode and converts it to HTML.
  21. There wasn't an XHTML 4, it was XHTML 1.0. XHTML 5 is what they refer to as HTML 5 serialized as XML.
  22. Ingolme

    tool tip

    You can't put a block level element, such a <p> inside an inline element like <i>. If you want the <p> and <a> tag to be italic, use CSS to style them. You probably shouldn't be putting <h3> inside the <a> element either, it should be the other way around. Even if the validator doesn't complain about it.
  23. If you want it on its own line, then you need to display it as a block.
  24. The first thing you need to understand is that Java and Javascript have nothing to do with each other. You can write Java code in notepad, but it's not a good idea. You should download an IDE to manage Java projects, such as NetBeans or Eclipse. (Look them up) You'll also need the Java Development Kit in order to compile it.
×
×
  • Create New...