Luci无法启动请求的CGI程序:/www/cgi-bin/sample.cgi:执行错误

问题描述:

我试图在OpenWRT安装上运行的uhttpd server上执行Cgi-Cpp程序。 Cgi文件是/www/cgi-bin/sample.cgi并且也具有执行权限。我试图用HTML文件访问这个Cgi。这是我的sample.cgi文件:Luci无法启动请求的CGI程序:/www/cgi-bin/sample.cgi:执行错误

unable to launch the requested CGI program: /www/cgi-bin/sample.cgi: Exec error 

我缺少什么:

#include <iostream> 
#include <vector> 
#include <string> 
#include <stdio.h> 
#include <stdlib.h> 

#include <cgicc/CgiDefs.h> 
#include <cgicc/Cgicc.h> 
#include <cgicc/HTTPHTMLHeader.h> 
#include <cgicc/HTMLClasses.h> 

using namespace std; 
using namespace cgicc; 

int main() { 
    Cgicc formData; 

    cout << "Content-type:text/html\r\n\r\n"; 
    cout << "<html>\n"; 
    cout << "<head>\n"; 
    cout << "<title>Using GET and POST Methods</title>\n"; 
    cout << "</head>\n"; 
    cout << "<body>\n"; 

    form_iterator fi = formData.getElement("first_name"); 

    if(!fi->isEmpty() && fi != (*formData).end()) { 
     cout << "First name: " << **fi << endl; 
    }else{ 
     cout << "No text entered for first name" << endl; 
    } 
    cout << "</body>\n"; 
    cout << "</html>\n"; 

    return 0; 
} 

,当我在HTML点击提交按钮,我得到一个错误?所有权限都在那里设置。有什么建议么?

确保您正在构建程序。首先打开一个终端窗口,然后cd到/ www/cgi-bin。现在使用

ls -l 

列出目录中的程序。你应该看到你的sample.cpp文件。如果它不在那里,请将它移到那里。如果您不再有sample.cpp文件,请使用您最初发布的代码创建一个文本文件。你可以用像nano这样的文本编辑器来做到这一点。

nano sample.cpp 

在您的源文件中输入或粘贴。然后按ctrl-x保存并退出程序。确保你告诉nano保存程序,而不是退出。

接下来删除你现有的sample.cgi。不要删除sample.cpp。

使用此命令来构建的源代码(sample.cpp的)成二进制可执行文件:

g++ sample.cpp -o sample.cgi 

的“-o”是字母“O”,而不是数字“0”。如果构建引发编译错误,请修复错误并重复,直到成功构建该程序。你现在将有一个二进制文件“sample.cgi”。

确保“sample.cgi”可执行。如果没有,则使其可执行

sudo chmod a+x sample.cgi 

确保您可以先从命令行执行sample.cgi。如果你不能这样做,那么服务器将无法做到。然后键入

"./sample.cgi". 

在执行应用程序后,您应该会在终端窗口中看到您从应用程序发送的html。

让我们知道您是否需要进一步的帮助。

+0

运行'。/ sample.cgi'时,我得到'第1行:语法错误:意外的单词(期待“)”)'。是否由于任何编译问题? – user2986042

+0

我这么认为。你如何编写程序?使用IDE或从命令行?如果来自命令行,请发布命令来构建cgi脚本。其实我怀疑你正试图运行C++源程序,就好像它是一个bash脚本。我将编辑我的原始帖子,向您展示如何构建C++源代码。 – ClarkS

如果您尝试使表单然后使用shell脚本然后C++。在这里我向你展示我如何创建一个文件,路由器可以像dhcp,pppoe或静态模式那样设置。

#!/bin/sh 

echo "Content-type: text/html" 
echo "" 
echo '<html>' 
echo '<head>' 
echo '<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">' 
echo '</head>' 
echo '<br><h1><center>Welcome to Internet Service</center></h1>' 

