Results 1 to 11 of 11

Thread: HTML assistance required

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    chris_uk_83's Avatar Physicist
    Join Date
    Feb 2007
    Location
    Lancaster, England
    Posts
    818

    Default HTML assistance required

    I hope there are some budding HTMLists out there because I have a challenge. I've got a website set up that lets people have access to my old revision notes (due to popular demand, people kept begging for them for some reason), and I want to make people identify themselves before they download the files. I don't want to stop anyone, I just want to know who is doing it by making them type their name or something (and I'm not that bothered about them typing silly names either if they want to). I then want to be able to see who has been downloading my files.

    Any ideas anyone?

  2. #2
    Erik's Avatar Dux Limitis
    Join Date
    Aug 2004
    Location
    Amsterdam
    Posts
    15,653

    Default Re: HTML assistance required

    Need my help again, already?

    What you want to do can't (to my knowledge) be done in HTML.
    It is possible with PHP though, but unless you can find some ready made code it's going to be quite challenging for a novice.

    Fortunately PHP is easy to learn because it's basically just HTML with special tags that allow you to execute code whenever somebody requests a page.

    PHP runs on the server (unlike Java, which can also run on a client computer).
    And not all servers support it. (you might have to pay extra for a server that does, because it requires some additional CPU power).


    In short I envision something like this:
    -Users have to fill in an HTML form and then clock a "download" button.
    -The "download" button links to a PHP file that get's executed with values from the HTML form as it's arguments.

    The PHP file contains a script that stores the values form the form in a file, or better: a database like MySQL, and then generates a HTML file containing the requested data which gets send to the user.

    If you want to send something other than HTML text it's going to be a but more complicated because you'll need to store the data in a place where it can't be accessed, then send it only to those who filled out the form.
    Otherwise it will be very easy to access the data without using the form.

    You could also do a similar thing in Java, but if you don't know Java already it's probably easiest in PHP.
    Last edited by Erik; April 18, 2007 at 04:57 PM.



  3. #3
    kshcshbash's Avatar My Good Sir CNSW
    Civitate

    Join Date
    Nov 2005
    Location
    Ontario, Canada
    Posts
    736

    Default Re: HTML assistance required

    What HTML do you have already, perhaps we can help you hack together something nice.
    Simetrical's homeboy, yo.
    You take the blue pill and the story ends. You wake in your bed and you believe whatever you want to believe. You take the red pill and you stay in Wonderland and I show you how deep the rabbit-hole goes. Remember -- all I am offering is the truth, nothing more.

    Sign up to learn Java!

  4. #4
    Simetrical's Avatar Former Chief Technician
    Patrician

    Join Date
    Nov 2004
    Location
    θ = π/0.6293, φ = π/1.293, ρ = 6,360 km
    Posts
    20,154

    Default Re: HTML assistance required

    There's no way to do this without some kind of script like PHP, as Erik says. Your host might not permit this. It's marginally possible that there would be some way to do this using .htaccess and/or .htpasswd if those are enabled without involving PHP (or Python, Perl, whatever's available), but it would be a pain to work out if it's even doable.
    MediaWiki developer, TWC Chief Technician
    NetHack player (nao info)


    Risen from Prey

  5. #5
    chris_uk_83's Avatar Physicist
    Join Date
    Feb 2007
    Location
    Lancaster, England
    Posts
    818

    Default Re: HTML assistance required

    You could also do a similar thing in Java, but if you don't know Java already it's probably easiest in PHP.
    Aha! It just so happens that I DO know Java (a bit anyway, enough to create a reasonable applet and to understand what the netBeans visual editor is writing). I think Java may have to be the route to go because I can't really be arsed learning php. I know an applet has to live in a 'sandbox' so it can't access the user's computer, but can it access files that live on the same server as it (i.e. are hosted by me)? If so I think I can do this by creating a text file every time someone types in their name. Then I can go and read the text files to find out who logged in. Anyone know if this'll work before I waste my time trying?

  6. #6
    Simetrical's Avatar Former Chief Technician
    Patrician

    Join Date
    Nov 2004
    Location
    θ = π/0.6293, φ = π/1.293, ρ = 6,360 km
    Posts
    20,154

    Default Re: HTML assistance required

    Quote Originally Posted by chris_uk_83 View Post
    Aha! It just so happens that I DO know Java (a bit anyway, enough to create a reasonable applet and to understand what the netBeans visual editor is writing). I think Java may have to be the route to go because I can't really be arsed learning php. I know an applet has to live in a 'sandbox' so it can't access the user's computer, but can it access files that live on the same server as it (i.e. are hosted by me)?
    If the user permits it to break from its sandbox and go onto the Internet, yes. In general, that's poor form. You could, of course, use server-side Java, if it's enabled. If PHP works on your server, however, it would be fairly trivial to do it in that. PHP is good for quick hacks, although not necessarily for much else.
    MediaWiki developer, TWC Chief Technician
    NetHack player (nao info)


    Risen from Prey

  7. #7
    kshcshbash's Avatar My Good Sir CNSW
    Civitate

    Join Date
    Nov 2005
    Location
    Ontario, Canada
    Posts
    736

    Default Re: HTML assistance required

    EDIT: I did have a crappy script right here.

    I'll write you the full one when the sun goes down, I'm literally sweating.
    Last edited by kshcshbash; April 19, 2007 at 04:51 PM.
    Simetrical's homeboy, yo.
    You take the blue pill and the story ends. You wake in your bed and you believe whatever you want to believe. You take the red pill and you stay in Wonderland and I show you how deep the rabbit-hole goes. Remember -- all I am offering is the truth, nothing more.

    Sign up to learn Java!

  8. #8
    chris_uk_83's Avatar Physicist
    Join Date
    Feb 2007
    Location
    Lancaster, England
    Posts
    818

    Default Re: HTML assistance required

    I've just been researching what my server has (I'm using the free webspace provided by my ISP Plusnet), and it's got all kinds of things, PHP, SQL and CGI. Now all I have to do is read their help pages to figure out what to do with them! If you could give me anything you have CNSW that'd be great though, since it'd probably help me learn quicker!

    If I've helped you, rep me. I live for rep.

  9. #9
    kshcshbash's Avatar My Good Sir CNSW
    Civitate

    Join Date
    Nov 2005
    Location
    Ontario, Canada
    Posts
    736

    Default Re: HTML assistance required

    I'll write a HOWTO in a different thread, so I can cover each thing in a bit more depth. I can't do it for the next few hours...
    Simetrical's homeboy, yo.
    You take the blue pill and the story ends. You wake in your bed and you believe whatever you want to believe. You take the red pill and you stay in Wonderland and I show you how deep the rabbit-hole goes. Remember -- all I am offering is the truth, nothing more.

    Sign up to learn Java!

  10. #10

    Default Re: HTML assistance required

    What about something like PHP Form Wizard? Or if you have asp available on your server you could do something like this.
    Last edited by spartan_phalanx; April 20, 2007 at 06:09 PM.

  11. #11
    chris_uk_83's Avatar Physicist
    Join Date
    Feb 2007
    Location
    Lancaster, England
    Posts
    818

    Default Re: HTML assistance required

    Hmm, both those look interesting. I'll have to check them out and see what I can do with them. I'm tempted to learn some new languages and ways of doing things (PSP, ASP etc. incidentally I don't think asp is available on my server), then I can write fantastic new websites!

    If I've helped you, rep me. I live for rep.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •