Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7
  1. #1
    New Coder
    Join Date
    Jun 2002
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    CGI script help ??

    Hi everyone,

    I am creating a cgi script which processes the data from my form and e-mails the results to me. What I would like to know is, is it possible to forward the user to a page on my website after the email has been sent ? If so how do I do that ??

    Any help appreciated

    Thanks

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,898
    Thanks
    203
    Thanked 2,530 Times in 2,508 Posts
    Matt Wright's formmail.pl is the "industry standard" (why invent the wheel???) and includes redirection such as you require.

  • #3
    New Coder
    Join Date
    Jun 2002
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Philip,

    I am trying to create my own cgi script, because I like a challenge and I want to try and learn cgi without just cutting and pasting scripts here and there.


  • #4
    New Coder
    Join Date
    Jun 2002
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It is possible to forward the user to another page after they have finished. If your login page is in HTML, then your form will probably call on your CGI script. In that case, simply place:

    Code:
    print "Content-type: text/html\n\n";
    print <<ENDHTML;
    #enter in the html for the page to be redirected to here
    ENDHTML
    If the page you want to redirect the user to is in HTML, the most intuitive way (for now) to do it is by:

    Code:
    print <<ENDHTML;
    <html><head><title>Redirector</title></head>
    <body><script>window.location = ""</script> #Redirect URL in the quotes
    </body>
    </html>
    -Obiwan Jabroni
    May the Schwartz be With You

  • #5
    New Coder
    Join Date
    Jun 2002
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks ObiwanJebroni,

    Thanks for your reply, I will give that a try !!


  • #6
    Regular Coder Feyd's Avatar
    Join Date
    May 2002
    Location
    Los Angeles, CA Maxim: Subvert Society
    Posts
    403
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Matt's FormMail, and all of Matt's scripts, have extreme security problems, huge holes...massive problems. They always have...try and avoid using them entirely, or make sure you can plug the holes yourself.

    As for the redirection, it depends on how your script is setup. As has been pointed out, you can call another sub or another block of code that would redirect by printing HTTP EQUIV headers or JavaScript redirects, but why even do that?

    You also could do a redirect that is pure cgi and much faster (and not depending on the way the user has their browser setup).

    print "Location : http://www.yoursite.com/thankyou\n\n;"

    And note that you would have to make sure that this line of code is executed without the content type of text/html or it will just print that line to the client.

    I've attached a script that I used to use a while back...
    Attached Files Attached Files
    Moderator, Perl/CGI Forum
    shadowstorm.net - subvert society

  • #7
    New Coder
    Join Date
    Jun 2002
    Posts
    70
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Sweet, you can do that feyd? *takes down notes*. Awesome jawsome !
    -Obiwan Jabroni
    May the Schwartz be With You


  •  

    Posting Permissions

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