<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
// +----------------------------------------------------------------------+
// | PHP version 4/5                                                      |
// +----------------------------------------------------------------------+
// | This source file is a part of iScripts Multicart                     |
// +----------------------------------------------------------------------+
// | Authors: Programmer<programmer@armia.com>        		              |
// +----------------------------------------------------------------------+
// | Copyrights Armia Systems, Inc and iScripts.com  2005                |
// | All rights reserved                                                  |
// +----------------------------------------------------------------------+
// | This script may not be distributed, sold, given away for free to     |
// | third party, or used as a part of any internet services such as      |
// | webdesign etc.                                                       |
// +----------------------------------------------------------------------+
?>
<?php
include "includes/config.php";
include "includes/session.php";
include "includes/functions.php";


if (get_magic_quotes_gpc()) {
    $_POST = array_map('stripslashes_deep', $_POST);
    $_GET = array_map('stripslashes_deep', $_GET);
    $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
}
if(isset( $_GET["artistid"]) && $_GET["artistid"]!=""){
	$artistid = $_GET["artistid"];
}else if(isset( $_POST["artistid"]) && $_POST["artistid"]!=""){
	$artistid = $_POST["artistid"];
}

if(isset( $_GET["productid"]) && $_GET["productid"]!=""){
	$productid = $_GET["productid"];
}else if(isset( $_POST["productid"]) && $_POST["productid"]!=""){
	$productid = $_POST["productid"];
}


if(isset( $_SESSION["sess_userid"]) && $_SESSION["sess_userid"]!=""){
	$userid = $_SESSION["sess_userid"];
}else{
	header("Location:login.php?action=postartistfeedback&artistid=$artistid&productid=$productid");
	exit();
}



if($artistid==''){
	header("Location:categorydetail.php");
	exit();
}


if (isset($_POST["btnPostFeedback"])) {
	$txtFeedback = $_POST["txtFeedback"];
	$ddlRating = $_POST["ddlRating"];
	if (!isNotNull($txtFeedback)) {
        $message .= FEEDBACK_EMPTY_MSG." <br>";
    }


    if ($message != "") { // error
        $message = "<br>".CORRECT_ERRORS_TEXT."<br>" . $message;
    } else { // no error so insert user details
		$sql = "INSERT INTO ".$tableprefix."artist_feedbacks (
				feedback_content,
				rating,
				user_id,
				artist_id,
				date_added,
				published

				) VALUES (
				'".addslashes($txtFeedback)."',
				'".addslashes($ddlRating)."',
				'".addslashes($userid)."',
				'".addslashes($artistid)."',
				now(),
				'N')
				";
		//echo $sql;
		$message = THANK_YOU_MSG;
		$message .= "<br>".FEEDBACK_PENDING_APPROVAL_TEXT;
		mysql_query($sql);
		$txtFeedback = "";
		$ddlRating = "";
    }
}


$ratinglist = array();
for($i=1;$i<11;$i++){
	$ratinglist[$i] = $i;
}

/*display the active template*/

$active_template = displayTemplate();


include "includes/htmltop.php";

/* Top File Name */

include_once ("includes/".$active_template[0]);

?>

<style>
.success_messgae{
color:#009933;
}
</style>

			<div align="left" class="main_body">
			
			<!--mainbody area start -->
			
		<!--center content area start-->		

		<form name="frmPostFeedback" action="<?php echo $_SERVER["PHP_SELF"]?>" method="POST">
			<input type="hidden" name="artistid" value="<?php echo $artistid;?>" >
			<input type="hidden" name="productid" value="<?php echo $productid;?>" >
			
		<div align="left" id="item_details">
	
	
		<!--items display area start -->
	
		<div align="left" id="items_top_area">
				<div align="left" id="items_top_area_ttl"><?php echo SELLER_FEEDBACK_TEXT;?></div>
		</div>
		
		<div class="text_information" align="center"><?php echo $message?></div>
		
		<div class="sellerfeedbk">	
			
		<table cellpadding="2" cellspacing="2" width="100%" border=0 class="heading">
			<tr>
				<td colspan="3" align="right"><span class="required">*</span><?php echo MANDATORY_FIELDS_TEXT;?></td>
			</tr>
			<tr><td colspan="3">&nbsp;</td></tr>
			<tr><td align="left" valign="top" width="32%"><?php echo YOUR_FEEDBACK_TEXT;?>&nbsp;<span class="required">*</span></td><td >&nbsp;</td><td align="left"><TEXTAREA class="textarea" name="txtFeedback" rows="8" cols="40"><?php echo $txtFeedback;?></TEXTAREA></td></tr>
			<tr><td align="left" valign="top" ><?php echo YOUR_RATING_TEXT;?>&nbsp;<span class="required">*</span></td><td >&nbsp;</td><td align="left"><?php echo makeDropDownList("ddlRating", $ratinglist, $ddlRating, false,"textbox", $properties, $behaviors)?></td></tr>
			<tr><td colspan="3">&nbsp;</td></tr>
			<tr><td colspan="3" align="center">				&nbsp;&nbsp;
				<input class="button" type="button" value="<?php echo BACK_TO_PRODUCT_DETAILS_BUTTON;?>" onClick="window.location.href='productdetails.php?productid=<?php echo $productid;?>';" >
				<input type="submit" class="button" value="<?php echo POST_FEEDBACK_BUTTON;?>" name="btnPostFeedback"></td></tr>
		</table>
		<div class="clear"></div>
		</div>	
	
	
		<div align="left" class="float_clear1"></div>
					
					
		 <!--items display area end -->
		  </div>
		
		</form>
		<!--center content area end-->	


		<!--mainbody area end -->
        </div>


<?php
include "includes/".$active_template[2];	/* Bottom File Name */
?>