if [ -z "$QUERY_STRING" ]; then 
    ssi=$(uci get [email protected][1].ssid) 
    key=$(uci get [email protected][1].key) 
    net=$(uci get network.wan.netmask) 
    ipa=$(uci get network.wan.ipaddr) 
    lip=$(uci -P /var/state get network.lan.ipaddr) 
    ppu=$(uci get network.wan.username) 
    ppp=$(uci get network.wan.password) 
    ser=$(uci get network.wan.service) 
    gat=$(uci get network.wan.gateway) 
    rad=$(uci get network.wan.proto) 
else 
# No looping this time, just extract the data you are looking for with sed: 
rad=`echo "$QUERY_STRING" | sed -n 's/^.*val_a=\([^&]*\).*$/\1/p' | sed "s/%20/ /g" | sed "s/%40/@/g" | sed "s/%28/(/g" | sed "s/%29/)/g" | sed "s/%25/%/g" | sed "s/%2B/+/g" | sed "s/%23/#/g" | sed "s/%21/!/g" | sed "s/%24/$/g" | sed "s/%5E/^/g" | sed "s/%3D/=/g" | sed "s/%7E/~/g" | sed "s/%7C/|/g" | sed "s/%7B/{/g" | sed "s/%7D/}/g" | sed "s/%5B/[/g" | sed "s/%5D/]/g" | sed "s/%3A/:/g" | sed "s/%3B/;/g" | sed "s/%3F/?/g" | sed "s/%2C/,/g" | sed "s/%3C/</g" | sed "s/%3E/>/g"` 
ssi=`echo "$QUERY_STRING" | sed -n 's/^.*val_b=\([^&]*\).*$/\1/p' | sed "s/%20/ /g" | sed "s/%40/@/g" | sed "s/%28/(/g" | sed "s/%29/)/g" | sed "s/%25/%/g" | sed "s/%2B/+/g" | sed "s/%23/#/g" | sed "s/%21/!/g" | sed "s/%24/$/g" | sed "s/%5E/^/g" | sed "s/%3D/=/g" | sed "s/%7E/~/g" | sed "s/%7C/|/g" | sed "s/%7B/{/g" | sed "s/%7D/}/g" | sed "s/%5B/[/g" | sed "s/%5D/]/g" | sed "s/%3A/:/g" | sed "s/%3B/;/g" | sed "s/%3F/?/g" | sed "s/%2C/,/g" | sed "s/%3C/</g" | sed "s/%3E/>/g"` 
key=`echo "$QUERY_STRING" | sed -n 's/^.*val_c=\([^&]*\).*$/\1/p' | sed "s/%20/ /g" | sed "s/%40/@/g" | sed "s/%28/(/g" | sed "s/%29/)/g" | sed "s/%25/%/g" | sed "s/%2B/+/g" | sed "s/%23/#/g" | sed "s/%21/!/g" | sed "s/%24/$/g" | sed "s/%5E/^/g" | sed "s/%3D/=/g" | sed "s/%7E/~/g" | sed "s/%7C/|/g" | sed "s/%7B/{/g" | sed "s/%7D/}/g" | sed "s/%5B/[/g" | sed "s/%5D/]/g" | sed "s/%3A/:/g" | sed "s/%3B/;/g" | sed "s/%3F/?/g" | sed "s/%2C/,/g" | sed "s/%3C/</g" | sed "s/%3E/>/g"` 
lip=`echo "$QUERY_STRING" | sed -n 's/^.*val_j=\([^&]*\).*$/\1/p' | sed "s/%20/ /g" | sed "s/%40/@/g" | sed "s/%28/(/g" | sed "s/%29/)/g" | sed "s/%25/%/g" | sed "s/%2B/+/g" | sed "s/%23/#/g" | sed "s/%21/!/g" | sed "s/%24/$/g" | sed "s/%5E/^/g" | sed "s/%3D/=/g" | sed "s/%7E/~/g" | sed "s/%7C/|/g" | sed "s/%7B/{/g" | sed "s/%7D/}/g" | sed "s/%5B/[/g" | sed "s/%5D/]/g" | sed "s/%3A/:/g" | sed "s/%3B/;/g" | sed "s/%3F/?/g" | sed "s/%2C/,/g" | sed "s/%3C/</g" | sed "s/%3E/>/g"`  
net=`echo "$QUERY_STRING" | sed -n 's/^.*val_d=\([^&]*\).*$/\1/p' | sed "s/%20/ /g" | sed "s/%40/@/g" | sed "s/%28/(/g" | sed "s/%29/)/g" | sed "s/%25/%/g" | sed "s/%2B/+/g" | sed "s/%23/#/g" | sed "s/%21/!/g" | sed "s/%24/$/g" | sed "s/%5E/^/g" | sed "s/%3D/=/g" | sed "s/%7E/~/g" | sed "s/%7C/|/g" | sed "s/%7B/{/g" | sed "s/%7D/}/g" | sed "s/%5B/[/g" | sed "s/%5D/]/g" | sed "s/%3A/:/g" | sed "s/%3B/;/g" | sed "s/%3F/?/g" | sed "s/%2C/,/g" | sed "s/%3C/</g" | sed "s/%3E/>/g"` 
ipa=`echo "$QUERY_STRING" | sed -n 's/^.*val_e=\([^&]*\).*$/\1/p' | sed "s/%20/ /g" | sed "s/%40/@/g" | sed "s/%28/(/g" | sed "s/%29/)/g" | sed "s/%25/%/g" | sed "s/%2B/+/g" | sed "s/%23/#/g" | sed "s/%21/!/g" | sed "s/%24/$/g" | sed "s/%5E/^/g" | sed "s/%3D/=/g" | sed "s/%7E/~/g" | sed "s/%7C/|/g" | sed "s/%7B/{/g" | sed "s/%7D/}/g" | sed "s/%5B/[/g" | sed "s/%5D/]/g" | sed "s/%3A/:/g" | sed "s/%3B/;/g" | sed "s/%3F/?/g" | sed "s/%2C/,/g" | sed "s/%3C/</g" | sed "s/%3E/>/g"` 
gat=`echo "$QUERY_STRING" | sed -n 's/^.*val_f=\([^&]*\).*$/\1/p' | sed "s/%20/ /g" | sed "s/%40/@/g" | sed "s/%28/(/g" | sed "s/%29/)/g" | sed "s/%25/%/g" | sed "s/%2B/+/g" | sed "s/%23/#/g" | sed "s/%21/!/g" | sed "s/%24/$/g" | sed "s/%5E/^/g" | sed "s/%3D/=/g" | sed "s/%7E/~/g" | sed "s/%7C/|/g" | sed "s/%7B/{/g" | sed "s/%7D/}/g" | sed "s/%5B/[/g" | sed "s/%5D/]/g" | sed "s/%3A/:/g" | sed "s/%3B/;/g" | sed "s/%3F/?/g" | sed "s/%2C/,/g" | sed "s/%3C/</g" | sed "s/%3E/>/g"` 
ppu=`echo "$QUERY_STRING" | sed -n 's/^.*val_g=\([^&]*\).*$/\1/p' | sed "s/%20/ /g" | sed "s/%40/@/g" | sed "s/%28/(/g" | sed "s/%29/)/g" | sed "s/%25/%/g" | sed "s/%2B/+/g" | sed "s/%23/#/g" | sed "s/%21/!/g" | sed "s/%24/$/g" | sed "s/%5E/^/g" | sed "s/%3D/=/g" | sed "s/%7E/~/g" | sed "s/%7C/|/g" | sed "s/%7B/{/g" | sed "s/%7D/}/g" | sed "s/%5B/[/g" | sed "s/%5D/]/g" | sed "s/%3A/:/g" | sed "s/%3B/;/g" | sed "s/%3F/?/g" | sed "s/%2C/,/g" | sed "s/%3C/</g" | sed "s/%3E/>/g"` 
ppp=`echo "$QUERY_STRING" | sed -n 's/^.*val_h=\([^&]*\).*$/\1/p' | sed "s/%20/ /g" | sed "s/%40/@/g" | sed "s/%28/(/g" | sed "s/%29/)/g" | sed "s/%25/%/g" | sed "s/%2B/+/g" | sed "s/%23/#/g" | sed "s/%21/!/g" | sed "s/%24/$/g" | sed "s/%5E/^/g" | sed "s/%3D/=/g" | sed "s/%7E/~/g" | sed "s/%7C/|/g" | sed "s/%7B/{/g" | sed "s/%7D/}/g" | sed "s/%5B/[/g" | sed "s/%5D/]/g" | sed "s/%3A/:/g" | sed "s/%3B/;/g" | sed "s/%3F/?/g" | sed "s/%2C/,/g" | sed "s/%3C/</g" | sed "s/%3E/>/g"` 
ser=`echo "$QUERY_STRING" | sed -n 's/^.*val_i=\([^&]*\).*$/\1/p' | sed "s/%20/ /g" | sed "s/%40/@/g" | sed "s/%28/(/g" | sed "s/%29/)/g" | sed "s/%25/%/g" | sed "s/%2B/+/g" | sed "s/%23/#/g" | sed "s/%21/!/g" | sed "s/%24/$/g" | sed "s/%5E/^/g" | sed "s/%3D/=/g" | sed "s/%7E/~/g" | sed "s/%7C/|/g" | sed "s/%7B/{/g" | sed "s/%7D/}/g" | sed "s/%5B/[/g" | sed "s/%5D/]/g" | sed "s/%3A/:/g" | sed "s/%3B/;/g" | sed "s/%3F/?/g" | sed "s/%2C/,/g" | sed "s/%3C/</g" | sed "s/%3E/>/g"` 
fi 

