|
RG100A-BA终于可以设置FTP服务器的用户名 密码和端口啦
先说一下我在论坛求了好多天都没高手理我...............哎
自已动手丰衣足食终于搞迨
好东西要大家分享
知道的就不要看了,因为你们知道却不分享出来太吝啬了
下面是用firebug查到的代码,大家猜猜看是第几行,很简单的.(因为论坛直接发网址要版主审核的.所以........)
<script language="javascript">
1
2<!-- hide
3
4var obj1Items = '0}-{ftpadmin}-{ftpadmin}-{21}-{0}-{telnetadmin}-{telnetadmin}-{23}-{|,|FtpEnable}-{FtpUserName}-{FtpPassword}-{FtpPort}-{TelnetEnable}-{TelnetUserName}-{TelnetPassword}-{TelnetPort}-{|,|';
5var downloadinfo = '0|';
6var usblist = '';
7var obj1Cols = numOfCol(obj1Items);
8/* NOTICE: MDMOID_SERVICE_MANAGE is Type0 object, follow variables are single value */
9var ftpEnable = getValueFromList(obj1Items, 0);
10
11
12var list = usblist.split("|");
13var lenth = downloadinfo.split("|");
14var downloadstatus = lenth[0];
15function btnFtpcfg() {
16
17 var loc = 'ftpcfg.html';
18
19 var code = 'location="' + loc + '"';
20
21 eval(code);
22
23}
24
25function btnRefrech(){
26var loc = 'usbxdown.html';
27
28 var code = 'location="' + loc + '"';
29
30 eval(code);
31}
32
33function toUtf8(code)
34
35{
36
37 var iByte=0;
38
39 var i=0;
40
41 result="";
42
43 while(code > 0x7f)
44
45 {
46
47 iByte=code%0x40;
48
49 code=(code-iByte)/0x40;
50
51 result="%"+(iByte|0x80).toString(16).toUpperCase()+result;
52
53 i++;
54
55 }
56
57 prefix=[0x0,0xc0,0xe0,0xf0,0xf8,0xfc];
58
59 if(i>prefix.length)
60
61 {
62
63 i=5;
64
65 }
66
67 result="%"+(code|prefix[i]).toString(16).toUpperCase()+result;
68
69 return result;
70
71}
72
73function chr2Unicode(str)
74
75{
76
77 if ('' != str) {
78
79 var st, t, i;
80
81 st = '';
82
83 for (i = 1; i <= str.length; i ++){
84
85 t = str.charCodeAt(i - 1).toString(16);
86
87 if (t.length < 4)
88
89 while(t.length <4)
90
91 t = '0'.concat(t);
92
93 t = t.slice(0, 2).concat(t.slice(2, 4))
94
95 st = st.concat(t);
96
97 }
98
99 return('0x' + st.toUpperCase());
100
101 }
102
103 else {
104
105 return('');
106
107 }
108
109}
110
111function GB2312toUTF_8(str)
112
113{
114
115 if(str.charAt(0)=='f' && str.charAt(1)=='t' && str.charAt(2) == 'p')
116
117 return str;
118
119 var result = "";
120
121 for(var i=0; i<str.length; i++)
122
123 {
124
125 var uni = chr2Unicode(str.charAt(i));
126
127 if(uni <= 0x7f)
128
129 result = result + str.charAt(i);
130
131 else
132
133 result = result + toUtf8(uni);
134
135 }
136
137 return result;
138
139}
140
141function getfilename(str)
142
143{
144
145 var result = "";
146
147 for(var i=str.length-1; i>=0; i--)
148
149 {
150
151 if(str.charAt(i) == '/' || str.charAt(i) == '\\')
152
153 {
154
155 result = str.substr(i+1, str.length-i-1);
156
157 break;
158
159 }
160
161 }
162
163 return result;
164
165}
166
167
168function avaidftpurl(str)
169{
170
171 var t = 0,q = 0;
172 if(str.charAt(0)!='f' || str.charAt(1)!='t' || str.charAt(2) != 'p'
173 || str.charAt(3)!=':' || str.charAt(4) != '/'|| str.charAt(5) != '/')
174 {
175 return false;
176 }
177
178 for(var i=0; i< str.length-1; i++)
179 {
180
181 if(str.charAt(i) == '/' )
182 {
183 t++;
184 }
185
186 if(str.charAt(i) == ':' )
187 {
188 q++;
189 }
190 }
191
192 if(t < 3)
193 return false;
194 if(q != 1)
195 return false;
196
197 return true;
198
199}
200
201function btnApply()
202{
203 with ( document.forms[0] ) {
204 if(username.value == '')
205 {
206 alert("用户名不能为空");
207 return;
208 }
209 if(password.value == '')
210 {
211 alert("密码不能为空");
212 return;
213 }
214 if(port.value == '')
215 {
216 alert("端口号不能为空");
217 return;
218 }
219 if(port.value < 0 ||port.value >65535)
220 {
221 alert("端口号必须在0--65535范围内");
222 return;
223 }
224 if(remoteUrl.value == '')
225 {
226 alert("Url不能为空");
227 return;
228 }
229
230 if(!avaidftpurl(remoteUrl.value))
231 {
232 alert("Url错误,必须是ftp://xxx/filename的格式");
233 return;
234 }
235
236 var loc = 'usbxdown.cmd?action=add&';
237 loc += 'localdev=' + devpathlist[devpathlist.selectedIndex].value;
238 var result = GB2312toUTF_8(remoteUrl.value);
239 loc += '&remoteUrl=' + result;
240 var filename = getfilename(remoteUrl.value);
241 loc += '&filename=' + filename;
242 if(username.value == '') username.value='anonymous';
243 loc += '&username=' + username.value;
244 loc += '&password=' + password.value;
245 loc += '&port=' + port.value;
246}
247var code = 'location="' + loc + '"';
248eval(code);
249}
250
251function frmLoad() {
252 with ( document.forms[0] ) {
253
254 }
255}
256// done hiding --> |
|