0
Welcome Guest! Login
0 items Join Now

URL Form

    • Leckenby's Avatar
    • Leckenby
    • Elite Rocketeer
    • Posts: 714
    • Thanks: 0

    URL Form

    Posted 16 years 8 months ago
    • I need a code which creates a form, and when the user types in, for example 'test', it goes to /test

      www.designerwiz.com/JavaScripts/go_to_url_input.htm

      this does the right thing, if I have this code at www.example.com , and i enter 'test' and click go to, it would go to www.example.com/test

      HOWEVER

      I don't want to use it, as if the user instead decides to press enter rather than go to, the url becomes 'www.example.com?href=test', which is no good

      Anyone know of a code to do what I want, or able to fix the one I posted above?
    • Leckenby's Avatar
    • Leckenby
    • Elite Rocketeer
    • Posts: 714
    • Thanks: 0

    Re: URL Form

    Posted 16 years 8 months ago
    • Okay, did a bit of research, and got to this stage:

      index.php

      <form action="url.php" method="post">
      <input type="text" name="url" size="25">
      </form>


      url.php

      <?
      function clean_up($data) {
      $data = strip_tags($data);
      $data = trim(htmlentities($data));
      return $data;
      }
      $url = clean_up($_POST);
      header("Location: dev.example.com/projects/$url ");
      ?>


      Now this works great, exactly what I needed, but just wondering, how secure is it? Anybody see any problems?
    • J!eremy's Avatar
    • J!eremy
    • Elite Rocketeer
    • Posts: 2108
    • Thanks: 8

    Re: URL Form

    Posted 16 years 8 months ago
    • Leckenby's Avatar
    • Leckenby
    • Elite Rocketeer
    • Posts: 714
    • Thanks: 0

    Re: URL Form

    Posted 16 years 8 months ago
    • Well, what Im doing is a dev area for clients, and Im giving them a 'token' to enter into a form at dev.example.com which will take them to a project.

      So say they enter 'test13', then it would take them to dev.example.com/projects/test13

      You see?
    • J!eremy's Avatar
    • J!eremy
    • Elite Rocketeer
    • Posts: 2108
    • Thanks: 8

    Re: URL Form

    Posted 16 years 8 months ago
    • Leckenby's Avatar
    • Leckenby
    • Elite Rocketeer
    • Posts: 714
    • Thanks: 0

    Re: URL Form

    Posted 16 years 8 months ago
    • =)

      ive sent you a PM of it working, just enter test or something, you will see how cool it is!

      Lets just hope its secure...
    • J!eremy's Avatar
    • J!eremy
    • Elite Rocketeer
    • Posts: 2108
    • Thanks: 8

    Re: URL Form

    Posted 16 years 8 months ago

Time to create page: 0.067 seconds