|
 |
|
คือว่าเวลาแก้ไขไฟล์ ตัวอืนแก้ไขได้หมดครับแต่รูปครับมันไม่ก๊อปเข้าโฟลเดอร์แต่เข้าฐานข้อมูลครับช่วยดูให้ทีครับ |
|
 |
|
|
 |
 |
|
Code (PHP)
<?php
if (check_useradmin())
{
if(empty($news_name)||empty($detail))
{
echo "<center><b class='redbig'>กรุณาป้อนรายละเอียดให้ครบถ้วน</b></center>";
require_once("../include/footeradmin.php");
exit;
}
// นำฟังก์ชั่น Ramdom password มาใช้เพื่อกำหนดชื่อไฟล์ป้องกันการซ้ำกัน
function random_password($len)
{
srand((double)microtime()*10000000);
$chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
$ret_str = "";
$num = strlen($chars);
for($i = 0; $i < $len; $i++)
{
$ret_str.= $chars[rand()%$num];
$ret_str.="";
}
return $ret_str;
}
//echo random_password(8);
$passw = random_password(7);
$path= "news";
$filenewcon = strstr($file,'.');
$now = date("Dgis");
if(empty($file))
{
echo"";
}
else
{
copy ($file, "$path/$passw$now$filenewcon");
$url="admin/$path/$passw$now$filenewcon";
}
if (edit_news($news_id,$news_name,$detail,$start_date,$stop_date,$picture,$url,$file))
{
echo "<BR><center><b class='bluebig'>แก้ไขข่าว '$news_name' ในฐานข้อมูลเสร็จเรียบร้อยแล้ว</b></center>";
echo "<META HTTP-EQUIV='Refresh' CONTENT='1;URL=managenews_form.php '>";
?>
Code (PHP)
<?php
function edit_news($news_id,$news_name,$detail,$start_date,$stop_date,$picture,$url,$file)
{
$date=date("Y-m-d");
$conn=connect_db("train");
if(!$conn)
return "ไม่สามารถติดต่อกับฐานข้อมูลได้ กรุณาพยายามอีกครั้ง";
if(empty($file))
{
$url1=$picture;
}
else
{
$url1=$url;
}
$sql="update news set news_name='$news_name',detail='$detail' ,start_date='$start_date',stop_date='$stop_date',date='$date',picture='$url1' where news_id='$news_id' ";
$result = mysql_query($sql);
if(!$result)
return("ไม่สามารถแก้ไขรายการได้");
else
return true;
}
?>
คือว่าเวลาแก้ไขไฟล์ ตัวอืนแก้ไขได้หมดครับแต่รูปครับมันไม่ก๊อปเข้าโฟลเดอร์แต่เข้าฐานข้อมูลครับช่วยดูให้ทีครับ
โฟลเดอร์รูปชื่อ news อยู่ในโฟลเดอร์ admin อีกทีครับ admin\news
Tag : - - - -

|
|
 |
 |
 |
 |
Date :
2009-08-29 04:24:55 |
By :
atung |
View :
857 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คุณรับค่า รูปภาพเป็น $url แต่ คุณแก้ไข picture='$url1' นะครับ
|
 |
 |
 |
 |
Date :
2009-08-29 09:51:00 |
By :
tusscomsci |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 02
|