1. <?
  2. include_once("configure.php");
  3. include_once("check_msg_function.php");
  4. include_once "language.php";
  5. function RTESafe($strText) {
  6. //returns safe code for preloading in the RTE
  7. $tmpString = trim($strText);
  8. //convert all types of single quotes
  9. $tmpString = str_replace(chr(145), chr(39), $tmpString);
  10. $tmpString = str_replace(chr(146), chr(39), $tmpString);
  11. $tmpString = str_replace("'", "&#39;", $tmpString);
  12. //convert all types of double quotes
  13. $tmpString = str_replace(chr(147), chr(34), $tmpString);
  14. $tmpString = str_replace(chr(148), chr(34), $tmpString);
  15. // $tmpString = str_replace("\"", "\"", $tmpString);
  16. //replace carriage returns & line feeds
  17. $tmpString = str_replace(chr(10), " ", $tmpString);
  18. $tmpString = str_replace(chr(13), " ", $tmpString);
  19. return $tmpString;
  20. }
  21. $errcnt=0;
  22. if(count($_POST)<>0) //IF SOME FORM WAS POSTED DO VALIDATION
  23. {
  24. /////////---getting config---------
  25. $esq_con='select * from esb2b_config where es_id=1';
  26. $esrow_con=mysql_fetch_array(mysql_query($esq_con));
  27. $esq_gro='select * from esb2b_groups where es_memtype='.$_SESSION["esb2b_memtype"];
  28. $esrow_gro=mysql_fetch_array(mysql_query($esq_gro));
  29. /////////--------------getting information bout user's privious postings
  30. $esq_off="select * from esb2b_offers_buy where es_uid=".$_SESSION["esb2b_userid"];
  31. $esbuy_count=mysql_num_rows(mysql_query($esq_off));
  32. //////////////////////////////////---------------------------
  33. if( $esbuy_count >= $esrow_gro["es_buy_cnt"] )
  34. {
  35. echo "dhdhhdhhdhd";
  36. ?><script language="javascript" type="text/javascript">
  37. location.href="<?=$domain_url?>/gen_confirm_mem.html?file=buy_offers&subfile=post_buy&err=post_offer_buy&errmsg=<?=urlencode(" $Sorry_some_error_occurred_and_unable_to_post_buy_offer;")?>">
  38. </script>
  39. <?
  40. // header("Location: gen_confirm_mem.php?file=buy_offers&subfile=post_buy&err=post_offer_buy&errmsg=".urlencode("<? echo $Sorry_some_error_occurred_and_unable_to_post_buy_offer;"));
  41. //die();
  42. }
  43. ////////////////////--------------------
  44. $es_cat_list=str_replace(";",",",$_REQUEST["category"]);
  45. $cid_list=str_replace(";",",",$_REQUEST["cid"]);
  46. $cat=explode(",",$cid_list);
  47. // $cat_name=explode(",",$_REQUEST["category"]);
  48. $es_title=$_REQUEST["es_title"];
  49. $es_description=$_REQUEST["es_description"];
  50. $es_quantity=$_REQUEST["es_quantity"];
  51. $es_keywords=$_REQUEST["es_keywords"];
  52. $key=explode(",",$es_keywords);
  53. $es_price_cur_id=$_REQUEST["es_price_cur_id"];
  54. $es_price=$_REQUEST["es_price"];
  55. if( $cid_list == '' )
  56. {
  57. $errs[$errcnt]="$Atleast_one_Category_must_be_provided";
  58. $errcnt++;
  59. }
  60. elseif(count($cat) > $esrow_gro["es_cat_cnt"])
  61. {
  62. $errs[$errcnt]="$Too_many_Categories_provided";
  63. $errcnt++;
  64. }
  65. if ( strlen(trim($es_title)) == 0 )
  66. {
  67. $errs[$errcnt]="$Title_must_be_provided";
  68. $errcnt++;
  69. }
  70. elseif(preg_match ("/[<>&]/", $es_title))
  71. {
  72. $errs[$errcnt]="$Title_can_not_have_any_special_character";
  73. $errcnt++;
  74. }
  75. if ( strlen(trim($es_description)) == 0 )
  76. {
  77. $errs[$errcnt]="$Description_Must_be_provided";
  78. $errcnt++;
  79. }
  80. elseif ( strlen(strip_tags($es_description)) > $esrow_con['es_description_length'] )
  81. {
  82. $errs[$errcnt]="$Description_length_must_not_exceed ".$esrow_con['es_description_length']." $characters";
  83. $errcnt++;
  84. }
  85. elseif( $esrow_con["es_approval_type_offer"] == 'auto')
  86. {
  87. if ( check_msg($es_description,0) == 'yes' )
  88. {
  89. $errs[$errcnt]="$Description_must_not_contain_bad_words";
  90. $errcnt++;
  91. }
  92. }
  93. if ( !is_numeric($es_quantity) || ($es_quantity <= 0) )
  94. {
  95. $errs[$errcnt]="$Quantity_must_be_non_zero_positive_integer";
  96. $errcnt++;
  97. }
  98. if ( strlen(trim($es_keywords)) == 0 )
  99. {
  100. $errs[$errcnt]="$Keywords_must_be_provided";
  101. $errcnt++;
  102. }
  103. elseif(preg_match ("/[<>&]/", $es_keywords))
  104. {
  105. $errs[$errcnt]="$Keywords_can_not_have_any_special_character";
  106. $errcnt++;
  107. }
  108. elseif(count($key) > $esrow_gro["es_keyword_cnt"])
  109. {
  110. $errs[$errcnt]="$Too_many_keywords_provided";
  111. $errcnt++;
  112. }
  113. if ( !is_numeric($es_price_cur_id) || ($es_price_cur_id == 0) )
  114. {
  115. $errs[$errcnt]="$Price_currency_must_be_selected";
  116. $errcnt++;
  117. }
  118. if ( !is_numeric($es_price) || ($es_price <= 0) )
  119. {
  120. $errs[$errcnt]="$Price_must_be_non_zero_positive_number";
  121. $errcnt++;
  122. }
  123. if($errcnt==0)
  124. {
  125. if(!get_magic_quotes_gpc())
  126. {
  127. $es_title=str_replace("$","\$",addslashes($es_title));
  128. $es_description=str_replace("$","\$",addslashes($es_description));
  129. $es_quantity=str_replace("$","\$",addslashes($es_quantity));
  130. $es_keywords=str_replace("$","\$",addslashes($es_keywords));
  131. $logo=str_replace("$","\$",addslashes($logo));
  132. }
  133. else
  134. {
  135. $es_offer_type=str_replace("$","\$",$es_offer_type);
  136. $es_title=str_replace("$","\$",$es_title);
  137. $es_description=str_replace("$","\$",$es_description);
  138. $es_quantity=str_replace("$","\$",$es_quantity);
  139. $es_keywords=str_replace("$","\$",$es_keywords);
  140. $logo=str_replace("$","\$",$logo);
  141. }
  142. $es_price_cur_id=(int)$es_price_cur_id;
  143. $es_price=$es_price;
  144. $es_postedon=date("YmdHis",time());
  145. $es_approved='yes';
  146. $es_uid=$_SESSION["esb2b_userid"];
  147. // $es_expireson=;
  148. // $esq_con='select * from esb2b_config where es_id=1';
  149. // $esrow_con=mysql_fetch_array(mysql_query($esq_con));
  150. if($esrow_con['es_approval_type_offer']=='auto')
  151. {
  152. $es_new='no';
  153. $es_approved='yes';
  154. $es_msg="$Your_buy_offer_has_been_posted_successfully";
  155. }
  156. else
  157. {
  158. $es_new='yes';
  159. $es_approved='no';
  160. $es_msg="$Your_buy_offer_has_been_sent_for_admin_approval";
  161. }
  162. $esqi_off="Insert into `esb2b_offers_buy` (es_uid, es_title, es_description, es_quantity, es_postedon, es_keywords, es_price_cur_id, es_price, es_approved, es_new) values ($es_uid, '$es_title', '$es_description', $es_quantity, $es_postedon, '$es_keywords', $es_price_cur_id, $es_price, '$es_approved', '$es_new')";
  163. // die($esqi_off);
  164. mysql_query($esqi_off);
  165. if(!$logo=="")
  166. {
  167. $img_url=(string)$logo;
  168. $esqi_off_img="Insert into `esb2b_offer_buy_images`(es_offer_id, es_img_url) values ($es_offer_id, '$img_url')";
  169. mysql_query($esqi_off_img);
  170. }
  171. if(mysql_affected_rows()>0)
  172. {
  173. ///-adding to categories
  174. $esq_off="select max(es_id) as max_id from esb2b_offers_buy where 1";
  175. $esrow_off=mysql_fetch_array(mysql_query($esq_off));
  176. $es_offer_id=$esrow_off["max_id"];
  177. foreach($cat as $es_value)
  178. {
  179. $esq_off_cat="select * from esb2b_offer_cats_buy where es_offer_id=$es_offer_id and es_cid=$es_value";
  180. //echo $esq_off_cat;
  181. // $esrs_off_cat=
  182. if( mysql_num_rows(mysql_query($esq_off_cat)) > 0 )
  183. continue; //skips if record already exists
  184. $esqi_off_cat="insert into esb2b_offer_cats_buy (es_offer_id, es_cid) values ($es_offer_id, $es_value)";
  185. mysql_query($esqi_off_cat);
  186. ///////////////////////////////////////////////////--------------------------
  187. ////////////////////////////////////-----------------------------------------
  188. ////--------mail to member/admin if approval is not auto
  189. if($esrow_con['es_approval_type_offer']<>'auto')
  190. {
  191. //SENDING MAIL TO MEMBER////////////////////////
  192. // $esq_res="select * from esrrs_resources where esres_id=$esres_id";
  193. // $esrow_res=mysql_fetch_array(mysql_query($esq_res));
  194. $esq_mem="select * from esb2b_members where es_id=".$_SESSION["esb2b_userid"];
  195. $esrow_mem=mysql_fetch_array(mysql_query($esq_mem));
  196. $rs_con=mysql_fetch_array(mysql_query("select * from esb2b_config where es_id=1"));
  197. $es_null_char=$rs_con["es_null_char"];
  198. $login_url=$rs_con["es_site_root"]."/signin.php";
  199. // $esresource_url=$rs_con["essite_addr"]."/details_res.php?esres_id=$esres_id";
  200. //Reads email to be sebt
  201. $esq_mail="SELECT * FROM esb2b_mails where es_mailid=6";
  202. $esrs_mail=mysql_query($esq_mail);
  203. if ( $esrow_mail=mysql_fetch_array($esrs_mail) )
  204. {
  205. $from =$esrow_mail["es_fromid"];
  206. $to = $esrow_mem["es_email"];
  207. $subject =$esrow_mail["es_subject"];
  208. $header="From:" . $from . "\r\n" ."Reply-To:". $from ;
  209. $body=str_replace("%email%", $esrow_mem["es_email"],str_replace("%password%",$esrow_mem["es_password"],str_replace("%lname%", $esrow_mem["es_lastname"],str_replace("%fname%",$esrow_mem["es_firstname"],str_replace("%username%",$esrow_mem["es_username"], $esrow_mail["es_mail"]) ))));
  210. $body=str_replace("%signup_url%",$es_null_char,str_replace("%login_url%",$login_url,$body));
  211. $body=str_replace("%message_text%",$es_null_char,str_replace("%message_title%",$es_null_char,str_replace("%sender_username%",$es_null_char,str_replace("%message_date%",$es_null_char,$body))));
  212. $body=str_replace("%visitor_name%",$es_null_char,$body);
  213. $body=str_replace("%offer_title%",$es_title,str_replace("%offer_url%",$es_null_char,str_replace("%offer_id%",$es_null_char,$body)));
  214. if(isset($esrow_mail["es_html_format"])&&($esrow_mail["es_html_format"]=="yes"))
  215. {
  216. $header .= "MIME-Version: 1.0\r\n";
  217. $header .= "Content-type: text/html; charset=iso-8859-1\r\n";
  218. // $body=str_replace("\n","%br%",$body);
  219. }
  220. // echo "--from:-$from----to:-$to---sub:-$subject----head:-$header----";
  221. // echo "<pre>$body</pre>";
  222. // die();
  223. if( $esrow_mail["es_status"]=='yes')
  224. mail($to,$subject,$body,$header);
  225. }
  226. //////////////////////////////////////////////////////////
  227. ///// Sending mail to admin
  228. $rs0=mysql_fetch_array(mysql_query("select * from esb2b_config where es_id=1"));
  229. //$login_url=$site_root[0]."/signinform.php";
  230. //Reads email to be sebt
  231. $esq_mail="SELECT * FROM esb2b_mails where es_mailid=7";
  232. $esrs_mail=mysql_query($esq_mail);
  233. if ( $esrow_mail=mysql_fetch_array($esrs_mail) )
  234. {
  235. $from =$esrow_mail["es_fromid"];
  236. $to = $rs0["es_admin_email"];
  237. $subject =$esrow_mail["es_subject"];
  238. $header="From:" . $from . "\r\n" ."Reply-To:". $from ;
  239. // $body=$rs["mail"];
  240. $body=str_replace("%email%", $esrow_mem["es_email"],str_replace("%password%",$es_null_char,str_replace("%lname%", $esrow_mem["es_lastname"],str_replace("%fname%",$esrow_mem["es_firstname"],str_replace("%username%",$esrow_mem["es_username"], $esrow_mail["es_mail"]) ))));
  241. $body=str_replace("%signup_url%",$es_null_char,str_replace("%login_url%",$login_url,$body));
  242. $body=str_replace("%message_text%",$es_null_char,str_replace("%message_title%",$es_null_char,str_replace("%sender_username%",$es_null_char,str_replace("%message_date%",$es_null_char,$body))));
  243. $body=str_replace("%visitor_name%",$es_null_char,$body);
  244. $body=str_replace("%offer_title%",$es_title,str_replace("%offer_url%",$es_null_char,str_replace("%offer_id%",$es_null_char,$body)));
  245. if(isset($esrow_mail["es_html_format"])&&($esrow_mail["es_html_format"]=="yes"))
  246. {
  247. $header .= "MIME-Version: 1.0\r\n";
  248. $header .= "Content-type: text/html; charset=iso-8859-1\r\n";
  249. // $body=str_replace("\n","%br%",$body);
  250. }
  251. // echo "--from:-$from----to:-$to---sub:-$subject----head:-$header----";
  252. // echo "<pre>$body</pre>";
  253. // die();
  254. if( $esrow_mail["es_status"]=='yes')
  255. mail($to,$subject,$body,$header);
  256. }
  257. } //end if approval <> 'auto'
  258. elseif($esrow_con['es_approval_type_offer']=='auto')
  259. { //////-------mail to fav cats but if approval is auto 'coz otherwise it would be unapproved
  260. // echo "----------hello----------";
  261. $esq_mail="SELECT * FROM esb2b_mails where es_mailid=24";
  262. $esrs_mail=mysql_query($esq_mail);
  263. if ( ($esrow_mail=mysql_fetch_array($esrs_mail)) && ($esrow_mail['es_status']=='yes'))
  264. {
  265. ////////----------getting full path ids
  266. $cat_query=mysql_query("Select * from esb2b_categories where es_id in ($cid_list)");
  267. $temp_cid_list=-1;
  268. while ($rs=mysql_fetch_array($cat_query))
  269. {
  270. $temp_cid_list .=",".$rs["es_id"];
  271. $cid=$rs["es_id"];
  272. $cat_query1=mysql_query("Select * from esb2b_categories where es_id=" . $cid );
  273. while ($rs1=mysql_fetch_array($cat_query1))
  274. {
  275. $temp_cid_list.="," .$rs1["es_id"];
  276. $cat_query1=mysql_query("Select * from esb2b_categories where es_id=" . $rs1["es_pid"] );
  277. }
  278. }
  279. $cid_list=$temp_cid_list;
  280. //echo "<br>cats----".$temp_cid_list."----<br>";
  281. //die();
  282. //////-----------------------------------------
  283. $rs_con=mysql_fetch_array(mysql_query("select * from esb2b_config where es_id=1"));
  284. $es_null_char=$rs_con["es_null_char"];
  285. $login_url=$rs_con["es_site_root"]."/signin.php";
  286. $es_offer_url=$rs_con["es_site_root"]."/offers_buy.php?id=$es_offer_id&prod=buy";
  287. // foreach($cat as $es_value)
  288. // {
  289. $esq3_cat="select * from esb2b_categories where es_id=$es_value";
  290. $esrow3_cat=mysql_fetch_array(mysql_query($esq3_cat));
  291. $es_cat_name=$esrow3_cat["es_cat_name"];
  292. $esuser_id_list="-1";
  293. $esq_fav_cat="select * from esb2b_fav_cats where es_type='buy' and cid in ($cid_list)";
  294. //echo $esq_off_cat;
  295. $esrs_fav_cat=mysql_query($esq_fav_cat);
  296. while($esrow_fav_cat=mysql_fetch_array($esrs_fav_cat))
  297. {
  298. $esuser_id_list.=",".$esrow_fav_cat["mid"];
  299. }
  300. $esq3_mem="select * from esb2b_members where es_id in ($esuser_id_list)";
  301. $esrs3_mem=mysql_query($esq3_mem);
  302. while($esrow3_mem=mysql_fetch_array($esrs3_mem))
  303. { //send mail
  304. //////---getting category name only first matching cat for a user
  305. $esq1_fav_cat="select * from esb2b_fav_cats where cid in ($cid_list) and mid=".$esrow3_mem["es_id"];
  306. //echo $esq_off_cat;
  307. $esrs1_fav_cat=mysql_query($esq1_fav_cat);
  308. $esrow_fav_cat=mysql_fetch_array($esrs1_fav_cat);
  309. $esq4_cat="select * from esb2b_categories where es_id=".$esrow_fav_cat["cid"];
  310. //echo $esq_off_cat;
  311. $esrow4_cat=mysql_fetch_array(mysql_query($esq4_cat));
  312. $es_cat_name=$esrow4_cat["es_cat_name"];
  313. ///////----------------------
  314. $from =$esrow_mail["es_fromid"];
  315. $to = $esrow3_mem["es_email"];
  316. $subject =$esrow_mail["es_subject"];
  317. $header="From:" . $from . "\r\n" ."Reply-To:". $from ;
  318. $body=str_replace("%email%", $es_null_char,str_replace("%password%",$es_null_char,str_replace("%lname%", $esrow3_mem["es_lastname"],str_replace("%fname%",$esrow3_mem["es_firstname"],str_replace("%username%",$esrow3_mem["es_username"], $esrow_mail["es_mail"]) ))));
  319. $body=str_replace("%signup_url%",$es_null_char,str_replace("%login_url%",$login_url,$body));
  320. $body=str_replace("%message_text%",$es_null_char,str_replace("%message_title%",$es_null_char,str_replace("%sender_username%",$es_null_char,str_replace("%message_date%",$es_null_char,$body))));
  321. $body=str_replace("%visitor_name%",$es_null_char,$body);
  322. $body=str_replace("%offer_title%",$es_title,str_replace("%offer_url%",$es_offer_url,str_replace("%offer_id%",$es_offer_id,$body)));
  323. $body=str_replace("%category%",$es_cat_name,$body);
  324. if(isset($esrow_mail["es_html_format"])&&($esrow_mail["es_html_format"]=="yes"))
  325. {
  326. $header .= "MIME-Version: 1.0\r\n";
  327. $header .= "Content-type: text/html; charset=iso-8859-1\r\n";
  328. // $body=str_replace("\n","<br>",$body);
  329. }
  330. // echo "--from:-$from----to:-$to---sub:-$subject----head:-$header----";
  331. // echo "<pre>$body</pre>";
  332. // die();
  333. if( $esrow_mail["es_status"]=='yes')
  334. mail($to,$subject,$body,$header);
  335. } //end while esrow3_mem
  336. //////////////////////////////////////////////////////////
  337. } // end if
  338. //die();
  339. } //end if approval == auto
  340. ///////////-----------------
  341. //////////////////////////////////////////////-------------------------------
  342. /////////////////////////////////////----------------------------------------
  343. }
  344. if($es_approved=="yes")
  345. {
  346. ?><script language="javascript" type="text/javascript">
  347. location.href="<?=$domain_url?>/gen_confirm_mem.html?file=buy_offers&es_type=2&id=<?=$es_offer_id?>&subfile=post_buy&errmsg=<?=urlencode($es_msg)?>";
  348. </script>
  349. <?
  350. //header ("Location: gen_confirm_mem.html?file=buy_offers&subfile=post_buy&es_type=2&id=$es_offer_id&errmsg=".urlencode($es_msg));
  351. }
  352. else
  353. {
  354. ?><script language="javascript" type="text/javascript">
  355. location.href="<?=$domain_url?>/gen_confirm_mem.html?file=buy_offers&subfile=post_buy&errmsg=<?=urlencode($es_msg)?>";
  356. </script>
  357. <?
  358. // header ("Location: gen_confirm_mem.html?file=buy_offers&subfile=post_buy&errmsg=".urlencode($es_msg));
  359. }
  360. //die();
  361. }// if inserted
  362. else
  363. {
  364. ?><script language="javascript" type="text/javascript">
  365. location.href="<?=$domain_url?>/gen_confirm_mem.html?file=buy_offers&subfile=post_buy&err=post_offer_buy&errmsg=<?=urlencode("$Sorry_some_error_occurred_and_unable_to_post_buy_offer")?>";
  366. </script>
  367. <?
  368. // header("Location: gen_confirm_mem.html?file=buy_offers&subfile=post_buy&err=post_offer_buy&errmsg=".urlencode(" echo $Sorry_some_error_occurred_and_unable_to_post_buy_offer;"));
  369. //die();
  370. }
  371. }// if no errors
  372. }// if form posted
  373. else
  374. {
  375. /////////---getting config---------
  376. $esq_con='select * from esb2b_config where es_id=1';
  377. $esrow_con=mysql_fetch_array(mysql_query($esq_con));
  378. $esq_gro='select * from esb2b_groups where es_memtype='.$_SESSION["esb2b_memtype"];
  379. $esrow_gro=mysql_fetch_array(mysql_query($esq_gro));
  380. /////////--------------getting information bout user's privious postings
  381. $esq_off="select * from esb2b_offers_buy where es_uid=".$_SESSION["esb2b_userid"];
  382. $esbuy_count=mysql_num_rows(mysql_query($esq_off));
  383. //////////////////////////////////---------------------------
  384. if( $esbuy_count >= $esrow_gro["es_buy_cnt"] )
  385. {
  386. ?><script language="javascript" type="text/javascript">
  387. location.href="<?=$domain_url?>/gen_confirm_mem.html?file=buy_offers&subfile=post_buy&err=post_offer_buy&errmsg=<?=urlencode("$You_have_already_posted_maximum_allowed_buy_offers")?>";
  388. </script>
  389. <?
  390. //header("Location: gen_confirm_mem.html?file=buy_offers&subfile=post_buy&err=post_offer_buy&errmsg=".urlencode("$You_have_already_posted_maximum_allowed_buy_offers"));
  391. }
  392. $cid_list='';
  393. $es_cat_list='';
  394. $es_title='';
  395. $es_description='';
  396. $es_quantity='';
  397. $es_keywords='';
  398. $es_price_cur_id='';
  399. $es_price='';
  400. }
  401. function main ()
  402. {
  403. ?>
  404. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  405. <tr>
  406. <td valign="top" bgcolor="#F1F1F1" style="width:180px;">
  407. <? include($_SESSION['lang'].".php");
  408. global $domain_url,$domain_url,$esbuy_count, $esrow_con, $esrow_gro, $errs, $errcnt, $cid_list, $es_cat_list, $es_title, $es_description, $es_quantity, $es_keywords, $es_price_cur_id, $es_price;
  409. $showform="";
  410. include "buy_left.php";
  411. ?>
  412. </td>
  413. <td>
  414. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  415. <tr>
  416. <td width="89%" valign="top" style="padding-left:10px; padding-right:10px;">
  417. <table align="right" border="0" cellpadding="0" cellspacing="0" width="98%">
  418. <tr><td>&nbsp;</td></tr>
  419. <tr>
  420. <td align="center">
  421. <? ShowAdvertisement('468x60')?>
  422. </td>
  423. </tr>
  424. <tr>
  425. <td align="center"><br />
  426. <table dwcopytype="CopyTableCell" border="0" cellpadding="0" cellspacing="0" width="100%">
  427. <tr align="center">
  428. <td align="right" valign="top"><?
  429. if (count($_POST)>0)
  430. {
  431. $cid_list=$_POST["cid"];
  432. $es_cat_list=$_POST["category"];
  433. if ( $errcnt <> 0 )
  434. {
  435. ?>
  436. <table width="100%" border="0" align="center" cellpadding="2" cellspacing="0" class="errorstyle">
  437. <tr>
  438. <td colspan="2"><strong>&nbsp;<? echo "$Your_Request_cannot_be_processed_due_to_following_Reasons" ?></strong></td>
  439. </tr>
  440. <tr height="10">
  441. <td colspan="2"></td>
  442. </tr>
  443. <?
  444. for ($i=0;$i<$errcnt;$i++)
  445. {
  446. ?>
  447. <tr valign="top">
  448. <td width="6%">&nbsp;<?php echo $i+1;?></td>
  449. <td width="94%"><?php echo $errs[$i]; ?></td>
  450. </tr>
  451. <?
  452. }
  453. ?>
  454. </table>
  455. <?
  456. }
  457. }
  458. if ($showform<>"No")
  459. {
  460. ?>
  461. <script language=JavaScript src='wysiwyg/scripts/innovaeditor.js'></script>
  462. <script language="JavaScript">
  463. function add_category()
  464. {
  465. if(document.form123.cats.value!=0)
  466. {
  467. var id=document.form123.cats.selectedIndex;
  468. //////-------checking duplicate category
  469. var cid_list=form123.cid.value.split(";");
  470. var cnt=0;
  471. var posted="no";
  472. while(cnt<cid_list.length)
  473. {
  474. if(cid_list[cnt]==document.form123.cats.value)
  475. { posted="yes";}
  476. cnt++;
  477. }
  478. if(posted=="yes")
  479. {
  480. alert('This category is already in the list');
  481. return false;
  482. }
  483. //////-------end checking duplicate category
  484. //////-------checking max no. of categories
  485. var eslength;
  486. if(document.form123.category.value == "")
  487. eslength=0;
  488. else
  489. eslength=cid_list.length
  490. if( eslength >= <?php echo $esrow_gro["es_cat_cnt"]; ?> )
  491. {
  492. alert("You can't choose more than <?php echo ($esrow_gro["es_cat_cnt"]==1)?$esrow_gro["es_cat_cnt"].' category':$esrow_gro["es_cat_cnt"].' categories'; ?>");
  493. return false;
  494. }
  495. //////-------checking max no. of categories
  496. if(document.form123.category.value=="")
  497. {
  498. document.form123.cid.value=document.form123.cats.value;
  499. document.form123.category.value=document.form123.cats.options[id].text;
  500. document.form123.category.focus();
  501. document.form123.cats.selectedIndex=0;
  502. }
  503. else
  504. {
  505. document.form123.cid.value=document.form123.cid.value+";"+document.form123.cats.value;
  506. document.form123.category.value=document.form123.category.value+";"+document.form123.cats.options[id].text;
  507. document.form123.category.focus();
  508. document.form123.cats.selectedIndex=0;
  509. }
  510. }
  511. else
  512. {
  513. alert('Choose a Category to add');
  514. }
  515. }
  516. function remove_category()
  517. {
  518. var s1=window.document.form123.category.value;
  519. var s2=s1.split(";");
  520. var i=0;
  521. var id=document.form123.cats.selectedIndex;
  522. var s3=document.form123.cats.options[id].text;
  523. var id_list=document.form123.cid.value;
  524. var id_split=id_list.split(";");
  525. var rem_id=document.form123.cats.value;
  526. window.document.form123.category.value="";
  527. window.document.form123.cid.value="";
  528. while(i<s2.length)
  529. {
  530. //alert('Checking '+s2[i]+' nnn with'+s3+' mm');
  531. if(s3==s2[i])
  532. {
  533. //continue;
  534. // alert('Removing'+s3);
  535. }
  536. else
  537. {
  538. if(document.form123.category.value=="")
  539. {
  540. document.form123.category.value=s2[i];
  541. }
  542. else
  543. {
  544. document.form123.category.value=document.form123.category.value+";"+s2[i];
  545. }
  546. }
  547. if(rem_id==id_split[i])
  548. {
  549. //continue;
  550. // alert('Removing'+s3);
  551. }
  552. else
  553. {
  554. if(document.form123.cid.value=="")
  555. {
  556. document.form123.cid.value=id_split[i];
  557. }
  558. else
  559. {
  560. document.form123.cid.value=document.form123.cid.value+";"+id_split[i];
  561. }
  562. }
  563. i++;
  564. }
  565. //window.document.form123.related.value="";
  566. //window.document.form123.rel_id.value="";
  567. }
  568. function validate_form(frm)
  569. {
  570. updateRTEs();
  571. if(frm.cid.value=='')
  572. {
  573. alert('Please choose atleast one category');
  574. frm.cats.focus();
  575. return(false);
  576. }
  577. if(frm.es_title.value=='')
  578. {
  579. alert('Please specify Title');
  580. frm.es_title.focus();
  581. return(false);
  582. }
  583. else if(frm.es_title.value.match(/[&<>]+/))
  584. {
  585. alert("Please remove special characters from Title i.e. & < >");
  586. frm.es_title.focus();
  587. frm.es_title.select();
  588. return(false);
  589. }
  590. if(frm.es_description.value=='')
  591. {
  592. alert('Please specify Description');
  593. return(false);
  594. }
  595. if( isNaN(frm.es_quantity.value) || frm.es_quantity.value<=0)
  596. {
  597. alert('Please specify Quantity as a non-zero positive integer');
  598. frm.es_quantity.focus();
  599. frm.es_quantity.select();
  600. return(false);
  601. }
  602. if(frm.es_keywords.value=='')
  603. {
  604. alert('Please specify Keywords');
  605. frm.es_keywords.focus();
  606. return(false);
  607. }
  608. else if(frm.es_keywords.value.match(/[&<>]+/))
  609. {
  610. alert("Please remove special characters from Keywords i.e. & < >");
  611. frm.es_keywords.focus();
  612. frm.es_keywords.select();
  613. return(false);
  614. }
  615. else
  616. {
  617. var list=frm.es_keywords.value.split(",");
  618. if( list.length > <?php echo $esrow_gro["es_keyword_cnt"]; ?> )
  619. {
  620. alert("You can't choose more than <?php echo ($esrow_gro["es_keyword_cnt"]==1)?$esrow_gro["es_keyword_cnt"].' keyword':$esrow_gro["es_keyword_cnt"].' keywords'; ?>");
  621. frm.es_keywords.focus();
  622. frm.es_keywords.select();
  623. return(false);
  624. }
  625. }
  626. if( frm.es_price_cur_id.value == 0)
  627. {
  628. alert('Please choose currency for Price');
  629. frm.es_price_cur_id.focus();
  630. return(false);
  631. }
  632. if( isNaN(frm.es_price.value) || frm.es_price.value<=0)
  633. {
  634. alert('Please specify Price as a non-zero positive number');
  635. frm.es_price.focus();
  636. frm.es_price.select();
  637. return(false);
  638. }
  639. return(true);
  640. }
  641. function attachment(box,es_id)
  642. {
  643. //str="view_images.php?es_id="+es_id;
  644. str="fileupload1.html?box="+ box+"&es_id="+es_id;
  645. window.open(str,"Attachment","top=5,left=30,toolbars=no,maximize=yes,resize=yes,width=450,height=450,location=no,directories=no,scrollbars=yes");
  646. }
  647. function removeattachment(box)
  648. {
  649. window.document.form123.list1.value=""
  650. }
  651. </script>
  652. <form name="form123" method="post" action="buy_offers_post_buy_offers.html" onSubmit="return validate_form(this);">
  653. <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="onepxtable">
  654. <tr>
  655. <td class="titlestyle">&nbsp;<? echo "$Post_Buy_Offer" ?></td>
  656. </tr>
  657. <tr>
  658. <td><table border="0" align="center" cellpadding="2" cellspacing="5">
  659. <tr>
  660. <td colspan="3" class="innertablestyle"> <div align="center"><font class="normal">
  661. <? echo "$Buy_Offers" ?> : <? echo "$Posted" ?> - <strong><font class="red"><?php echo $esbuy_count; ?></font></strong>
  662. <? echo "$Maximum_Allowed_" ?>- <strong><font class="red"><?php echo $esrow_gro["es_buy_cnt"]; ?></font></strong></font></div></td>
  663. </tr>
  664. <tr valign="top">
  665. <td width="25%" align="right" class="innertablestyle"><font class="normal"><strong><? echo "$Categories" ?><br>
  666. </strong></font><font class="smalltext">(<font class="smalltext"><? echo "$Max" ?></font><strong><?php echo $esrow_gro["es_cat_cnt"]; ?></strong><?php echo ($esrow_gro["es_cat_cnt"]>1)?' categories':' category'; ?>)</font></td>
  667. <td><font class="red">*</font></td>
  668. <td> <font class="smalltext">
  669. <textarea name="category" cols="37" rows="5" readonly="readonly" id="category"><? echo $es_cat_list;?></textarea>
  670. <br>
  671. <select name="cats" id="select2" >
  672. <option value="0">Choose a category</option>
  673. <?
  674. $rs_query=mysql_query("select * from esb2b_categories order by es_pid");
  675. while($rst=mysql_fetch_array($rs_query))
  676. {
  677. $cat_path="";
  678. $child=mysql_fetch_array(mysql_query("select * from esb2b_categories where es_pid=".$rst["es_id"]));
  679. if($child)
  680. {
  681. continue;
  682. }
  683. $cat_path.=$rst["es_cat_name"];
  684. $par=mysql_query("select * from esb2b_categories where es_id=".$rst["es_pid"]);
  685. while($parent=mysql_fetch_array($par))
  686. {
  687. $cat_path=$parent["es_cat_name"].">".$cat_path;
  688. $par=mysql_query("select * from esb2b_categories where es_id=".$parent["es_pid"]);
  689. }
  690. ?>
  691. <option value="<? echo $rst["es_id"];?>" ><? echo $cat_path;?></option>
  692. <?
  693. }
  694. ?>
  695. </select>
  696. <input name="cid" type="hidden" id="cid" value="<? echo $cid_list;?>">
  697. <input class="btn btn-grey" name="add" type="button" id="add" value="<? echo "$Add" ?>" onClick="add_category()">
  698. <input class="btn btn-grey" name="Remove" type="button" id="Remove" value="<? echo "$Remove" ?>" onClick="remove_category()">
  699. </font></td>
  700. </tr>
  701. <tr valign="top">
  702. <td align="right" class="innertablestyle"><font class="normal"><strong><? echo "$Title" ?></strong></font></td>
  703. <td><font class="red">*</font></td>
  704. <td><font face="Arial, Helvetica, sans-serif" size="2">
  705. <input name="es_title" type="text" class=select id="es_title" value="<?php echo $es_title; ?>" size="30" maxlength="40">
  706. </font></td>
  707. </tr>
  708. </table>
  709. <div style="width:100%" class="titlestyle"><font class="normal"><strong><? echo "$Description" ?></strong></font></div>
  710. <table width="100%" border="0" align="center" cellpadding="2" cellspacing="5">
  711. <tr valign="top">
  712. <td align="left" colspan='3' style="padding:0; margin:0;"></td>
  713. </tr>
  714. <tr valign="top">
  715. <td valign="top" colspan="3" align="center"> <div align="center"><font class='normal'>
  716. <textarea name="es_description" cols=30 rows=4 wrap="physical" id="es_description">
  717. <?
  718. function encodeHTML($sHTML)
  719. {
  720. $sHTML=ereg_replace("&","&amp;",$sHTML);
  721. $sHTML=ereg_replace("<","&lt;",$sHTML);
  722. $sHTML=ereg_replace(">","&gt;",$sHTML);
  723. return $sHTML;
  724. }
  725. if(isset($es_description))
  726. {
  727. $sContent=stripslashes($es_description); /*** remove (/) slashes ***/
  728. echo encodeHTML($sContent);
  729. }
  730. ?>
  731. </textarea>
  732. <script> //STEP 2: Replace the textarea (txtContent)
  733. var oEdit1 = new InnovaEditor("oEdit1");
  734. oEdit1.REPLACE("es_description");//Specify the id of the textarea here
  735. </script>
  736. </font>
  737. </div></td>
  738. </tr>
  739. <tr valign="top">
  740. <td width="22%" align="right" class="innertablestyle"><font class="normal"><strong><? echo "$Quantity" ?></strong></font></td>
  741. <td><font class="red">*</font></td>
  742. <td><font face="Arial, Helvetica, sans-serif" size="2">
  743. <input name="es_quantity" type="text" class=select id="es_quantity" value="<?php echo $es_quantity; ?>" size="30" maxlength="40">
  744. </font><font face="Arial, Helvetica, sans-serif" size="2">&nbsp;
  745. </font></td>
  746. </tr>
  747. <tr valign="top">
  748. <td align="right" class="innertablestyle"><font class="normal"><strong><? echo "$Keywords" ?><br>
  749. </strong></font><font class="smalltext">(<? echo "$Max" ?> <strong><?php echo $esrow_gro["es_keyword_cnt"]; ?></strong><?php echo ($esrow_gro["es_keyword_cnt"]>1)?' keywords':' keyword'; ?>)</font><font class="normal"><strong>
  750. </strong></font></td>
  751. <td><font class="red">*</font></td>
  752. <td><input name="es_keywords" type="text" class=select id="es_keywords" value="<?php echo $es_keywords; ?>" size="30" maxlength="40">
  753. <br> <font class="smalltext"><? echo "$Please_specify_a_comma_seperated_list_of_keywords_related_to_your_product_Appropriate_keywords_will_lead_more_buyers_to_find_your_products" ?>.</font></td>
  754. </tr>
  755. <tr valign="top">
  756. <td class="innertablestyle"> <div align="right"><strong><font class="normal"><? echo "$Price" ?></font></strong></div></td>
  757. <td><font class="red">*</font></td>
  758. <td><font face="Arial, Helvetica, sans-serif" size="2">
  759. <select name="es_price_cur_id">
  760. <option value="0"><? echo "$Select_Currency" ?></option>
  761. <?
  762. $rs_query=mysql_query("Select * from esb2b_currencies where 1" );
  763. while ($rs=mysql_fetch_array($rs_query))
  764. {
  765. ?>
  766. <option value="<?php echo $rs["escur_id"]; ?>"
  767. <?php
  768. if ( $rs["escur_id"]==$es_price_cur_id)
  769. {
  770. echo " selected ";
  771. }
  772. ?>
  773. ><?php echo $rs["escur_name"]; ?></option>
  774. <?
  775. }
  776. ?>
  777. </select>
  778. &nbsp;&nbsp;
  779. <input name="es_price" type="text" id="es_price" value="<?php echo $es_price; ?>" size="5" maxlength="30">
  780. </font></td>
  781. </tr>
  782. <tr valign="top">
  783. <td align="right" class="innertablestyle">&nbsp;</td>
  784. <td>&nbsp;</td>
  785. <td><input class="btn btn-grey" name="submit" type="submit" value="<? echo "$Post_Now" ?>"></td>
  786. </tr>
  787. </table></td>
  788. </tr>
  789. </table>
  790. </form>
  791. <?
  792. } ?>
  793. <br />
  794. </td>
  795. </tr>
  796. </table></td>
  797. </tr>
  798. </table></td>
  799. <td width="21%" style="padding-top:4px" valign="top"></td>
  800. </tr>
  801. </table>
  802. </td>
  803. </tr>
  804. </table>
  805. <table width="100%" border="0" cellspacing="0" cellpadding="0">
  806. <tr>
  807. <td style="padding-top:4px"; ></td>
  808. </tr>
  809. </table>
  810. <!-- right -->
  811. <!--===================== SCREEN END ========================-=====================================-->
  812. <!-- lefte menu -->
  813. <div style="clear: both;"></div>
  814. <!--us_myalibaba_web7 -->
  815. <?
  816. // end main
  817. }
  818. include_once("template1.php");
  819. ?>

Remove field validation for "quantity"