<?
include "../inc/config.php";
include "../../inc/inc.php";
//---------------------文件上传---------------------------------------
//取得当前日期信息,并连接成为一个字符串
$time = date('ymdhms');
//上传文件的存储目录
$uploaddir="./../uploadfiles/";
//得到上传文件的扩展名
function extend($file_name)
{
$extend =explode("." , $file_name);
$va=count($extend)-1;
return $extend[$va];
}
$file_name=extend($_FILES["upfilepic"]["name"]);
//文件上传后全路径名称
$uploadfile=$uploaddir.$time.".".$file_name;
$pic=$time.".".$file_name;
move_uploaded_file($_FILES["upfilepic"]["tmp_name"],$uploadfile);
//---------------------------------------------------------------------
//插入记录
$sql="INSERT INTO links (name,pic,pictype,url,typeid,width,height,ctid) VALUES ('".$_POST['name']."','$pic','".$_POST['pictype']."','".$_POST['url']."','".$_POST['typeid']."','".$_POST['width']."','".$_POST['height']."','".$_POST['ctid']."')";
$result=mysql_query($sql);
if($result)
{
//页面跳转
$ctid=$_POST['ctid'];
$result_sub=mysql_query("select * from functions where ctid=$ctid");
$date_sub=mysql_fetch_array($result_sub);
$url="../".$date_sub['url']."?"."ctid=".$date_sub['ctid'];
echo "<SCRIPT LANGUAGE='Javascript'>";
echo "location.href='$url'";
echo "</SCRIPT>";
}
else
{
echo $eor;
}
?>