?
if (!$currencyid) {
$currencyid = 2;
setcookie("currencyid",$currencyid);
}
if (!$userid) {
$userid = "temp".$REMOTE_ADDR.$email.date("YmdHis");
$userid = str_replace(".","",$userid);
setcookie("userid",$userid,time()+86400);
}
include "common/db.inc.php";
$range_id=$rangeid;
// start coupon code
function get_qty($u_id)
{
$query_a = "select count(*) as a_qty from temp_cart where userid = '$u_id'";
$result_a = mysql_query($query_a);
$row_a = mysql_fetch_array($result_a);
return $row_a["a_qty"];
}
if($g==1){
setcookie("gift",1);
}
function get_range($r_id)
{
$query_r = "select rangename from range where rangeid = $r_id";
$result_r = mysql_query($query_r);
$row_r = mysql_fetch_array($result_r);
return $row_r["rangename"];
}
if($txt_coupon<>"")
{
$qry = "select * from my_coupon where mc_number='$txt_coupon'";
$rst = mysql_query($qry);
if(mysql_num_rows($rst)<=0)
{
$cmsg = "Invalid Coupon";
}else{
$rw = mysql_fetch_array($rst);
$mc_tno = $rw["mc_tno"];
$mc_value = $rw["mc_value"];
$mc_order = $rw["mc_order"];
$mc_status = $rw["mc_status"];
$mc_exp = $rw["mc_exp"];
$cur_date = date("Y-m-d");
if($mc_exp < $cur_date) $cmsg = "Coupon Expired";
if($mc_status==1)
{
if($mc_tno==3)
{
$ri = explode(",", $mc_value);
$option_id = $ri[0];
$range_id = $ri[1];
setcookie ("option_id", $option_id);
setcookie ("range_id", $range_id);
}
if($mc_tno==4){
setcookie ("range_id", $mc_value);
setcookie ("free", 1);
$cmsg = "With this coupon you can buy any item by
".get_range($mc_value)." for free";
}
if($mc_tno==5)
{
if(get_qty($userid) >= $mc_order)
{
setcookie ("exp_free", 1);
$cmsg = "Buy $mc_order items
With this coupon, you have free shipping";
}else{
setcookie ("exp_free", "");
}
}
setcookie ("txt_coupon", $txt_coupon);
}
}
}
// end coupon code
// ref code 25-06-2003
$cdate = date('Y-m-d H:i:s');
$ip = $REMOTE_ADDR;
$old_ctime = date ("Y-m-d H:i:s", mktime(date('H'),date('i')-120,date('s'),date('m'),date('d'),date('Y')));
$query = "select refid from ref_log where ip='$ip' && cdate>='$old_ctime'";
$result = mysql_query($query);
$num = mysql_num_rows($result);
if($num == 0) {
$ref = $HTTP_REFERER;
$hit_to = "http://www.jewelryglamour.com/fashion-shopping-cart.php?".$QUERY_STRING;
$query = "insert into ref_log values(null,'$ip','$ref','$hit_to','$cdate')";
mysql_query($query);
} // end ref code
$cquery = mysql_query("select currency, value, symbol from currency where cid = '$currencyid'");
$crow = mysql_fetch_array($cquery);
$currency = $crow["currency"];
$cur_value = $crow["value"];
$cur_symbol = $crow["symbol"];
function disp_num($num,$cop) {
if ($cop == '2') {
$num = number_format($num,2,'.','');
} else {
$num = number_format($num,2,',','');
}
//echo "";
return $num;
}
?>
Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'da_admin'@'localhost' (using password: YES) in /home/jewelrygl/domains/jewelryglamour.com/public_html/common/db.inc.php on line 6 UNABLE TO CONNECT TO DATABASE |