Warning: mkdir() [function.mkdir]: No such file or directory in C:\AppServ\www\home\admin\functions.php on line 24
Warning: move_uploaded_file(home/intnews/2010-3-11/cmd.txt) [function.move-uploaded-file]: failed to open stream: No such file or directory in C:\AppServ\www\home\admin\functions.php on line 27
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move 'C:\AppServ\php5\uploadtmp\phpD.tmp' to 'home/intnews/2010-3-11/cmd.txt' in C:\AppServ\www\home\admin\functions.php on line 27
Add news complete
function editintnews($idx,$date,$file)
{
if($file['name'] <> "")
{
mkdir("/www/home/intnews/".$date."/");
$uploadDir = "home/intnews/".$date."/";
$uploadFile = $uploadDir.$file['name'];
move_uploaded_file($file['tmp_name'], $uploadFile);
$res_link = "http://".$_SERVER[HTTP_HOST]."/home/intnews/".$date."/".$file['name'];
$nname = $file['name'];
$sql = "UPDATE cs_intnews SET ddate= '$date', nname= '$nname', nlink= '$res_link' WHERE idx=$idx";
}
else
{
$sql = "UPDATE cs_intnews SET ddate= '$date' WHERE idx=$idx";
}
include("../config.inc.php");
$link = mysql_connect($host, $admin, $pwd) or die("Could not connect");
$db = mysql_select_db($dbname);
$result = mysql_query($sql,$link);
}
function listintnews($date)
{
include("../config.inc.php");
$link = mysql_connect($host, $admin, $pwd) or die("Could not connect");
$db = mysql_select_db($dbname);
$sql = "Select * from cs_intnews where ddate = '$date' order by idx";
$result = mysql_query($sql,$link);
return $result;
}
function delintnews($idx)
{
include("../config.inc.php");
$link = mysql_connect($host, $admin, $pwd) or die("Could not connect");
$db = mysql_select_db($dbname);
$sql = "delete from cs_intnews where idx = $idx";
$result = mysql_query($sql,$link);
return $result;
}
function listoneintnews($idx)
{
include("../config.inc.php");
$link = mysql_connect($host, $admin, $pwd) or die("Could not connect");
$db = mysql_select_db($dbname);
$sql = "select * from cs_intnews where idx = $idx";
$result = mysql_query($sql,$link);
$row = mysql_fetch_array($result);
return $row;
}
function addnews($topic,$text,$newstype)
{
include("../config.inc.php");
$today = getdate();
$link = mysql_connect($host, $admin, $pwd) or die("Could not connect");
$db = mysql_select_db($dbname);
$sql = "select max(id) as maxid from cs_news";
$result = mysql_query($sql,$link);
$row = mysql_fetch_array($result);
$maxid = $row[maxid]+1;
$now = $today[year]."-".$today[mon]."-".$today[mday];
$res_link = "http://202.28.94.51/news/templatenews.php?id=".$maxid;
$sql = "INSERT INTO cs_news (id,topic, postdate, detail,cat,link) VALUES ($maxid,'$topic', '$now', '$text', '$newstype','$res_link')";
if (mysql_query($sql,$link))
{
return true;
}
else
{
return false;
}
}
?>