|
 |
|
สงสัยค่ะ ว่าทำไมโค้ดเหมือนกัน แต่พอเปลี่ยนจากแอดมิน เป็นสมาชิกธรรมดา กลับ error |
|
 |
|
|
 |
 |
|
เป็นโค้ดเพิ่มหมวดหมู่ค่ะ
ตอนล็อคอินเป็นแอดมิน สามารถเพิ่มได้
แต่พอล็อคอินเป็นสมาชิก กลับ error ซะงั้น
ทั้งๆที่โค้ดเหมือนกันทุกอย่าง
Code (PHP)
<?
include("connect.php");
$forum_id =$_GET['forumid'];
$subject =$_POST['subject'];
$post_detail =$_POST['post_detail'];
$user_id =$_SESSION['user_id'];
//$attach_file =$_FILES['attach_file'];
$song_name =$_POST['song_name'];
$singer_name =$_POST['singer_name'];
$date_post =date("Y-m-d H:i:s");
$tmp_file =$_FILES['attach_file']['tmp_name']; // ไฟล์ที่อัพโหลดมา จะถูกพักในโฟเดอร์ temp ของ windows ก่อน
$attachfile =$_FILES['attach_file']['name']; // ชื่อไฟล์
if (empty($subject) || empty($post_detail) || empty($song_name) || empty($singer_name))
{
echo "<script> alert ('กรุณากรอกข้อมูลให้ครบถ้วน') ; history.back();</script>";
exit();
}
if (empty($attach_file))
{
echo "<script> alert ('กรุณาเพิ่มเพลง') ; history.back();</script>";
exit();
}
$path="song/";
if ($attach_file!=""){
if($types = getimagesize($attach_file))
{
if($type[2] == 1)
{
$music = $dt.".gif";
}
if($type[2] == 2)
{
$music = $dt.".jpg";
}
if($type[2] == 3)
{
$music = $dt.".png";
}
echo "<script> alert ('ไม่สามารถโพสต์ได้ เนื่องจากไม่ได้เลือกไฟล์เพลง') ; history.back();</script>";
$attach_file!="";
} else {
$upload=copy($attach_file,"$path".$attachfile);
if ($upload) {
$sql="INSERT INTO webboard_post (question_id ,forum_id,subject ,post_detail ,user_id,attach_file ,count_view ,song_name,singer_name,date_post)VALUES
('','$forum_id','$subject', '$post_detail','$user_id','$attachfile','0', '$song_name', '$singer_name','$date_post')";
$mysql = mysql_db_query($db,$sql);
{
echo "<script> alert ('เพิ่มกระทู้เรียบร้อยแล้ว') ; window.location='webboard_admin.php'</script>";
} } }
}
?>
Tag : PHP

|
ประวัติการแก้ไข 2011-07-03 23:01:46
|
 |
 |
 |
 |
Date :
2011-07-03 22:35:28 |
By :
nokz |
View :
823 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อันดับแรกใส่ OR die(mysql_error()); ไว้หลัง statement sql ก่อนครับ
แล้วเช็คดูว่า เข้าเงื่อนไข if ป่าว
|
 |
 |
 |
 |
Date :
2011-07-03 22:40:06 |
By :
taza678 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ใส่ตรงไหนคะ เพิ่งหัดเขียนอ่ะค่ะ
แต่ว่าโค้ดนี้ ตอนล็อคอินเป็นแอดมิน อัพโหลดได้นะคะ แต่พอล็อคอินเป็นสมาชิก อัพโหลดไม่ได้ งงมากค่ะ
โค๊ดเดียวกัน แค่ชื่อหน้าไม่เหมือนกันแค่นั้นเองค่ะ
|
 |
 |
 |
 |
Date :
2011-07-03 22:56:28 |
By :
nokz |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 01
|