CGI更改服务器IP地址?? [英] CGI change server IP address ??

查看:210
本文介绍了CGI更改服务器IP地址??的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨..


我正在研究一个CGI脚本,让客户端获取服务器IP地址,然后更改为它喜欢的IP地址。


服务器IP地址可以从环境变量SERVER_ADDR获得


我正在尝试使用以下脚本更改服务器的IP地址:


#!/ usr / bin / perl -w

使用严格;


我的$ URL =" ; http://192.168.28.130" ;;

print"状态:302 Moved\\\
Location:$ URL \ n \ nn";


system(" / sbin / ifconfig eth0 192.168.28.130");


我设法更改了服务器的IP地址。但是网页的重新发布并不会发生。


任何想法如何解决这个问题???

Hi..

I am working on a CGI script to enable client to obtain the server ip address and then change to the IP address it prefer.

The server IP address can be obtain from the environment variable SERVER_ADDR

I am trying to change the IP address of the server with the following script:

#!/usr/bin/perl -w

use strict;

my $URL="http://192.168.28.130";
print "Status: 302 Moved\nLocation: $URL\n\n";

system("/sbin/ifconfig eth0 192.168.28.130");


I managed to change the IP address of the server. But the Re-driection of the web page doesnt not happen.

Any idea how to solve this???

推荐答案

URL =" http://192.168.28.130" ;;

print" Status:302 Moved\\\
Location:
URL="http://192.168.28.130";
print "Status: 302 Moved\nLocation:


URL \ nn \\ n" ;;


system(" / sbin / ifconfig eth0 192.168.28.130");



我管理更改服务器的IP地址。但是网页的重新发布并不会发生。


任何想法如何解决这个问题???
URL\n\n";

system("/sbin/ifconfig eth0 192.168.28.130");


I managed to change the IP address of the server. But the Re-driection of the web page doesnt not happen.

Any idea how to solve this???


你需要打印一个元刷新标记以重定向浏览器。在谷歌上搜索元标记教程或类似的东西。
You need to print a meta refresh tag to redirect the browser. Search on google for "meta tag tutorial" or something similar.


这篇关于CGI更改服务器IP地址??的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