 |
เจอ error อย่างนี้ ทำอย่างรัยดีครับ Warning: mkdir() [function.mkdir]: No such file or directory in |
|
 |
|
|
 |
 |
|
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
---------------------------------------------------------------------------------------------------------------------------------
code ของ function.php ครับ
............................................
<?
function chklogin($user,$pass)
{
include("../config.inc.php");
$link = mysql_connect($host, $admin, $pwd) or die("Could not connect");
$db = mysql_select_db($dbname);
$sql = "select * from cs_account where username = '$user' and password = '$pass'";
$result = mysql_query($sql,$link);
$row = mysql_fetch_array($result);
if (( $row[username] == $user ) and ( $row[password] == $pass))
return true;
else
return false;
}
function openurl($url,$target)
{
echo "<script language='javascript'>window.open('$url','$target');</script>";
}
function addintnews($date,$file)
{
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'];
include("../config.inc.php");
$link = mysql_connect($host, $admin, $pwd) or die("Could not connect");
$db = mysql_select_db($dbname);
$sql = "INSERT INTO cs_intnews (idx, ddate, nname,nlink) VALUES (NULL, '$date', '$nname', '$res_link')";
$result = mysql_query($sql,$link);
}
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;
}
}
?>
<?
if ($_POST[action] == "addintnews")
{
$day = $_POST[day];
$month = $_POST[month];
$year = $_POST[year];
$file = $_FILES[filename];
$date = $year.'-'.$month.'-'.$day;
addintnews($date,$file);
echo "Add news complete";
}
if ($_POST[action] == "editintnews")
{
$idx = $_POST[idx];
$day = $_POST[day];
$month = $_POST[month];
$year = $_POST[year];
$file = $_FILES[filename];
$date = $year.'-'.$month.'-'.$day;
editintnews($idx,$date,$file);
echo "Update news complete";
}
if ($_GET[action] == "delintnews")
{
delintnews($_GET[idx]);
echo "Delete news complete";
}
if ($_POST[action] == "addnews")
{
$text = $_POST[text];
$newstype = $_POST[newstype];
$topic = $_POST[topic];
if (addnews($topic,$text,$newstype) ) echo "Add news complete";
else echo "Error!!!";
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<title>Untitled Document</title>
</head>
<body>
</body>
</html>
Tag : - - - -
|
|
 |
 |
 |
 |
Date :
2010-03-16 08:44:21 |
By :
nantasit |
View :
1576 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ใส่
@move_uploaded_file($file['tmp_name'], $uploadFile);
@move_uploaded_file($file['tmp_name'], $uploadFile);
ทั้งสองบรรทัด ตอนเอาขึ้นโฮสนะ แต่ถ้าในเครื่องแนะนำ ไม่ต้องใส่ จะได้รู้ว่ามัน Error อะไร
Code (PHP)
ส่วน mkdir("/www/home/intnews/".$date."/");
พาธน่าผิดหรือป่าวคับCode (PHP)
|
 |
 |
 |
 |
Date :
2010-03-16 08:51:43 |
By :
nottpoo |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ใส่
view sourceprint?1.@move_uploaded_file($file['tmp_name'], $uploadFile);
2.@move_uploaded_file($file['tmp_name'], $uploadFile);
ทั้งสองบรรทัด ตอนเอาขึ้นโฮสนะ แต่ถ้าในเครื่องแนะนำ ไม่ต้องใส่ จะได้รู้ว่ามัน Error อะไร
Code (PHP)
view sourceprint?1.ส่วน mkdir("/www/home/intnews/".$date."/");
พาธน่าผิดหรือป่าวคับCode (PHP)
------------------------------------------------------------------------------------------------------------------------------
ผมลง Appserv ที่เก็บพาธ คือ
C:\AppServ\www\home
|
 |
 |
 |
 |
Date :
2010-03-16 09:06:18 |
By :
nantasit |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
chmod
|
 |
 |
 |
 |
Date :
2010-03-16 12:12:54 |
By :
onedan |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|