<html xmlns="http://www.w3.org/1999/xhtml"><!--STATUS OK-->
<head><meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8"/><meta http-equiv="Cache-control" content="no-cache" /><style type="text/css">body{font-size:medium;line-height:1.6em;text-align:center}img{border:0}form{margin:0;padding:0}.a{padding-top:6px;margin-top:6px;margin-bottom:6px}.h{color:#c60a00}.s{font-size:small}.b{font-size:small;color:#77C}</style>
<title>Calpuff Web Client</title>
<link rel="Shortcut Icon" href="favicon.ico" /><!--地址栏和标签上显示图标-->
<link rel="Bookmark" href="favicon.ico" /><!--收藏夹显示图标-->
</head>
<body bgcolor="ghostwhite">
<img src="../images/calpuff_logo.jpg" height="60" alt="Calpuff Web Client"/>
<table align="center">
<th><font color="blue">Welcome To Calpuff Web Client</font> </th>
</table>
<br/>
<?php
// 获取各个参数
// 除了文件这个参数全部都获取过来
$modelname=$_POST['modelname'];
$startdate=date("Y-m-d");
$enddate=date("Y-m-d");
$xrefkm=0;
$yrefkm=0;
$nx=0;
$ny=0;
$dgridkm=0;
$identifier="";
$gtopo30="";
$glazas="";
$identifier=$_POST['identifier'];
$sql="";
$con = mysql_connect("rdsci9uvwqcq7vp48n90j.mysql.rds.aliyuncs.com","<span style="font-family: Arial, Helvetica, sans-serif;">xxx</span><span style="font-family: Arial, Helvetica, sans-serif;">","</span><span style="font-family: Arial, Helvetica, sans-serif;">xxx</span><span style="font-family: Arial, Helvetica, sans-serif;">");</span>
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("db_wrf", $con);
// 先获取污染源文件
if($modelname=="calpuff")
{
$xrefkm=$_POST['xrefkm'];
$yrefkm=$_POST['yrefkm'];
$nx=$_POST['nx'];
$ny=$_POST['ny'];
$dgridkm=$_POST['dgridkm'];
$gtopo30=createPath($_POST['gtopo30']);
$glazas=createPath($_POST['glazas']);
$startdate=$_POST['startdate'];
$enddate=$_POST['enddate'];
// for calpuff:srcfole
$error = $_FILES['srcfile']['error'];
$tmp_name = $_FILES['srcfile']['tmp_name'];
$size = $_FILES['srcfile']['size'];
$name = $_FILES['srcfile']['name'];
$type = $_FILES['srcfile']['type'];
if ($error == UPLOAD_ERR_OK && $size > 0)
{
$fp = fopen($tmp_name, 'r');
$srcfile = fread($fp, $size);
fclose($fp);
$srcfile = addslashes($srcfile);
$sql="insert into t_calpuf_conf (startdate,enddate,xrefkm,yrefkm,nx,ny,dgridkm,identifier,modelname,gtopo30,glazas,done,srcfile)
values(\"$startdate\",\"$enddate\",\"$xrefkm\",\"$yrefkm\",\"$nx\",\"$ny\",\"$dgridkm\",\"$identifier\",\"$modelname\",\"$gtopo30\",\"$glazas\",0,'$srcfile')";
}
}
else if($modelname=="terrel")
{
$xrefkm=$_POST['xrefkm'];
$yrefkm=$_POST['yrefkm'];
$nx=$_POST['nx'];
$ny=$_POST['ny'];
$dgridkm=$_POST['dgridkm'];
$gtopo30=createPath($_POST['gtopo30']);
$sql="insert into t_calpuf_conf (xrefkm,yrefkm,nx,ny,dgridkm,identifier,modelname,gtopo30,done)
values(\"$xrefkm\",\"$yrefkm\",\"$nx\",\"$ny\",\"$dgridkm\",\"$identifier\",\"$modelname\",\"$gtopo30\",0)";
}
else if($modelname=="ctgproc")
{
$xrefkm=$_POST['xrefkm'];
$yrefkm=$_POST['yrefkm'];
$nx=$_POST['nx'];
$ny=$_POST['ny'];
$dgridkm=$_POST['dgridkm'];
$glazas=createPath($_POST['glazas']);
$sql="insert into t_calpuf_conf (xrefkm,yrefkm,nx,ny,dgridkm,identifier,modelname,glazas,done)
values(\"$xrefkm\",\"$yrefkm\",\"$nx\",\"$ny\",\"$dgridkm\",\"$identifier\",\"$modelname\",\"$glazas\",0)";
}
else if($modelname=="makegeo")
{
$xrefkm=$_POST['xrefkm'];
$yrefkm=$_POST['yrefkm'];
$nx=$_POST['nx'];
$ny=$_POST['ny'];
$dgridkm=$_POST['dgridkm'];
$gtopo30=createPath($_POST['gtopo30']);
$glazas=createPath($_POST['glazas']);
$sql="insert into t_calpuf_conf (xrefkm,yrefkm,nx,ny,dgridkm,identifier,modelname,gtopo30,glazas,done)
values(\"$xrefkm\",\"$yrefkm\",\"$nx\",\"$ny\",\"$dgridkm\",\"$identifier\",\"$modelname\",\"$gtopo30\",\"$glazas\",0)";
}
else if($modelname=="calwrf")
{
$startdate=$_POST['startdate'];
$enddate=$_POST['enddate'];
$sql="insert into t_calpuf_conf (startdate,enddate,identifier,modelname,done)
values(\"$startdate\",\"$enddate\",\"$identifier\",\"$modelname\",0)";
}
else if($modelname="calmet")
{
$xrefkm=$_POST['xrefkm'];
$yrefkm=$_POST['yrefkm'];
$nx=$_POST['nx'];
$ny=$_POST['ny'];
$dgridkm=$_POST['dgridkm'];
$gtopo30=createPath($_POST['gtopo30']);
$glazas=createPath($_POST['glazas']);
$startdate=$_POST['startdate'];
$enddate=$_POST['enddate'];
$sql="insert into t_calpuf_conf (startdate,enddate,xrefkm,yrefkm,nx,ny,dgridkm,identifier,modelname,gtopo30,glazas,done)
values(\"$startdate\",\"$enddate\",\"$xrefkm\",\"$yrefkm\",\"$nx\",\"$ny\",\"$dgridkm\",\"$identifier\",\"$modelname\",\"$gtopo30\",\"$glazas\",0)";
}
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "<br/>";
echo "<strong>Submit Success!</strong>";
echo "<br/>";
echo "<a href=\"index.php\"><strong>I Need To Submit A New Task</strong></a>";
echo "<br/>";
mysql_close($con);
echo "<br/>";
//----------------------
echo "<strong>All the tasks in the processing queue:</strong>";
echo "<br/>";
$con = mysql_connect("rdsci9uvwqcq7vp48n90j.mysql.rds.aliyuncs.com","xxx","xxx");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
else
{
mysql_select_db("db_wrf", $con);
$result = mysql_query("SELECT * FROM t_calpuf_conf where done=0");
while($row = mysql_fetch_array($result))
{
echo "[identifier]: ".$row['identifier'].
" [modelname]: ".$row['modelname'].
" [id]:".$row['id'] .
" [startdate]: " .$row['startdate'].
" [enddate]: ".$row['enddate'].
" [xrefkm]: ".$row['xrefkm'] .
" [yrefkm]: ".$row['yrefkm'] .
" [nx]: ".$row['nx'] .
" [ny]: ".$row['ny'] .
" [dgridkm]: ".$row['dgridkm'].
" [gtopo30]: ".getFilename($row['gtopo30']).
" [glazas]: ".getFilename($row['glazas']);
echo "<br />";
}
mysql_close($con);
}
?>
</body>
</html>
<?php
function getFilename($path)
{
$index=0;
$length=strlen($path);
for($i=0;$i<$length;$i++)
{
if($path[$length-$i]=="\\")
{
$index=$length-$i;
break;
}
}
$index++;
return substr($path,$index,$length-$index);
}
function createPath($path)
{
return addslashes($path);
}
?>
Calpuff-WebClient-webclient.php
最新推荐文章于 2024-03-22 08:30:34 发布