顯示文章

這裡允許您檢視這個會員的所有文章。請注意, 您只能看見您有權限閱讀的文章。


文章 - NARs

頁: 1 2 [3] 4 5 ... 8
61
網頁技術 / Re: PHP下載檔案毁損?
« 於: 2011-08-17 15:38 »
修改了一下,檔案下載的大小是1KB,
用notepad的訊息是success

62
網頁技術 / Re: PHP下載檔案毁損?
« 於: 2011-08-17 15:16 »


放到notepad 沒有任何訊息,用壓縮檔解壓會出現錯誤訊息:"這個壓縮檔不是未知的格式就是損壞"
檢查 error log也沒有任何錯誤訊息

63
網頁技術 / PHP下載檔案毁損?
« 於: 2011-08-17 14:52 »
各位大大,
在用PHP下載test.zip檔案後,檔案的大小都只有1KB,而且下載後也毁損不能打開,請問是那錯了嗎?


代碼: [選擇]
<?php
if(empty($_GET[&#39;path&#39;]) || empty($_GET[&#39;filename&#39;]))
{
   echo &
#39;error path&#39;;
   
exit();
}

if(
file_exists($_GET[&#39;path&#39;]))
{
   
$FILEname urlencode($_GET[&#39;filename&#39;]);

   
if(ini_get(&#39;zlib.output_compression&#39;))
      
ini_set(&#39;zlib.output_compression&#39;, &#39;Off&#39;);

   
header("Content-Type: application/octetstream; name=$FILEname"); //for IE & Opera

   
header("Content-Type: application/octet-stream; name=$FILEname"); //for the rest

   
header("Content-Disposition: attachment; filename=$FILEname;");

   
header("Content-Transfer-Encoding: binary");

header("Content-Type: application/zip");

   
header("Cache-Control: cache, must-revalidate");
   
header("Pragma: public");
   
header("Last-Modified: " gmdate("D, d M Y H:i:s") . "GMT");

   
readfile($_GET[&#39;path&#39;]);
        
echo "success";
}
else
   echo &
#39;file doesnt exist&#39;;
?>

64
網頁技術 / Re: PHP下載檔案?
« 於: 2011-08-16 14:01 »
了解~~google到的做法也是像大大說的,感謝!

65
網頁技術 / Re: PHP下載檔案?
« 於: 2011-08-16 13:10 »
可是使用者在網站上點選下載,client端怎麼指定下載檔案路徑??

對不起,我的意思是當使用者,
http://192.168.1.1/ftpdownload.php
檔案不是下載到end user ?

66
網頁技術 / Re: PHP下載檔案?
« 於: 2011-08-16 12:11 »
可是使用者在網站上點選下載,client端怎麼指定下載檔案路徑??

67
網頁技術 / Re: PHP下載檔案?
« 於: 2011-08-16 11:50 »
在shell下執行FTP是OK的

68
網頁技術 / Re: PHP下載檔案?
« 於: 2011-08-16 10:17 »
俺是博士:
檢查了error log,訊息:

 ftp_get(server.zip): failed to open stream: Permission denied in /var/www/mysite/phpFTP.php on line 23
[Tue Aug 16 10:06:45 2011] [error] [client 2001:e10:2000:d1:e260:ad69:eab8:d8eb] PHP Warning:  ftp_get(): Error opening server.zip in //var/www/mysite/phpFTP.php on line 23


這是目的地檔案的權限問題嗎?FTP上要下載的檔案已經設成700了

69
網頁技術 / Re: PHP下載檔案?
« 於: 2011-08-16 09:51 »
俺是博士:
看起來也都沒什麼錯哩,可是還是不能下載檔案?

網頁訊息:
Current directory is now: /DOWNLOAD
There was a problem

70
網頁技術 / Re: PHP下載檔案?
« 於: 2011-08-16 09:25 »
俺是博士:
FTPY上是有這個目錄,因為我已經用
ftp_chdir($conn_id, "DOWNLOAD") 移到DOWNLOAD資料夾,(印出來的結果 : Current directory is now: /DOWNLOAD)
請問是那裡有錯嗎?

71
網頁技術 / PHP下載檔案?
« 於: 2011-08-15 19:10 »
請問各位大大,
連接沒有問題,可是一直不能下載檔案,請問這是有那裡錯了嗎?

代碼: [選擇]


<?php

// define some variables
$local_file "local.zip";
$server_file "server.zip";
$ftp_user_name="user";
$ftp_user_pass="userpass";
$ftp_server="192.168.1.1";
$port "3837";
// set up basic connection
$conn_id ftp_connect($ftp_server,$port);

// login with username and password
$login_result ftp_login($conn_id$ftp_user_name$ftp_user_pass);
// uncomment if you need to change directories
if (ftp_chdir($conn_id"DOWNLOAD")) {
    echo 
"Current directory is now: " ftp_pwd($conn_id) . "\n";
} else {
    echo 
"Couldn&#39;t change directory\n";
}


// try to download $server_file and save to $local_file
if (ftp_get($conn_id$local_file$server_fileFTP_BINARY)) {
    echo 
"Successfully written to $local_file\n";
} else {
    echo 
"There was a problem\n";
}

// close the connection
ftp_close($conn_id);

?>


72
Linux 討論版 / Re: tomcat connector ?
« 於: 2011-08-15 10:36 »
感謝~~成功了 ^^

73
Linux 討論版 / tomcat connector ?
« 於: 2011-08-11 19:43 »
因為我的伺服器要同時應用PHP與JSP,卻又希望同時使用80 port,如果是把sample.jsp 放在var/lib/tomcat6/webapps/ROOT/中是可以執行的,但是如果放在我所指定的virtual host 網站目錄中是不能執行的,但是PHP是可以執行的,請各位高手救救我.........


OS: ubuntu
*在 /etc/apache2/sites-enabled/000-default 定義的virtual host 是在/usr/local/mysites


74
網頁技術 / 下載檔案存放的位置?
« 於: 2011-08-11 14:27 »
各位大大,
因為要透過javascript 去呼叫java ,java程式需要下載檔案到client端,所以要傳入儲存的位置參數給JAVA,但是因為client端作業系統的不同,所以無法事先指定client端的下載位置,請問是要取得瀏覽器執行的位置當作下載位置?還是各位大大有更好的方法?

75
當我用webmin時可以順利的連到mysql資料庫,也可以作所有的事情。
可是當我用phpmyadmin或自己寫的php程式想要連結到mysql時都會出現錯誤訊息,
查了mysql 的error log 訊息是:
[Mon Jul 25 19:21:17 2011] [error] [client 192.168.1.1] PHP Warning:  mysql_connect(): Access denied for user 'www-data'@'localhost' (using password: NO) in /usr/local/testSite/connect_DB.php on line 14

請問這是什麼原因呢?

76
網頁技術 / HTTP 404.3–Not Found.錯誤
« 於: 2011-07-21 20:45 »
執行http://localhost/phpinfo.php 出現以下網頁錯誤訊息:

應用程式 "DEFAULT WEB SITE" 中有伺服器錯誤

Internet Information Services 7.5
錯誤摘要
HTTP 錯誤 404.3 - Not Found
因為網頁伺服器上設定的多用途網際網路郵件延伸標準 (MIME) 對應原則,而無法提供您要求的網頁。如果此網頁為指令碼,請新增處理常式,而且如果它是應該要下載的檔案,請新增 MIME 對應。



目錄下也有phpinfo.php檔案,請問這是什麼原因?


77
網頁技術 / Re: 如何呼叫執行applet ?
« 於: 2011-07-18 19:14 »
Yamaka大大,
我是想要清除applet,但是不能回到map,難道要把map再重新寫一遍嗎 ?


代碼: [選擇]
<html>
<body>
<div id="mymap" style="width: 500px; height: 500px"></div>

<SCRIPT>

var map = new GMap(document.getElementById("mymap"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());

map.setCenter(new GLatLng(51.6500, 6.1833), 16);
var marker = new GMarker(new GLatLng(51.6500,6.1833));
GEvent.addListener(map, "click", function(marker, point) {
                                   if (marker) { document.getElementById('mymap').innerHTML=' <applet width=500 height=500 code=myapp.class ARCHIVE=./apps/myapp.jar > <PARAM NAME=testingServer VALUE=tool1> <PARAM NAME=U VALUE=nars> </applet>';

...........
<button onclick="document.getElementById('mymap').innerHTML='';">Back to map</button>
//這樣只能清除applet,但是不能回到map,難道要把map再重新寫一遍嗎????????



78
網頁技術 / Re: 如何呼叫執行applet ?
« 於: 2011-07-15 18:06 »
各位大大 ..
想再新增一個按鈕,要回到上一頁,也就是還沒下載applet的頁面 , 但是試不成功,請問是那裡錯了嗎?
代碼: [選擇]
<html>
<head>
<title>Java Applet 測試</title>
</head>
<body>
<div id="japp2"></div>

<button onclick="document.getElementById('japp2').innerHTML='<applet width=733 height=326 code=myjava.class ARCHIVE=./site/myjava.jar >  <PARAM NAME=testingServer VALUE=applettest><PARAM NAME=U VALUE=nars>
 
</applet>';">Click Me #2</button>
<form>
<input type="button" value="Back" onclick="history.back()">   //這個按鈕要回到上一頁,也就是還沒下載applet的頁面,請問有錯嗎???????
</form>

</body>
</noframes>
</html>



79
網頁技術 / Re: 如何呼叫執行applet ?
« 於: 2011-07-13 20:38 »
fillano大大~感謝!成功了

80
網頁技術 / Re: 如何呼叫執行applet ?
« 於: 2011-07-13 17:44 »
Yamaka大大,
感謝你的範例,照你的範例可以順利執行我的JAR,但是加入要傳入jar 的參數,不能執行 , 請問題那裡錯了嗎?

代碼: [選擇]
<html>
<head>
<title>Java Applet 測試</title>
</head>
<body>
<div id="japp2"></div>

<button onclick="document.getElementById('japp2').innerHTML='<applet width=733 height=326 code=myjava.class ARCHIVE=./site/myjava.jar >
  <PARAM NAME=testingServer VALUE=applettest>
  <PARAM NAME=U VALUE=nars>
 //加入參數,卻不能執行???????
</applet>';">Click Me #2</button>
</body>
</noframes>
</html>


81
網頁技術 / 如何呼叫執行applet ?
« 於: 2011-07-11 19:37 »
hi ,
當我click map 上的marker , 要如何呼叫執行applet ?


代碼: [選擇]
<html>
<body>
<div id="mymap" style="width: 500px; height: 500px"></div>

<SCRIPT>

var map = new GMap(document.getElementById("mymap"));
map.addControl(new GSmallMapControl());
map.addControl(new GMapTypeControl());

map.setCenter(new GLatLng(51.6500, 6.1833), 16);
var marker = new GMarker(new GLatLng(51.6500,6.1833));
GEvent.addListener(map, "click", function(marker, point) {
   
             //  要如何呼叫執行applet ? ????
});
map.addOverlay(marker);
</SCRIPT>
<APPLET CODE="InJava2.class"
        NAME="myApplet"
        HEIGHT=500 WIDTH=500 >
</APPLET>

要如何在點選map上的marker時,map會去呼執行applet ,是要用href的方式嗎?(map的大小和apple的大小是一樣的)

82

Yamaka大大,

<applet code=Contact.class ARCHIVE="./Cpt/Contact.jar"
width=733 height=326 >
<param name="myName" value="myparameter">
</applet>

有試著在 Contact.java 內用

String myName = this.getParameter("myName");


可是這是要在一開始的main中就要傳入的參數,但是this並不能在static中使用
Contact.java :
代碼: [選擇]
public static void main(String[] args)
{
     .................
     String myName = this.getParameter("myName");   // Cannot use this in a static context
}



請問有什麼辦法可解嗎?

83
網頁技術 / 如何在HTML中傳遞參數給applet ?
« 於: 2011-06-15 18:40 »
這段程式碼是在HTML中呼叫JAR執行,
但是如果是在command line 下執行的話,是 java -jar Contact.jar google.com.tw
但是在HTML中如果要傳遞參數給JAR檔執行的話,在要如何傳遞給JAR?



代碼: [選擇]
<applet code=Contact.class ARCHIVE="./Cpt/Contact.jar"
   width=733 height=326 >
</applet>

84
網頁技術 / 無法顯示框架?
« 於: 2011-05-30 16:32 »
各位大大,
這是我測試的程式碼,可是為什麼無法同時顯示這三個網頁?
代碼: [選擇]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>頁框測試</title>
</head>

<frameset rows="80,*,20%" >
  <frame src="http://tw.yahoo.com" name="topFrame" scrolling="No" noresize="noresize" id="topFrame" title="topFrame" />
  <frame src="http://www.google.com.tw" name="mainFrame" id="mainFrame" title="mainFrame" />
  <frame src="http://www.pchome.com.tw" name="bottomFrame" scrolling="No" noresize="noresize" id="bottomFrame" title="bottomFrame" />
</frameset>
<noframes>
<body>
抱歉,你的網頁並不支援頁框,因此你無法正確的看到網頁內容
</body>
</noframes>
</html>


測試執行的結果:


85
database 討論版 / mysql存取權限問題?
« 於: 2011-04-25 11:54 »
各位大大:
當我使用root登入mysql後( mysql -h [DB_IP] -u root -p),可以順利登入,
但是當我想要新增來自host的帳號user,並指定datab_name資料庫,並給予全部權限

# GRANT ALL PRIVILEGES ON datab_name.* TO user@host IDENTIFIED BY 'passwd';

可是卻會出現錯誤訊息:
ERROR 1044 (42000): Access denied for user 'root'@'%' to database 'datab_name'

請問這要怎麼解決呢??

86
各位大大請問一下......
用applet連資料庫,在eclipse中寫 applet時,執行連資料庫都ok,在command line下打java -jar 執行.jar,p也可以正常存取資料庫,但是一但布署到網頁上時 ,卻不能存取資料庫

這裡有個國外的網站
它展示的東西,就是我要的樣子...

http://tecfa.unige.ch/guides/java/staf2x/ex/jdbc/coffee-break/query-applet/MySqlUpdateSwingApplet.html

我的環境是
java version "1.6.0_22"
Ubuntu 10.10
Apache/2.2.16 (Ubuntu)
mysql 5.1.41-3ubuntu12.10

但是要怎麼發到網頁去,讓applet在網頁也能連接資料庫.....

87
各位大大
我想取得本機的TCP buffer size,但是取出來的結果,和rmem_max檔案的結果卻不一樣?

代碼: [選擇]
# cat /proc/sys/net/core/rmem_max
131071
 




代碼: [選擇]
public static void bufSize()
{
Socket destSocket = new Socket();
String destHost="127.0.0.1";
int destPort=3784;
InetSocketAddress sa = new InetSocketAddress(destHost,destPort);

System.out.println("destHost: " + destHost + ", destPort: " +
destPort);
try {
System.out.println(destSocket.getReceiveBufferSize ());    // 印出的值 43690
System.out.println(destSocket.getSendBufferSize()) ;         // 印出的值 8192
} catch (SocketException e) {

e.printStackTrace();
}
}


88
網頁技術 / 如何取得VPN所配發client的IP ?
« 於: 2010-11-02 15:40 »
如何取得VPN所配發client的IP ?
因為用$_SERVER["REMOTE_ADDR"]得到的都不是VPN所配發的IP ??

89
Yamaka 大大~
$_SERVER["HTTP_USER_AGENT"]可以直接用
感謝~~~

90
各位大大,


代碼: [選擇]
<form name="aaa" id="aaa" action="newWindow.php" onsubmit="return check_data();" method="post" target="_blank" >
用window.open好像速度會比較慢.
要怎麼控制新開的視窗大小??

頁: 1 2 [3] 4 5 ... 8