<?php session_start();  //Developed by ITechScripts

require 'include/announcements.php'; // ITECHBIDS Configuration File

$user_id=$_SESSION['userid'];

$productid=$_REQUEST[productid];

$id=$_REQUEST[seller_id];

$type=$_REQUEST['cboradtype'];

if($id)

{

$who="seller";

}

else

{

$who="buyer";

$id=$_REQUEST[buyer_id];

}

if(!isset($_SESSION[username]))

{ 

$link="signin.php";

$url="comments.php";

echo '<meta http-equiv="refresh" content="0;url='.$link.'?url='.$url.'">';

echo "$lang_675 <a href=$link?$url>$lang_117</a>";

exit();

}

$sql="select * from auction_details where productid=$productid";

$res=mysql_query($sql);

$row=mysql_fetch_array($res);



$user="select * from member_details where user_id=$id";

$user_res=mysql_query($user);

$user_row=mysql_fetch_array($user_res);

$toid=$user_row[user_name];



function select_tag_string($name,$array,$key)

{

$tag="<select name=cboradtype>";

foreach($array as $field)

{

if($key==$field)

$tag=$tag . "<option value=\"$field\" selected>$field</option>";

else

$tag=$tag . "<option value=\"$field\">$field</option>";

}

$tag=$tag . "</select>";

return $tag;

}



$feedbackto=$_POST[radfeedback];

if($_POST[LeaveFeedback])

{

$feedback=$_POST[txtcomment];

$date=date("Y:m:d");



if($feedbackto=="seller")

{

$item_sql="select * from auction_details where productid=$productid";

$item_res=mysql_query($item_sql);

$item_row=mysql_fetch_array($item_res);

$feedback_to=$item_row[user_id];

$buyer_id="$user_id";

$seller_id="";

$in_sql="insert into feedback(productid,seller_id,date,buyer_id,feedback_to,feedback,feedback_type) values('$productid','$seller_id','$date','$buyer_id','$feedback_to','$feedback','$type')";

$in_res=mysql_query($in_sql);

}

else

{

$buyer_id="";

$seller_id=$user_id;

$item_sql="select * from auction_details where productid=$productid";

$item_res=mysql_query($item_sql);

$item_row=mysql_fetch_array($item_res);

$feedback_to="$item_row[user_id]";

$in_sql="insert into feedback(productid,seller_id,date,buyer_id,feedback_to,feedback,feedback_type) values('$productid','$seller_id','$date','$buyer_id','$id','$feedback','$type')";

$in_res=mysql_query($in_sql);

}

}

?>