本文整理汇总了PHP中main::userid方法的典型用法代码示例。如果您正苦于以下问题:PHP main::userid方法的具体用法?PHP main::userid怎么用?PHP main::userid使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类main
的用法示例。
在下文中一共展示了main::userid方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: smtp
public function smtp()
{
global $dbh, $postvar, $getvar, $instance;
$body = eregi_replace("[\\]", '', $body);
$users_data = $dbh->select("users", array("email", "=", $instance->email['to']), 0, "1");
$to_name = $users_data['firstname'] . " " . $users_data['lastname'];
if ($to_name == " ") {
$staff_data = $dbh->select("staff", array("email", "=", $instance->email['to']), 0, "1");
$to_name = $staff_data['name'];
}
if (!class_exists("PHPMailer")) {
include INC . "/smtp/class_phpmailer.php";
}
$mail = new PHPMailer();
$mail->IsSMTP();
// telling the class to use SMTP
$mail->SMTPAuth = true;
// enable SMTP authentication (Log in with credentials to send)
$mail->SMTPKeepAlive = true;
// SMTP connection will not close after each email sent
$mail->Host = $instance->details['smtp_host'];
// sets the SMTP server
$mail->Port = $dbh->config('smtp_port');
// set the SMTP port for the SMTP server
$mail->Username = $instance->details['smtp_user'];
// SMTP account username
$mail->Password = $instance->details['smtp_password'];
// SMTP account password
$mail->SetFrom($instance->details['from'], $dbh->config('name'));
$mail->AddReplyTo($instance->details['from'], $dbh->config('name'));
$mail->Subject = $instance->email['subject'];
$mail->MsgHTML($instance->email['content']);
$mail->AddAddress($instance->email['to'], $to_name);
if (!$mail->Send()) {
$response = "Mailer Error (" . $instance->email['to'] . ') ' . $mail->ErrorInfo . "\n";
main::thtlog("SMTP Error", $response, main::userid());
$mail->ClearAddresses();
return false;
}
$mail->ClearAddresses();
return true;
}
示例2: getMonthly
private function getMonthly($id, $user = "")
{
$type_additional = type::additional($id);
if (!$user) {
$user = $_SESSION['cuser'];
}
if (!is_numeric($user)) {
$user = main::userid($user);
}
$type_additional['monthly'] = coupons::get_discount("p2hmonthly", $type_additional['monthly'], $user);
return $type_additional['monthly'];
}
示例3: validate_coupon
public function validate_coupon($coupcode, $areaused, $uname, $package)
{
global $dbh, $postvar, $getvar, $instance;
$userid = main::userid($uname);
$coupon_info = self::coupon_data($coupcode);
if (empty($coupon_info)) {
return false;
}
if ($coupon_info['expiredate'] != "99/99/9999") {
$today = time();
$coupon_expiry = explode("/", $coupon_info['expiredate']);
$expiry_time = mktime(date("H"), date("i"), date("s"), ltrim($coupon_expiry[0]), ltrim($coupon_expiry[1]), $coupon_expiry[2]);
if ($today >= $expiry_time) {
return false;
}
}
if ($coupon_info['area'] != "both" && $coupon_info['area'] != $areaused) {
return false;
}
if ($coupon_info['user'] != "all" && $coupon_info['user'] != $uname) {
return false;
}
if ($coupon_info['packages'] != "all") {
$available_packs = explode(",", $coupon_info['packages']);
if (!in_array($package, $available_packs)) {
return false;
}
}
if ($coupon_info['limited']) {
$coupons_used_query = $dbh->select("coupons_used", array("coupcode", "=", $coupcode), 0, 0, 1);
$coupons_used_rows = $dbh->num_rows($coupons_used_query);
if ($coupons_used_rows >= $coupon_info['limited']) {
return false;
}
}
$coupon_used = self::user_coupon_data($userid, 0, $coupcode);
if (!empty($coupon_used) && $coupon_used['disabled'] != '2') {
return false;
}
//All checks passed.
//
//Brok
// en
// Eng
// lish
// lol
$package_type = type::packagetype($package);
$package_info = type::additional($package);
$package_monthly = $package_info['monthly'];
$package_p2hinit = $package_info['signup'];
$paidtype = $coupon_info['paidtype'];
$p2hinittype = $coupon_info['p2hinittype'];
$p2hmonthlytype = $coupon_info['p2hmonthlytype'];
$coupon_info['paiddisc'] = self::percent_to_value("paid", $paidtype, $coupon_info['paiddisc'], $package_monthly);
$coupon_info['p2hinitdisc'] = self::percent_to_value("p2h", $p2hinittype, $coupon_info['p2hinitdisc'], $package_p2hinit);
$coupon_info['p2hmonthlydisc'] = self::percent_to_value("p2h", $p2hmonthlytype, $coupon_info['p2hmonthlydisc'], $package_monthly);
if ($package_type == "paid") {
if ($coupon_info['paiddisc'] >= $package_monthly) {
$coupon_text = "Free ";
} else {
$they_pay = $package_monthly - $coupon_info['paiddisc'];
$currency = main::money($they_pay);
$coupon_text = "Only pay " . $currency . " ";
$pay_per_month = "/month";
}
} else {
$init_required = $package_p2hinit - $coupon_info['p2hinitdisc'];
$monthly_required = $package_monthly - $coupon_info['p2hmonthlydisc'];
if ($init_required > 1) {
$s = "s";
}
if ($monthly_required > 1) {
$s2 = "s";
}
if ($coupon_info['p2hinitdisc'] >= $package_p2hinit) {
$coupon_p2hdisc = "0 Posts";
} else {
$coupon_p2hdisc = $init_required . " Post" . $s . " required";
}
if ($coupon_info['p2hmonthlydisc'] >= $package_monthly) {
$coupon_p2hmonth = "0 Posts";
} else {
$coupon_p2hmonth = $monthly_required . " Post" . $s2 . " required";
}
if ($coupon_info['p2hinitdisc'] > 0 && $coupon_info['p2hmonthlydisc'] > 0) {
$coupon_text = $coupon_p2hdisc . " to sign up and " . $coupon_p2hmonth . " for the month";
} else {
if ($coupon_info['p2hinitdisc'] > 0) {
$coupon_text = $coupon_p2hdisc . " to sign up";
$no_goodfor = "1";
//YOU! lol Good for nothing? lol
} else {
$coupon_text = $coupon_p2hmonth . " for the month";
}
}
}
if ($coupon_info['goodfor'] == "life") {
$coupon_text .= $pay_per_month . " for the lifetime of the account.";
}
if ($coupon_info['goodfor'] == "current") {
//.........这里部分代码省略.........