<?php
require("../../class/connect.php");
include("../../class/db_sql.php");
include("../../class/config.php");
include("../../class/functions.php");
$link=db_connect();
$empire=new mysqlquery();
$logininid=(int)$_GET['userid'];
$loginin=$_GET['username'];
$loginrnd=$_GET['rnd'];
$classid=(int)$_GET['classid'];
$filepass=(int)$_GET['filepass'];
$type=$_GET['type'];
$doing=$_GET['doing'];
$editor=1;
is_login($logininid,$loginin,$loginrnd);
db_close();
$empire=null;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>上传</title>
<link href="../../data/images/css.css" rel="stylesheet" type="text/css">
<script>
function ExpStr(str,exp){
	var pos,len,ext;
	pos=str.lastIndexOf(exp)+1;
	len=str.length;
	ext=str.substring(pos,len);
	return ext;
}
//返回编号
function ReturnFileNo(){
	var filename,str,exp;
	if(document.form1.file.value!='')
	{
		str=document.form1.file.value;
	}
	else
	{
		str=document.form1.tranurl.value;
	}
	if(str.indexOf("\\")>=0)
	{
		exp="\\";
	}
	else
	{
		exp="/";
	}
	filename=ExpStr(str,exp);
	document.form1.no.value=filename;
}
function DoInsertUrl(str){
	if(str=="http://")
	{
		alert('请输入要插入的连接');
	    return false;
	}
pos=str.lastIndexOf(".")+1;
len=str.length;
ext=str.substring(pos,len);
if((ext == "gif")||(ext == "jpg")||(ext == "jepg")||(ext == "png")||(ext == "bmp"))
	{
	parent.TInsertFile("<img src='"+str+"' border=0>");
	}
else if(ext=="swf")
	{
		parent.TInsertFile("<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" name=\"movie\" width=\"400\" height=\"350\" id=\"movie\"><param name=\"movie\" value=\""+str+"\"><param name=\"quality\" value=\"high\"><param name=\"menu\" value=\"false\"><embed src=\""+str+"\" width=\"400\" height=\"350\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" id=\"movie\" name=\"movie\" menu=\"false\"></embed></object>");
     }
else if((ext == "wmv")||(ext == "asf")||(ext == "wma")||(ext == "mp3"))
	{
	parent.TInsertFile("<object align=middle classid=\"CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95\" class=OBJECT id=MediaPlayer width=480 height=360><PARAM NAME=AUTOSTART VALUE=true><param name=ShowStatusBar value=-1><param name=Filename value=\""+str+"\"><embed type=\"application/x-oleobject codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701\" flename=mp src=\""+str+"\" width=480 height=360></embed></object>");
    }
else if((ext == "rm")||(ext == "ra")||(ext == "rmvb")||(ext == "mp4")||(ext == "mov")||(ext == "avi")||(ext == "wav")||(ext == "ram")||(ext == "mpg")||(ext == "mpeg"))
	{
	parent.TInsertFile("<object classid=\"clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA\" HEIGHT=360 ID=Player WIDTH=480 VIEWASTEXT><param NAME=_ExtentX VALUE=12726><param NAME=_ExtentY VALUE=8520><param NAME=AUTOSTART VALUE=1><param NAME=SHUFFLE VALUE=0><param NAME=PREFETCH VALUE=0><param NAME=NOLABELS VALUE=0><param NAME=CONTROLS VALUE=ImageWindow><param NAME=CONSOLE VALUE=_master><param NAME=LOOP VALUE=0><param NAME=NUMLOOP VALUE=0><param NAME=CENTER VALUE=0><param NAME=MAINTAINASPECT VALUE=\""+str+"\"><param NAME=BACKGROUNDCOLOR VALUE=\"#000000\"></object><br><object CLASSID=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA HEIGHT=32 ID=Player WIDTH=480 VIEWASTEXT><param NAME=_ExtentX VALUE=18256><param NAME=_ExtentY VALUE=794><param NAME=AUTOSTART VALUE=1><param NAME=SHUFFLE VALUE=0><param NAME=PREFETCH VALUE=0><param NAME=NOLABELS VALUE=0><param NAME=CONTROLS VALUE=controlpanel><param NAME=CONSOLE VALUE=_master><param NAME=LOOP VALUE=0><param NAME=NUMLOOP VALUE=0><param NAME=CENTER VALUE=0><param NAME=MAINTAINASPECT VALUE=0><param NAME=BACKGROUNDCOLOR VALUE=\"#000000\"><param NAME=SRC VALUE=\""+str+"\"></object>");
    }
else
	{
	parent.TInsertFile("<a href='"+str+"'>"+str+"</a>");
	}
}
</script>
</head>

<body>
<form action="<? echo"../enews.php?userid=$logininid&username=$loginin&rnd=$loginrnd";?>" method="post" enctype="multipart/form-data" name="form1" onsubmit="return ReturnFileNo();">
        
  <table width="99%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#698CC3">
    <input type=hidden name=classid value="<?=$classid?>">
	<input type=hidden name=filepass value="<?=$filepass?>">
    <input type=hidden name=enews value="TranFile">
    <input type=hidden name=type value="<?=$type?>">
    <input type=hidden name=doing value="<?=$doing?>">
    <tr> 
      <td colspan="2"><strong><font color="#FFFFFF">上传</font></strong></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td>直接链接地址<br>
        (图片/链接)：</td>
      <td><input name="inserturl" type="text" id="inserturl" value="http://" size="32"> 
        <input type="button" name="Submit2" value="插入" onclick="DoInsertUrl(document.form1.inserturl.value);"></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td width="22%">远程保存：</td>
      <td width="78%"><input name="tranurl" type="text" id="tranurl" value="http://" size="32"></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td>本地上传：</td>
      <td><input type="file" name="file">
        <input name="getmark" type="checkbox" id="getmark" value="1">
        <a href="../SetEnews.php" target="_blank">加水印</a></td>
    </tr>
    <tr bgcolor="#FFFFFF">
      <td>&nbsp;</td>
      <td><input name="getsmall" type="checkbox" id="getsmall" value="1">
        同时生成缩略图. 缩图宽度: 
        <input name="width" type="text" id="width" value="<?=$public_r['spicwidth']?>" size="6">
        * 高度: 
        <input name="height" type="text" id="height" value="<?=$public_r['spicheight']?>" size="6"></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td>文件编号：</td>
      <td><input name="no" type="text" id="no" value="<?=$_GET['fileno']?>"> <input type="submit" name="Submit" value="上传"></td>
    </tr>
    <tr bgcolor="#FFFFFF"> 
      <td colspan="2">说明：可上传的文件： 
        <?=$public_r[filetype]?>
        ，最大容量： 
        <?=$public_r[filesize]?>
        KB(本地比远程优先)</td>
    </tr>
  </table>
      </form>
</body>
</html>