echo '<body>' 
echo "<form method=GET action=\"${SCRIPT}\">" 
if [ $rad = "dhcp" ]; then 
echo "<center><input type="radio" name="val_a" value="dhcp" checked> DHCP"\ 
    '<input type="radio" name="val_a" value="static"> Static'\ 
    '<input type="radio" name="val_a" value="pppoe"> PPPoE</center><br>' 
elif [ $rad = "static" ]; then 
echo "<center><input type="radio" name="val_a" value="dhcp"> DHCP"\ 
    '<input type="radio" name="val_a" value="static" checked> Static'\ 
    '<input type="radio" name="val_a" value="pppoe"> PPPoE</center><br>' 
else 
echo "<center><input type="radio" name="val_a" value="dhcp"> DHCP"\ 
    '<input type="radio" name="val_a" value="static"> Static'\ 
    '<input type="radio" name="val_a" value="pppoe" checked> PPPoE</center>     <br>' 
fi 
echo "<table nowrap align="center">"\ 
    '<tr><td>   SSID:</TD><TD><INPUT type="textarea" rows=1 name="val_b" size=12 value="'$ssi'" autofocus></td></tr>'\ 
    '<tr><td> WiFi Password:</td><td><INPUT type="textarea" rows=1 name="val_c" size=12 value="'$key'" maxlength="16" minlength="8"></td></tr>'\ 
    '<table nowrap align="center">'\ 
    '<center>(Password should be of 8 characters)</center>'\ 
    '<tr><td><br> LAN IPaddress:</td><td><br><INPUT type="textarea" rows=1 name="val_j" size=12 value="'$lip'"></td></tr>'\ 
    '<table nowrap align="center" style="border:2px solid;" cellspacing="5" cellpadding="5"><caption>Static Settings:-</caption>'\ 
    '<tr><td> Subnet Mask:</td><td><INPUT type="textarea" rows=1 name="val_d" size=12 value="'$net'"></td></tr>'\ 
    '<tr><td>  IPaddress:</td><td><INPUT type="textarea" rows=1 name="val_e" size=12 value="'$ipa'"></td></tr>'\ 
    '<tr><td>Default Gateway:</td><td><INPUT type="textarea" rows=1 name="val_f" size=12 value="'$gat'"></td></tr><br>'\ 
    '<table nowrap align="center" style="border:2px solid;" cellspacing="5" cellpadding="5"><caption>PPPoE Settings:-</caption>'\ 
    '<tr><td> PPPoE Username:</TD><TD><INPUT type="textarea" rows=1 name="val_g" size=12 value="'$ppu'"></td></tr>'\ 
    '<tr><td> PPPoE Password:</TD><TD><INPUT type="textarea" rows=1 name="val_h" size=12 value="'$ppp'"></td></tr>'\ 
    '<tr><td> Service Name:</TD><TD><INPUT type="textarea" rows=1 name="val_i" size=12 value="'$ser'"></td></tr><br>'\ 
    '</table></table></table>' 

