用户注册



邮箱:

密码:

用户登录


邮箱:

密码:
记住登录一个月忘记密码?

发表随想


还能输入:200字
云代码 - perl代码库

perl 重定向到一个不同的位置

2012-10-15 作者: 神马举报

[perl]代码库

#-----------------------------
$url = "http://www.perl.com/CPAN/";
print "Location: $url\n\n";
exit;
#-----------------------------
# download the following standalone program
#!/usr/bin/perl -w
# oreobounce - set a cookie and redirect the browser
use CGI qw ( :cgi );

$oreo = cookie ( -NAME    => 'filling',
                 -VALUE   => "vanilla cr鑝e",
                 -EXPIRES => '+3M',    # M for month, m for minute
	                 -DOMAIN  => '.perl.com' );

$whither  = "http://somewhere.perl.com/nonesuch.html";

print redirect ( -URL     => $whither,
                 -COOKIE  => $oreo );

#-----------------------------
#Status: 302 Moved Temporarily
#
#Set-Cookie: filling=vanilla%20cr%E4me; domain=.perl.com;
#
#    expires=Tue, 21-Jul-1998 11:58:55 GMT
#
#Date: Tue, 21 Apr 1998 11:55:55 GMT
#
#Location: http://somewhere.perl.com/nonesuch.html
#
#Content-Type: text/html
#
#B<<blank line here>>
#-----------------------------
# download the following standalone program
#!/usr/bin/perl
# os_snipe - redirect to a Jargon File entry about current OS
$dir = 'http://www.wins.uva.nl/%7Emes/jargon';
for ( $ENV {HTTP_USER_AGENT} )
{
	$page  =    /Mac/            && 'm/Macintrash.html'
	             || /Win ( dows ) ?NT/  && 'e/evilandrude.html'
	             || /Win|MSIE|WebTV/ && 'm/MicroslothWindows.html'
	             || /Linux/          && 'l/Linux.html'
	             || /HP-UX/          && 'h/HP-SUX.html'
	             || /SunOS/          && 's/ScumOS.html'
	             ||                     'a/AppendixB.html';
}
print "Location: $dir/$page\n\n";

#-----------------------------
use CGI qw ( :standard );
print header ( -STATUS => '204 No response' );
#-----------------------------
#Status: 204 No response
#
#Content-Type: text/html
#
#<blank line here>
#-----------------------------
#!/bin/sh

cat <<EOCAT
Status: 204 No response

EOCAT
#-----------------------------


网友评论    (发表评论)

共1 条评论 1/1页

发表评论:

评论须知:

  • 1、评论每次加2分,每天上限为30;
  • 2、请文明用语,共同创建干净的技术交流环境;
  • 3、若被发现提交非法信息,评论将会被删除,并且给予扣分处理,严重者给予封号处理;
  • 4、请勿发布广告信息或其他无关评论,否则将会删除评论并扣分,严重者给予封号处理。


扫码下载

加载中,请稍后...

输入口令后可复制整站源码

加载中,请稍后...