Dear Poec or others,

I followed the instructions, but the *.cgi fails to generate an output. What
did I do wrong?

Try www.voelspriet.nl/spriet.cgi to see the error. This is the content of
the script:


#!/usr/bin/perl -wT
    use strict;
    use CGI qw/:standard/;
    use URI::Escape;

    # if we came from the form, grab the values and create the URL
    if ( param )
    {
        # get the form data
        # see perldoc CGI
        my $_prefix = param( 'prefix' ) || '';
        my $_search = param( 'search' ) || '';

        # untaint it
        # see perldoc perlsec
        my ( $prefix ) = ( $_prefix =~ /^([a-zA-Z\d\s_:]+)$/ ); #create
appropriate regex
        my ( $search ) = ( $_search =~ /^([a-zA-Z\d\s_:]+)$/ ); #create
appropriate regex

        # escape characters with special meaning in URIs
        # see perldoc URI::Escape
        $prefix = uri_escape( $prefix );
        $search = uri_escape( $search );
        print redirect(
"http://www.google.com/search?q=$prefix%20$search"; );
    }
    # otherwise, print the Web page
    else
    {
        print header;
        print <<END_HTML;
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>

    <html>
        <head>
            <title>Test page</title>
        </head>
        <body>
            <form action="spriet.cgi" method="get">
                <input type="checkbox" name="prefix" value="allintitle:" />
All in title<br />
                <input type="text"     name="search" />
                <input type="submit"   name="Submit" />
            </form>
        </body>
    </html>
    END_HTML
    }



-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to