Still don't think I'm grasping HTML well....

Discussion in 'General Off-Topic Chat' started by Harsky, Sep 9, 2006.

  1. Harsky
    OP

    Harsky Madmin

    Member
    5,304
    424
    Aug 2, 2004
    I have a site (can't give link, sorry) and when I was organizing the files, I decided to create some folders (such as picture etc) to make it more managable. But I noticed that if I type in something like www.nameofsite.com/picture it gives a full list of every single thing that I uploaded in the picture folder. How do I stop that happening?
     


  2. jumpman17

    jumpman17 He's a semi-aquatic egg laying mammal of action!

    Former Staff
    8,987
    173
    Apr 11, 2003
    United States
    put a blank html file called index.html into the folder. then when you try to go to that folder, it will show a blank page. or you could type something up if you want saying "ZOMG! Super secret haxxors page!"

    There is another way to block all folders but I don't know how.
     
  3. accolon

    accolon GBAtemp Regular

    Member
    206
    0
    Oct 29, 2003
    Gambia, The
    It's a setting of the server, you can enable or disable directory listing in the configuration file.
     
  4. Harsky
    OP

    Harsky Madmin

    Member
    5,304
    424
    Aug 2, 2004
    Don't want to make another topic so I'll post here. There's something I'm trying to do on my site. I made several pictures to use as the banner on top of my site. Only problem is, I can't settle on one picture. So what I was wanting to do is that everytime someone refreshes the site, the picture always changes. Unfortunately, I was told that can only be done in Javascript and I don't know the first thing to do. Thanks in advance.
     
  5. _Mazza_

    _Mazza_ GBAtemp Regular

    Member
    279
    0
    Jun 25, 2006
    arghhh i need to know the name of the site now or i'll go insane lol
     
  6. Harsky
    OP

    Harsky Madmin

    Member
    5,304
    424
    Aug 2, 2004
    Can't. It has pr0n..... AND BLACK JACKS AND HOOKERS. IN FACT SCREW IT, I'LL SET UP MY OWN CASINO.
     
  7. mthrnite

    mthrnite So it goes.

    Former Staff
    4,527
    938
    Jun 30, 2006
    United States
    th' south
    [​IMG] ^^^

    Whew!

    Well, here, do what I do, find a site that has what you want, and swipe the code. Monkey around switching out the graphics and whatnot until it works. That's how I learned HTML. [​IMG]
     
  8. Harsky
    OP

    Harsky Madmin

    Member
    5,304
    424
    Aug 2, 2004
    I can't think of any sites that does what I'm wanting to snatch the code.
     
  9. kernelPANIC

    kernelPANIC GBAtemp Fan

    Member
    423
    1
    Nov 20, 2005
    Madrid
    http://www.aunder.org/
    Type refresh and the banner at the top changes...
    Is that what you were looking for?
     
  10. Harsky
    OP

    Harsky Madmin

    Member
    5,304
    424
    Aug 2, 2004
    Yeah, something like that
     
  11. Samutz

    Samutz Wet Tissue Sample

    Member
    1,598
    2
    Oct 4, 2004
    United States
    See that hole in your wall?
    Well not solely Javascript only, but it can't be done with standard HTML. Like the above example, it can also be done with php. If you want to go that route, I could whip up a quick script that would work for you.
     
  12. SomeGuyGG

    SomeGuyGG GBAtemp Regular

    Member
    251
    0
    Jun 28, 2004
    Canada
    canada
    Put this in the header, to add more just copy the banner[*] line, change the number to 1 above the last, and then change the numbanner to match [remember [0] counts as 1 too].

    CODE
        function getbanner() {
                banner = new MakeArray(100);
                numbanner = 4;  // Make this the number of banners you have.

                banner[0] = ""
                banner[1] = ""
                banner[2] = ""
                banner[3] = ""
               //Make more as needed

                var now = new Date()
                var sec = now.getSeconds()

                return banner[sec % numbanner];
        }

        function MakeArray(n) {
                this.length = n;
                for (var i = 1; i
     
  13. Harsky
    OP

    Harsky Madmin

    Member
    5,304
    424
    Aug 2, 2004
    I think I did something wrong as nothing is appearing
     
  14. Psyfira

    Psyfira Credit: 0ml. Insert tea to continue

    Member
    3,887
    15
    Dec 31, 2003
    England
    It's working fine over here (assuming you've changed the image URL's cause the ones in the example don't exist)
     
  15. Harsky
    OP

    Harsky Madmin

    Member
    5,304
    424
    Aug 2, 2004
    Or maybe I'm such an HTML newbie and don't know what header is.
     
  16. Psyfira

    Psyfira Credit: 0ml. Insert tea to continue

    Member
    3,887
    15
    Dec 31, 2003
    England
    The bit between the head tags [​IMG]
    CODE



    ...
    ...







     
  17. Harsky
    OP

    Harsky Madmin

    Member
    5,304
    424
    Aug 2, 2004
    Okay, I made up the banner, inserted the script between the head but when I try to put this where I want it to appear:


    CODE
    Â Â document.write(getbanner());
    Â Â

    It doesn't work
     
  18. Qith

    Qith GBAtemp Regular

    Member
    203
    0
    Jan 20, 2004
    Netherlands
    Okay so your code should look something like this:

    CODE

    pr0n


    Â Âfunction getbanner() {
    Â Â Â Â Â Âbanner = new MakeArray(100);
    Â Â Â Â Â Ânumbanner = 4; Â// Make this the number of banners you have.

    Â Â Â Â Â Âbanner[0] = ""
    Â Â Â Â Â Âbanner[1] = ""
    Â Â Â Â Â Âbanner[2] = ""
    Â Â Â Â Â Âbanner[3] = ""
    Â Â Â Â Â //Make more as needed

    Â Â Â Â Â Âvar now = new Date()
    Â Â Â Â Â Âvar sec = now.getSeconds()

    Â Â Â Â Â Âreturn banner[sec % numbanner];
    Â Â}

    Â Âfunction MakeArray(n) {
    Â Â Â Â Â Âthis.length = n;
    Â Â Â Â Â Âfor (var i = 1; i
     
  19. Harsky
    OP

    Harsky Madmin

    Member
    5,304
    424
    Aug 2, 2004
    Yay, got it working. But what about the alcohol...... BTW, I found myself using quite a lot of banners which is making the code looking a little messy. Is there another banner refreshing option?
     
  20. Squiffy

    Squiffy GBATemp's Little Embarrassment

    Member
    1,192
    0
    Oct 30, 2002
    Northern Ireland
    Well, we won't actually see the code, and since it's only text the filesize should still be small. So, I wouldn't worry about it getting messy, just tab it out, add new lines to make it neater.
    Have you ever seen the gbatemp portal source? It's horrible!