1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

quick help needed...

Discussion in 'Programming' started by dav1e215, Jan 12, 2006.

  1. #1
    after searching and searching I found this redirect.cgi script, all I have to do is enter

    http://www.mysite.com/cgi-bin/redirect.cgi?http://anothersite.com/id2442/faf

    the only problem I have is when I redirect it to another http://www.anysite.com it works fine but when I try redirecting it to a longer url without like the one above it says

    Error: Your URL sould be begining by http:// or ftp://

    the problem is it does start with http:// but I am guessing its checking the full url and maybe its too long or it doesnt have a .com at the end. Is there any way someone can help me edit or take out so it wont check for the redirecting url? here is whats in the file to edit... thanks!!

    Necessary Variables:                                               #
    # The following variables should be set to define the locations      #
    # and URLs of various files, as explained in the documentation.      #
    
    #Options:
    $UseLog = 0;      # Use Log File ? 1 = YES; 0 = NO
    $LogFile = "/Absolute/path/to/log.txt";
    
    # Nothing Below this line needs to be altered!                       #
    ######################################################################
    
    	@date = localtime(time); $date[4]++;
    	$Time = "$date[4]/$date[3]/$date[5]";
    
    	$Query_File = $ENV{QUERY_STRING};
    	$Query_File =~ s/%([0-9A-F][0-9A-F])/pack("C",oct("0x$1"))/ge;
    	$Query_File =~ tr/+/ /;
    	($url) =  split(/\&/,$Query_File);
    
    	if ($url =~ /=/) {
    		($name, $url) = split(/=/, $url);
    	}
    
    	if ($UseLog) {
    		open(LOG,">>$LogFile") || &Error("Cannot Write Log File : $LogFile, Error $!\n");
    		print LOG "[$Time] - $ENV{'REMOTE_HOST'} -> $url\n";
    		close(LOG);
    	}
    
    	if ($url =~ /^(ht|f)tp:\/\//) {
    		print "Location: $url\n\n";
    	} else {
    		&Error("Your URL sould be begining by http:// or ftp://\n");
    	}
    
    sub Error {
    	my($ErrorText) = @_;
    	print "Content-type: text/html\n\n";	
    	print "Error: ".$ErrorText;
    	exit;
    }
    Code (markup):
     
    dav1e215, Jan 12, 2006 IP