File: customservices.php

package info (click to toggle)
dtc 0.35.5-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 18,824 kB
  • sloc: php: 50,739; sh: 8,596; makefile: 572; perl: 148; xml: 25
file content (111 lines) | stat: -rw-r--r-- 4,490 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php

function drawAdminTools_Custom($admin,$custom_id){
	global $adm_login;
	global $adm_pass;
	global $rub;
	global $addrlink;

	global $pro_mysql_product_table;
	global $pro_mysql_custom_product_table;
	global $pro_mysql_custom_heb_types_table;

	global $secpayconf_currency_letters;
	global $secpayconf_use_products_for_renewal;
	global $conf_post_or_get;

	global $submit_err_custom;

	get_secpay_conf();

	$out = "<font color=\"red\">$submit_err_custom</font>";

	// Check owner and fetch!
	checkCustomAdmin($adm_login,$adm_pass,$custom_id);
	$q = "SELECT * FROM $pro_mysql_custom_product_table WHERE id='$custom_id';";
	$r = mysql_query($q)or die("Cannot query $q line ".__LINE__." file ".__FILE__." sql said: ".mysql_error());
	$n = mysql_num_rows($r);
	if($n != 1){
		$out .= _("Custom id not found!");
		return $out;
	}
	$custom_prod = mysql_fetch_array($r);

	// Display the current contract
	$q = "SELECT * FROM $pro_mysql_product_table WHERE id='".$custom_prod["product_id"]."';";
	$r = mysql_query($q)or die("Cannot query $q line ".__LINE__." file ".__FILE__." sql said: ".mysql_error());
	$n = mysql_num_rows($r);
	if($n == 1){
		$server_prod = mysql_fetch_array($r);
		$contract = $server_prod["name"];
	}else{
		$contact = _("Not found!");
	}

	$additiona_info = "";
	if($server_prod["custom_heb_type"] != 0){
		$q = "SELECT * FROM $pro_mysql_custom_heb_types_table WHERE id='".$server_prod["custom_heb_type"]."'";
		$r = mysql_query($q)or die("Cannot query $q line ".__LINE__." file ".__FILE__." sql said: ".mysql_error());
		$n = mysql_num_rows($r);
		if($n == 1){
			$custom_heb_types = mysql_fetch_array($r);
			if($custom_heb_types["reqdomain"] == "yes"){
				$additiona_info .= "<br>"._("Domain name:")." ".$custom_prod["domain"];
			}
		}else{
			$additiona_info .= "<br>"._("Warning: no custom type found")." line ".__LINE__." file ".__FILE__;
		}
	}
	$out .= "<h3>". _("Custom product contract:") ."</h3>
<br>
"._("Custom product contract:")." ".$contract.$additiona_info."
<br><br>";

	$ar = explode("-",$custom_prod["expire_date"]);
	$out .= "<b><u>". _("Custom product expiration dates:") ."</u></b><br>";
	$out .= _("Your custom product was first registered on the:") ." ".$custom_prod["start_date"]."<br>";
	if(date("Y") > $ar[0] ||
			(date("Y") == $ar[0] && date("m") > $ar[1]) ||
			(date("Y") == $ar[0] && date("m") == $ar[1] && date("d") > $ar[2])){
		$out .= "<font color=\"red\">". _("Your custom product has expired on the: ") .$custom_prod["expire_date"]."</font>"
		."<br>". _("Please renew it with one of the following options") ."<br>";
	}else{
		$out .= _("Your custom product will expire on the: ") .$custom_prod["expire_date"];
	}

	if ($secpayconf_use_products_for_renewal == 'yes'){
	    $q = "SELECT name, price_dollar FROM $pro_mysql_product_table WHERE id='".$custom_prod["product_id"]."';";
	    $r = mysql_query($q)or die("Cannot query $q line ".__LINE__." file ".__FILE__." sql said: ".mysql_error());
	    $n = mysql_num_rows($r);
	    if($n == 1){
		$a = mysql_fetch_array($r);
		$out .= "<br><form method=\"$conf_post_or_get\" action=\"/dtc/new_account.php\">
		<input type=\"hidden\" name=\"action\" value=\"contract_renewal\">
		<input type=\"hidden\" name=\"renew_type\" value=\"custom\">
		<input type=\"hidden\" name=\"product_id\" value=\"".$custom_prod["product_id"]."\">
		<input type=\"hidden\" name=\"custom_id\" value=\"".$custom_prod["id"]."\">
		<input type=\"hidden\" name=\"adm_login\" value=\"$adm_login\">
		".submitButtonStart().$a["name"]." (".$a["price_dollar"]." $secpayconf_currency_letters)".submitButtonEnd()."
		</form><br>";
	    }
	}

	$q = "SELECT * FROM $pro_mysql_product_table WHERE renew_prod_id='".$custom_prod["product_id"]."';";
	$r = mysql_query($q)or die("Cannot query $q line ".__LINE__." file ".__FILE__." sql said: ".mysql_error());
	$n = mysql_num_rows($r);
	for($i=0;$i<$n;$i++){
		$a = mysql_fetch_array($r);
		$out .= "<br><form method=\"$conf_post_or_get\" action=\"/dtc/new_account.php\">
		<input type=\"hidden\" name=\"action\" value=\"contract_renewal\">
		<input type=\"hidden\" name=\"renew_type\" value=\"custom\">
		<input type=\"hidden\" name=\"product_id\" value=\"".$a["id"]."\">
		<input type=\"hidden\" name=\"custom_id\" value=\"".$custom_prod["id"]."\">
		<input type=\"hidden\" name=\"adm_login\" value=\"$adm_login\">
		".submitButtonStart().$a["name"]." (".$a["price_dollar"]." $secpayconf_currency_letters)".submitButtonEnd()."
		</form><br>";
	}

	return $out;
}

?>