echo '<center><br><input type="submit" style="width:80px;height:35px;" value="Save"></form>' 

# Make sure we have been invoked properly. 
if [ "$REQUEST_METHOD" != "GET" ]; then 
    echo "<hr>Script Error:"\ 
     "<br>Usage error, cannot complete request, REQUEST_METHOD!=GET."\ 
     "<br>Check your FORM declaration and be sure to use METHOD=\"GET\".<hr>" 
    exit 1 
fi 
# If no search arguments, exit gracefully now. 
if [ -z "$QUERY_STRING" ]; then 
    exit 0 
else 
# No looping this time, just extract the data you are looking for with sed: 
rad=`echo "$QUERY_STRING" | sed -n 's/^.*val_a=\([^&]*\).*$/\1/p' | sed "s/%20/ /g" | sed "s/%40/@/g" | sed "s/%28/(/g" | sed "s/%29/)/g" | sed "s/%25/%/g" | sed "s/%2B/+/g" | sed "s/%23/#/g" | sed "s/%21/!/g" | sed "s/%24/$/g" | sed "s/%5E/^/g" | sed "s/%3D/=/g" | sed "s/%7E/~/g" | sed "s/%7C/|/g" | sed "s/%7B/{/g" | sed "s/%7D/}/g" | sed "s/%5B/[/g" | sed "s/%5D/]/g" | sed "s/%3A/:/g" | sed "s/%3B/;/g" | sed "s/%3F/?/g" | sed "s/%2C/,/g" | sed "s/%3C/</g" | sed "s/%3E/>/g"` 
ssi=`echo "$QUERY_STRING" | sed -n 's/^.*val_b=\([^&]*\).*$/\1/p' | sed "s/%20/ /g" | sed "s/%40/@/g" | sed "s/%28/(/g" | sed "s/%29/)/g" | sed "s/%25/%/g" | sed "s/%2B/+/g" | sed "s/%23/#/g" | sed "s/%21/!/g" | sed "s/%24/$/g" | sed "s/%5E/^/g" | sed "s/%3D/=/g" | sed "s/%7E/~/g" | sed "s/%7C/|/g" | sed "s/%7B/{/g" | sed "s/%7D/}/g" | sed "s/%5B/[/g" | sed "s/%5D/]/g" | sed "s/%3A/:/g" | sed "s/%3B/;/g" | sed "s/%3F/?/g" | sed "s/%2C/,/g" | sed "s/%3C/</g" | sed "s/%3E/>/g"` 
key=`echo "$QUERY_STRING" | sed -n 's/^.*val_c=\([^&]*\).*$/\1/p' | sed "s/%20/ /g" | sed "s/%40/@/g" | sed "s/%28/(/g" | sed "s/%29/)/g" | sed "s/%25/%/g" | sed "s/%2B/+/g" | sed "s/%23/#/g" | sed "s/%21/!/g" | sed "s/%24/$/g" | sed "s/%5E/^/g" | sed "s/%3D/=/g" | sed "s/%7E/~/g" | sed "s/%7C/|/g" | sed "s/%7B/{/g" | sed "s/%7D/}/g" | sed "s/%5B/[/g" | sed "s/%5D/]/g" | sed "s/%3A/:/g" | sed "s/%3B/;/g" | sed "s/%3F/?/g" | sed "s/%2C/,/g" | sed "s/%3C/</g" | sed "s/%3E/>/g"` 
lip=`echo "$QUERY_STRING" | sed -n 's/^.*val_j=\([^&]*\).*$/\1/p' | sed "s/%20/ /g" | sed "s/%40/@/g" | sed "s/%28/(/g" | sed "s/%29/)/g" | sed "s/%25/%/g" | sed "s/%2B/+/g" | sed "s/%23/#/g" | sed "s/%21/!/g" | sed "s/%24/$/g" | sed "s/%5E/^/g" | sed "s/%3D/=/g" | sed "s/%7E/~/g" | sed "s/%7C/|/g" | sed "s/%7B/{/g" | sed "s/%7D/}/g" | sed "s/%5B/[/g" | sed "s/%5D/]/g" | sed "s/%3A/:/g" | sed "s/%3B/;/g" | sed "s/%3F/?/g" | sed "s/%2C/,/g" | sed "s/%3C/</g" | sed "s/%3E/>/g"`  
net=`echo "$QUERY_STRING" | sed -n 's/^.*val_d=\([^&]*\).*$/\1/p' | sed "s/%20/ /g" | sed "s/%40/@/g" | sed "s/%28/(/g" | sed "s/%29/)/g" | sed "s/%25/%/g" | sed "s/%2B/+/g" | sed "s/%23/#/g" | sed "s/%21/!/g" | sed "s/%24/$/g" | sed "s/%5E/^/g" | sed "s/%3D/=/g" | sed "s/%7E/~/g" | sed "s/%7C/|/g" | sed "s/%7B/{/g" | sed "s/%7D/}/g" | sed "s/%5B/[/g" | sed "s/%5D/]/g" | sed "s/%3A/:/g" | sed "s/%3B/;/g" | sed "s/%3F/?/g" | sed "s/%2C/,/g" | sed "s/%3C/</g" | sed "s/%3E/>/g"` 
ipa=`echo "$QUERY_STRING" | sed -n 's/^.*val_e=\([^&]*\).*$/\1/p' | sed "s/%20/ /g" | sed "s/%40/@/g" | sed "s/%28/(/g" | sed "s/%29/)/g" | sed "s/%25/%/g" | sed "s/%2B/+/g" | sed "s/%23/#/g" | sed "s/%21/!/g" | sed "s/%24/$/g" | sed "s/%5E/^/g" | sed "s/%3D/=/g" | sed "s/%7E/~/g" | sed "s/%7C/|/g" | sed "s/%7B/{/g" | sed "s/%7D/}/g" | sed "s/%5B/[/g" | sed "s/%5D/]/g" | sed "s/%3A/:/g" | sed "s/%3B/;/g" | sed "s/%3F/?/g" | sed "s/%2C/,/g" | sed "s/%3C/</g" | sed "s/%3E/>/g"` 
gat=`echo "$QUERY_STRING" | sed -n 's/^.*val_f=\([^&]*\).*$/\1/p' | sed "s/%20/ /g" | sed "s/%40/@/g" | sed "s/%28/(/g" | sed "s/%29/)/g" | sed "s/%25/%/g" | sed "s/%2B/+/g" | sed "s/%23/#/g" | sed "s/%21/!/g" | sed "s/%24/$/g" | sed "s/%5E/^/g" | sed "s/%3D/=/g" | sed "s/%7E/~/g" | sed "s/%7C/|/g" | sed "s/%7B/{/g" | sed "s/%7D/}/g" | sed "s/%5B/[/g" | sed "s/%5D/]/g" | sed "s/%3A/:/g" | sed "s/%3B/;/g" | sed "s/%3F/?/g" | sed "s/%2C/,/g" | sed "s/%3C/</g" | sed "s/%3E/>/g"` 
ppu=`echo "$QUERY_STRING" | sed -n 's/^.*val_g=\([^&]*\).*$/\1/p' | sed "s/%20/ /g" | sed "s/%40/@/g" | sed "s/%28/(/g" | sed "s/%29/)/g" | sed "s/%25/%/g" | sed "s/%2B/+/g" | sed "s/%23/#/g" | sed "s/%21/!/g" | sed "s/%24/$/g" | sed "s/%5E/^/g" | sed "s/%3D/=/g" | sed "s/%7E/~/g" | sed "s/%7C/|/g" | sed "s/%7B/{/g" | sed "s/%7D/}/g" | sed "s/%5B/[/g" | sed "s/%5D/]/g" | sed "s/%3A/:/g" | sed "s/%3B/;/g" | sed "s/%3F/?/g" | sed "s/%2C/,/g" | sed "s/%3C/</g" | sed "s/%3E/>/g"` 
ppp=`echo "$QUERY_STRING" | sed -n 's/^.*val_h=\([^&]*\).*$/\1/p' | sed "s/%20/ /g" | sed "s/%40/@/g" | sed "s/%28/(/g" | sed "s/%29/)/g" | sed "s/%25/%/g" | sed "s/%2B/+/g" | sed "s/%23/#/g" | sed "s/%21/!/g" | sed "s/%24/$/g" | sed "s/%5E/^/g" | sed "s/%3D/=/g" | sed "s/%7E/~/g" | sed "s/%7C/|/g" | sed "s/%7B/{/g" | sed "s/%7D/}/g" | sed "s/%5B/[/g" | sed "s/%5D/]/g" | sed "s/%3A/:/g" | sed "s/%3B/;/g" | sed "s/%3F/?/g" | sed "s/%2C/,/g" | sed "s/%3C/</g" | sed "s/%3E/>/g"` 
ser=`echo "$QUERY_STRING" | sed -n 's/^.*val_i=\([^&]*\).*$/\1/p' | sed "s/%20/ /g" | sed "s/%40/@/g" | sed "s/%28/(/g" | sed "s/%29/)/g" | sed "s/%25/%/g" | sed "s/%2B/+/g" | sed "s/%23/#/g" | sed "s/%21/!/g" | sed "s/%24/$/g" | sed "s/%5E/^/g" | sed "s/%3D/=/g" | sed "s/%7E/~/g" | sed "s/%7C/|/g" | sed "s/%7B/{/g" | sed "s/%7D/}/g" | sed "s/%5B/[/g" | sed "s/%5D/]/g" | sed "s/%3A/:/g" | sed "s/%3B/;/g" | sed "s/%3F/?/g" | sed "s/%2C/,/g" | sed "s/%3C/</g" | sed "s/%3E/>/g"` 

t1=$(ifdown wan) 
t2=$(uci set [email protected][1].ssid=$ssi) 
t3=$(uci set [email protected][1].encryption=psk2) 
t4=$(uci set [email protected][1].key=$key) 
t5=$(uci commit wireless) 
t5=$(ifup wan) 
t6=$(wifi) 
t16=$(uci set network.lan.ipaddr=$lip) 
t7=$(uci set network.wan.proto=$rad) 
t8=$(uci set network.wan.username=$ppu) 
t9=$(uci set network.wan.password=$ppp) 
t10=$(uci set network.wan.service=$ser) 
t11=$(uci set network.wan.netmask=$net) 
t12=$(uci set network.wan.ipaddr=$ipa) 
t13=$(uci set network.wan.gateway=$gat) 
t14=$(uci commit network) 
t15=$(/etc/init.d/network restart) 
fi 

echo '</body>' 
echo '</html>' 
exit 0 

只需从html中调用此文件,它将在任何浏览器中打开。
注意: - 对该文件授予777权限,并且不对此文件给予任何扩展名。通过给它的名字保存它。

+0

如果你发现这个有用,然后打勾作为一个权利,所以其他人可以参考这一点。谢谢 –