\n"; //------------ // Connect DB //------------ $db=mysql_connect($db_host, $db_user, $db_passwd) or die('Cannot connect to database.
'. mysql_error()); mysql_select_db($db_name, $db); //====================== // Get the product info //====================== $qry="SELECT * FROM twb_products WHERE pr_name='$product_name'"; $result=mysql_query($qry, $db); if (mysql_errno()!=0) echo '

SQL Error:
QRY:'. $qry.'
ERR:'. mysql_error().'

'; //--------------------------------------------------------------------------------- // If there's no product info, the item's free but you must be logged in to get it //--------------------------------------------------------------------------------- if (mysql_num_rows($result)==0) return "

No Product Info Found for '$product_name'

\n"; while ($myrow=mysql_fetch_assoc($result)) foreach ($myrow as $myvarname=>$myvarvalue) $$myvarname=$myvarvalue; //--------------------------------------------------------- // Form definitions and fields common to all payment types //--------------------------------------------------------- $frm= "
\n"; $cmn= "\n"; if (strlen($pp_web_image)>1) $cmn.= "\n"; $cmn.= "\n"; $cmn.= "\n"; $cmn.= "\n"; $cmn.= "\n"; if ($pr_req_address!='Y') $cmn.= "\n"; if ($pr_show_note!='Y') $cmn.= "\n"; if ($pr_show_qty=='Y') $cmn.= "Qty:\n"; $cmn.= "\n"; $cmn.= "\n"; $cmn.= "\n"; //--------------------------- // Product is a subscription //--------------------------- if ($pr_recurring=='Y') { (strlen($pp_subscribe_text)==0) ? $t_btn_text='Subscribe' : $t_btn_text=$pp_subscribe_text; $btn.= "\n\n"; $btn.= "{$frm}\n{$cmn}"; //-- Trial Period $a=strpos($pr_trial, ' '); $tr_units=substr($pr_trial,0,$a); // i.e. *3* months $tr_period=substr($pr_trial,$a+1, 1); // i.e. *M*onths //if (strlen($pp_trialprice)==0) $pp_trialprice=0; $btn.= "\n"; $btn.= "\n"; $btn.= "\n"; //-- Main Subscription $a=strpos($pr_renewal, ' '); $num_units=substr($pr_renewal,0,$a); // i.e. *3* months $period=substr($pr_renewal,$a+1, 1); // i.e. *M*onths $btn.= "\n"; $btn.= "\n"; $btn.= "\n"; $btn.= "\n\n"; if (strlen($pr_repeats)>0) $btn.= "\n"; //-- If image provided - use that - else use the text if (strlen($pp_btn_image)>1) $btn.= "\n"; else $btn.= "\n"; $btn.= "
\n"; } //------------------------------------------------ // WEB ACCEPT Enabled - create instant pay button //------------------------------------------------ if ($use_webaccept=='Y' && $pr_recurring!='Y') { (strlen($pp_btn_text)==0) ? $t_btn_text='Buy Now' : $t_btn_text=$pp_btn_text; $btn.= "\n\n"; $btn.= "{$frm}\n{$cmn}"; $btn.= "\n"; //-------------------------------------------------- // If image provided - use that - else use the text //-------------------------------------------------- if (strlen($pp_btn_image)>1) $btn.= "\n"; else $btn.= "\n"; $btn.= "\n"; } //--------------------------------------------------------- // PAYPAL SHOPPING-CART Enabled, create add to cart button //--------------------------------------------------------- if ($use_ppcart=='Y' && $pr_recurring!='Y') { (strlen($pp_cart_text)==0) ? $t_cart_text='Add To Cart' : $t_cart_text=$pp_cart_text; $btn.= "\n\n"; $btn.= "{$frm}\n{$cmn}"; $btn.= "\n"; $btn.= ""; // -- If image available.. -- if (strlen($pp_cart_image)>1) $btn.= "\n"; else $btn.= "\n"; $btn.= "\n"; } //------------------------ // View Cart Button - PP //------------------------ if ($we_c_pp_cart=='Y' && $pr_recurring!='Y') { (strlen($pp_viewcart_text)==0) ? $t_btn_text='Buy Now' : $t_btn_text=$pp_viewcart_text; $btn.= "\n\n"; $btn.= "{$frm}\n{$cmn}"; $btn.= "\n"; // -- If image available.. -- if (strlen($pp_viewcart_image)>1) $btn.= "\n"; else $btn.= "\n"; $btn.= "\n"; } $btn.= "\n"; mysql_close(); echo $btn; //return $btn; } ?>