- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试设置一个 Laravel 网站,并且我已经能够完成一些工作,但随后我遇到了此错误。
出于安全原因,mail() 已被禁用
我曾尝试联系我的托管服务提供商以协助激活该功能,但他们让我大吃一惊,说他们无法激活该功能,我应该尝试修改邮件程序的标题,以便它不需要这样做。
请问我怎么能做到这一点,因为我不是邮件 php 的专家。
这是我的错误如下:
ErrorException thrown with message "mail() has been disabled for security reasons"
Stacktrace:
#57 ErrorException in /home/zcashcom/public_html/invest/core/app/Http/helpers/helpers.php:19
#56 mail in /home/zcashcom/public_html/invest/core/app/Http/helpers/helpers.php:19
这是文件的完整代码,有问题的 helpers.php
<?php
use App\General;
use App\User;
use App\MemberExtra;
function send_email($to, $subject, $name, $message){
$general = General::first();
if ($general->email_nfy == 1){
$headers = "From: ".$general->web_title." <".$general->esender."> \r\n";
$headers .= "Reply-To: ".$general->web_title." <".$general->esender."> \r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$template = $general->emessage;
$mm = str_replace("{{name}}",$name,$template);
$message = str_replace("{{message}}",$message,$mm);
mail($to, $subject, $message, $headers);
}else {
return;
}
}
function send_sms( $to, $message){
$gnl = General::first();
if($gnl->sms_nfy == 1) {
$sendtext = urlencode("$message");
$appi = $gnl->smsapi;
$appi = str_replace("{{number}}",$to,$appi);
$appi = str_replace("{{message}}",$sendtext,$appi);
$result = file_get_contents($appi);
}
return;
}
function updateDepositBV($id, $deposit_amount)
{
while($id !="" || $id != "0") {
if(isMemberExists($id))
{
$posid = getParentId($id);
if($posid == "0")
break;
$position = getPositionParent($id);
$currentBV = MemberExtra::where('user_id', $posid)->first();
if($position == "L"){
$new_lbv = $currentBV->left_bv + $deposit_amount ;
$new_rbv = $currentBV->right_bv;
}else{
$new_lbv = $currentBV->left_bv;
$new_rbv = $currentBV->right_bv + $deposit_amount ;
}
MemberExtra::where('user_id', $posid)
->update([
'left_bv' => $new_lbv,
'right_bv' => $new_rbv,
]);
$id = $posid;
} else {
break;
}
}//while
return 0;
}
function updatePaid($id){
while($id!=""||$id!="0"){
if(isMemberExists($id)) {
$posid=getParentId($id);
if($posid == "0")
break;
$position = getPositionParent($id);
$currentCount = MemberExtra::where('user_id',$posid )->first();
$new_lpaid = $currentCount->left_paid;
$new_rpaid = $currentCount->right_paid;
$new_lfree = $currentCount->left_free;
$new_rfree = $currentCount->right_free;
if($position == "L") {
$new_lfree = $new_lfree-1;
$new_lpaid = $new_lpaid+1;
}else {
$new_rfree = $new_rfree-1;
$new_rpaid = $new_rpaid+1;
}
MemberExtra::where('user_id', $posid)
->update([
'left_paid' => $new_lpaid,
'right_paid' => $new_rpaid,
'left_free' => $new_lfree,
'right_free' => $new_rfree,
]);
$id =$posid;
} else {
break;
}
}
return 0;
}
function treeeee($id ='', $uid=''){
while($id!=""||$id!="0") {
if(isMemberExists($id)){
$posid=getParentId($id);
if($posid=="0")
break;
if($posid==$uid){
return true;
}
$id =$posid;
} else {
break;
}
}//while
return 0;
}
function printBV($id){
$cbv = MemberExtra::where('user_id', $id)->first();
$rid = User::whereId($id)->first();
$rnm = User::where('id', $rid->referrer_id)->first();
echo "<b>Referred By:</b> $rnm->username <br>";
echo "<b>Current BV:</b> L-$cbv->left_bv | R-$cbv->right_bv <br>";
}
function printBelowMember($id){
$bmbr = MemberExtra::where('user_id', $id)->first() ;
echo "<b>Paid Member Below:</b> L-$bmbr->left_paid | R-$bmbr->right_paid <br>";
echo "<b>Free Member Below:</b> L-$bmbr->left_free | R-$bmbr->right_free <br>";
}
function updateMemberBelow($id='', $type=''){
while($id!=""||$id!="0") {
if(isMemberExists($id)) {
$posid=getParentId($id);
if($posid=="0")
break;
$position=getPositionParent($id);
$currentCount = MemberExtra::where('user_id', $posid)->first() ;
$new_lpaid = $currentCount->left_paid;
$new_rpaid = $currentCount->right_paid;
$new_lfree = $currentCount->left_free;
$new_rfree = $currentCount->right_free;
if($position=="L") {
if($type=='FREE'){
$new_lfree = $new_lfree + 1;
}else{
$new_lpaid = $new_lpaid+1;
}
}else {
if($type=='FREE'){
$new_rfree = $new_rfree + 1;
}else{
$new_rpaid = $new_rpaid+1;
}
}
MemberExtra::where('user_id', $posid)
->update([
'left_paid' => $new_lpaid,
'right_paid' => $new_rpaid,
'left_free' => $new_lfree,
'right_free' => $new_rfree,
]);
$id =$posid;
} else{
break;
}
}
return 0;
}
function getParentId($id){
$count = User::whereId($id)->count() ;
$posid = User::whereId($id)->first();
if ($count == 1){
return $posid->posid;
}else{
return 0;
}
}
function getPositionParent($id){
$count = User::whereId($id)->count();
$position = User::whereId($id)->first() ;
if ($count == 1){
return $position->position;
}else{
return 0;
}
}
function getLastChildOfLR($parentid ,$position){
$childid = getTreeChildId($parentid, $position);
if($childid!="-1"){
$id = $childid;
} else {
$id = $parentid;
}
while($id!=""||$id!="0") {
if(isMemberExists($id)) {
$nextchildid = getTreeChildId($id, $position);
if($nextchildid == "-1"){
break;
}else{
$id = $nextchildid;
}
}else break;
}
return $id;
}
function getTreeChildId($parentid ,$position){
$cou = User::where('posid', $parentid)->where('position', $position)->count();
$cid = User::where('posid', $parentid)->where('position', $position)->first();
if ($cou == 1){
return $cid->id;
}else{
return -1;
}
}
function isMemberExists($id){
$count = User::where('id', $id)->count();
if ($count == 1){
return true;
}else{
return false;
}
}
function Short_Text($data,$length){
$first_part = explode(" ",$data);
$main_part = strip_tags(implode(' ',array_splice($first_part,0, $length)));
return $main_part ."...." ;
}
function ImageCheck($ext){
if($ext != 'jpg' && $ext != 'jpeg' && $ext != 'png' && $ext != 'bnp'){
$ext = "";
}
return $ext;
}
function NewFile($name, $data){
$fh = fopen($name, "w");
fwrite($fh,$data);
fclose($fh);
}
function ViewFile($name){
$fh = fopen($name, "r");
$data = fread($fh,filesize($name));
fclose($fh);
return $data;
}
function Find_fist_int($string){
preg_match_all('!\d+!', $string, $matches);
if($matches[0] != ""){
foreach($matches[0] as $key => $value){
$url = $value;
return $url;
break;
}
}
}
function Replace($data) {
$data = str_replace("'", "", $data);
$data = str_replace("!", "", $data);
$data = str_replace("@", "", $data);
$data = str_replace("#", "", $data);
$data = str_replace("$", "", $data);
$data = str_replace("%", "", $data);
$data = str_replace("^", "", $data);
$data = str_replace("&", "", $data);
$data = str_replace("*", "", $data);
$data = str_replace("(", "", $data);
$data = str_replace(")", "", $data);
$data = str_replace("+", "", $data);
$data = str_replace("=", "", $data);
$data = str_replace(",", "", $data);
$data = str_replace(":", "", $data);
$data = str_replace(";", "", $data);
$data = str_replace("|", "", $data);
$data = str_replace("'", "", $data);
$data = str_replace('"', "", $data);
$data = str_replace("?", "", $data);
$data = str_replace(" ", "_", $data);
$data = str_replace("'", "", $data);
$data = str_replace(".", "-", $data);
$data = strtolower(str_replace(" ", "-", $data));
$data = strtolower(str_replace(" ", "-", $data));
$data = strtolower(str_replace(" ", "-", $data));
$data = strtolower(str_replace("__", "-", $data));
return str_replace("_", "-", $data);
}
**根据第一 react 进行编辑
<?php
namespace App\Http\Controllers\Auth;
use App\ChargeCommision;
use App\Income;
use App\MemberExtra;
use App\User;
use App\General;
use App\Http\Controllers\Controller;
use Carbon\Carbon;
use Illuminate\Support\Facades\Validator;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Http\Request;
use Illuminate\Auth\Events\Registered;
class RegisterController extends Controller
{
/*
|--------------------------------------------------------------------------
| Register Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users as well as their
| validation and creation. By default this controller uses a trait to
| provide this functionality without requiring any additional code.
|
*/
use RegistersUsers;
/**
* Where to redirect users after registration.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:6|confirmed',
'referrer_id' => 'required',
'position' => 'required',
'first_name' => ['required', 'regex:/^[A-ZÀÂÇÉÈÊËÎÏÔÛÙÜŸÑÆŒa-zàâçéèêëîïôûùüÿñæœ0-9_.,() ]+$/'],
'last_name' => ['required', 'regex:/^[A-ZÀÂÇÉÈÊËÎÏÔÛÙÜŸÑÆŒa-zàâçéèêëîïôûùüÿñæœ0-9_.,() ]+$/'],
'birth_day' => 'required',
'mobile' => 'required',
'street_address' => 'required',
'city' => ['required', 'regex:/^[A-ZÀÂÇÉÈÊËÎÏÔÛÙÜŸÑÆŒa-zàâçéèêëîïôûùüÿñæœ0-9_.,() ]+$/'],
'post_code' => 'required|numeric|min:0',
'country' => 'required',
'username' => 'required',
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return \App\User
*/
protected function create(array $data)
{
$pin = substr(time(), 4);
$ref_id = $data['referrer_id'];
$poss = $data['position'];
$posid = getLastChildOfLR($ref_id,$poss);
// $general = General::first();
$message = '<tr>';
$message .='<td style="font-family: sans-serif; font-size: 14px; vertical-align: top;">';
$message .='<p style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px;color:green;">Our warmest congratulations on your new account opening! This only shows that you have grown your business well. I pray for your prosperous.</p>';
$message .='<p style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px;">You have taken this path knowing that you can do it. Good luck with your new business. I wish you all the success and fulfillment towards your goal.</p>';
$message .='<p style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px;">Your username is '.$data['username'].' .</p>';
$message .='<p style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px;">Your password is '.$data['password'].' .</p>';
$message .='<p style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px; color:red;">Remember, never share your password with otherone. And you are agree with our Terms and Policy.</p>';
$message .='</td>';
$message .='</tr>';
send_email($data['email'], 'Account Created Successfully', $data['first_name'], $message);
$sms = 'Congratulation, for registration. Your username is '.$data['username'].'. Your password is '.$data['password'].'';
send_sms($data['mobile'], $sms);
return User::create([
'email' => $data['email'],
'password' => bcrypt($data['password']),
'referrer_id' => $data['referrer_id'],
'position' => $data['position'],
'first_name' => $data['first_name'],
'last_name' => $data['last_name'],
'mobile' => $data['mobile'],
'street_address' => $data['street_address'],
'city' => $data['city'],
'post_code' => $data['post_code'],
'country' => $data['country'],
'username' => $data['username'],
'birth_day' => date('Y-m-d',strtotime($data['birth_day'])),
'join_date' => Carbon::today(),
'balance' => 0,
'status' => 1,
'paid_status' => 0,
'ver_status' => 0,
'ver_code' => $pin,
'forget_code' => 0,
'posid' => $posid,
'tauth' => 0,
'tfver' => 1,
'emailv' => 0,
'smsv' => 1,
]);
}
public function register(Request $request)
{
$this->validator($request->all())->validate();
event(new Registered($user = $this->create($request->all())));
$this->guard()->login($user);
MemberExtra::create([
'user_id' => $user['id'],
'left_paid' => 0,
'right_paid' => 0,
'left_free' => 0,
'right_free' => 0,
'left_bv' => 0,
'right_bv' => 0,
]);
updateMemberBelow($user['id'], 'FREE');
return $this->registered($request, $user)
?: redirect($this->redirectPath());
}
}
和 RedirectifAuthenticated.php:24
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Support\Facades\Auth;
class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @param string|null $guard
* @return mixed
*/
public function handle($request, Closure $next, $guard = null)
{
if (Auth::guard($guard)->check()) {
return redirect('/home');
}
return $next($request);
}
}
错误消息的图像
<?php
return [
'driver' => env('MAIL_DRIVER', 'smtp'),
'host' => env('MAIL_HOST', 'smtp.mailgun.org'),
'port' => env('MAIL_PORT', 587),
'from' => [
'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
'encryption' => env('MAIL_ENCRYPTION', 'tls'),
'username' => env('MAIL_USERNAME'),
'password' => env('MAIL_PASSWORD'),
'sendmail' => '/usr/sbin/sendmail -bs',
'markdown' => [
'theme' => 'default',
'paths' => [
resource_path('views/vendor/mail'),
],
],
];
根据评论中的响应进行配置后,我收到一条新的错误消息
Call to undefined function App\Http\Controllers\Auth\getLastChildOfLR()
注册 Controller .php:87
<?php
namespace App\Http\Controllers\Auth;
use App\ChargeCommision;
use App\Income;
use App\MemberExtra;
use App\User;
use App\General;
use App\Http\Controllers\Controller;
use Carbon\Carbon;
use Illuminate\Support\Facades\Validator;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Http\Request;
use Illuminate\Auth\Events\Registered;
class RegisterController extends Controller
{
/*
|--------------------------------------------------------------------------
| Register Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users as well as their
| validation and creation. By default this controller uses a trait to
| provide this functionality without requiring any additional code.
|
*/
use RegistersUsers;
/**
* Where to redirect users after registration.
*
* @var string
*/
protected $redirectTo = '/home';
/**
* Create a new controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware('guest');
}
/**
* Get a validator for an incoming registration request.
*
* @param array $data
* @return \Illuminate\Contracts\Validation\Validator
*/
protected function validator(array $data)
{
return Validator::make($data, [
'email' => 'required|string|email|max:255|unique:users',
'password' => 'required|string|min:6|confirmed',
'referrer_id' => 'required',
'position' => 'required',
'first_name' => ['required', 'regex:/^[A-ZÀÂÇÉÈÊËÎÏÔÛÙÜŸÑÆŒa-zàâçéèêëîïôûùüÿñæœ0-9_.,() ]+$/'],
'last_name' => ['required', 'regex:/^[A-ZÀÂÇÉÈÊËÎÏÔÛÙÜŸÑÆŒa-zàâçéèêëîïôûùüÿñæœ0-9_.,() ]+$/'],
'birth_day' => 'required',
'mobile' => 'required',
'street_address' => 'required',
'city' => ['required', 'regex:/^[A-ZÀÂÇÉÈÊËÎÏÔÛÙÜŸÑÆŒa-zàâçéèêëîïôûùüÿñæœ0-9_.,() ]+$/'],
'post_code' => 'required|numeric|min:0',
'country' => 'required',
'username' => 'required',
]);
}
/**
* Create a new user instance after a valid registration.
*
* @param array $data
* @return \App\User
*/
protected function create(array $data)
{
$pin = substr(time(), 4);
$ref_id = $data['referrer_id'];
$poss = $data['position'];
$posid = getLastChildOfLR($ref_id,$poss);
// $general = General::first();
$message = '<tr>';
$message .='<td style="font-family: sans-serif; font-size: 14px; vertical-align: top;">';
$message .='<p style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px;color:green;">Our warmest congratulations on your new account opening! This only shows that you have grown your business well. I pray for your prosperous.</p>';
$message .='<p style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px;">You have taken this path knowing that you can do it. Good luck with your new business. I wish you all the success and fulfillment towards your goal.</p>';
$message .='<p style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px;">Your username is '.$data['username'].' .</p>';
$message .='<p style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px;">Your password is '.$data['password'].' .</p>';
$message .='<p style="font-family: sans-serif; font-size: 14px; font-weight: normal; margin: 0; Margin-bottom: 15px; color:red;">Remember, never share your password with otherone. And you are agree with our Terms and Policy.</p>';
$message .='</td>';
$message .='</tr>';
send_email($data['email'], 'Account Created Successfully', $data['first_name'], $message);
$sms = 'Congratulation, for registration. Your username is '.$data['username'].'. Your password is '.$data['password'].'';
send_sms($data['mobile'], $sms);
return User::create([
'email' => $data['email'],
'password' => bcrypt($data['password']),
'referrer_id' => $data['referrer_id'],
'position' => $data['position'],
'first_name' => $data['first_name'],
'last_name' => $data['last_name'],
'mobile' => $data['mobile'],
'street_address' => $data['street_address'],
'city' => $data['city'],
'post_code' => $data['post_code'],
'country' => $data['country'],
'username' => $data['username'],
'birth_day' => date('Y-m-d',strtotime($data['birth_day'])),
'join_date' => Carbon::today(),
'balance' => 0,
'status' => 1,
'paid_status' => 0,
'ver_status' => 0,
'ver_code' => $pin,
'forget_code' => 0,
'posid' => $posid,
'tauth' => 0,
'tfver' => 1,
'emailv' => 0,
'smsv' => 1,
]);
}
public function register(Request $request)
{
$this->validator($request->all())->validate();
event(new Registered($user = $this->create($request->all())));
$this->guard()->login($user);
MemberExtra::create([
'user_id' => $user['id'],
'left_paid' => 0,
'right_paid' => 0,
'left_free' => 0,
'right_free' => 0,
'left_bv' => 0,
'right_bv' => 0,
]);
updateMemberBelow($user['id'], 'FREE');
return $this->registered($request, $user)
?: redirect($this->redirectPath());
}
}
最佳答案
如果出于安全原因停用邮件,则不应使用它。事实上,如果你用谷歌搜索这个主题,你会发现一些严重的结果,为什么你不应该使用它。
我希望你在你的主机上有一个电子邮件帐户,对吗?那么你有什么理由不想使用 laravel 的邮件功能呢?
在您的 .env 文件中,您为您的电子邮件帐户设置了正确的参数:
MAIL_DRIVER=smtp
MAIL_HOST=smtp.googlemail.com
MAIL_PORT=465
MAIL_USERNAME=name@gmail.com
MAIL_PASSWORD=password
MAIL_ENCRYPTION=ssl
有时您还需要定义 MAIL_FROM_ADDRESS 参数。如果您不确定您会在配置的 mail.php 文件中找到所有可能的配置选项。
Mail::raw('your message', function ($message) use ($request) {
$message->to('email@receiver.com');
$message->from('youremail@sender.com');
$message->subject("Email subject");
});
我不知道你想达到什么目的,但如果你只想发送一些简单的信息,也许你应该使用 laravel 通知。
<?php
//edited
use App\General;
use App\User;
use App\MemberExtra;
function send_email($to, $subject, $name, $message){
$general = General::first();
if ($general->email_nfy == 1){
$headers = "From: ".$general->web_title." <".$general->esender."> \r\n";
$headers .= "Reply-To: ".$general->web_title." <".$general->esender."> \r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$template = $general->emessage;
$mm = str_replace("{{name}}",$name,$template);
$message = str_replace("{{message}}",$message,$mm);
//mail($to, $subject, $message, $headers);
}else {
return;
}
}
function send_sms( $to, $message){
$gnl = General::first();
if($gnl->sms_nfy == 1) {
$sendtext = urlencode("$message");
$appi = $gnl->smsapi;
$appi = str_replace("{{number}}",$to,$appi);
$appi = str_replace("{{message}}",$sendtext,$appi);
$result = file_get_contents($appi);
}
return;
}
function updateDepositBV($id, $deposit_amount)
{
while($id !="" || $id != "0") {
if(isMemberExists($id))
{
$posid = getParentId($id);
if($posid == "0")
break;
$position = getPositionParent($id);
$currentBV = MemberExtra::where('user_id', $posid)->first();
if($position == "L"){
$new_lbv = $currentBV->left_bv + $deposit_amount ;
$new_rbv = $currentBV->right_bv;
}else{
$new_lbv = $currentBV->left_bv;
$new_rbv = $currentBV->right_bv + $deposit_amount ;
}
MemberExtra::where('user_id', $posid)
->update([
'left_bv' => $new_lbv,
'right_bv' => $new_rbv,
]);
$id = $posid;
} else {
break;
}
}//while
return 0;
}
function updatePaid($id){
while($id!=""||$id!="0"){
if(isMemberExists($id)) {
$posid=getParentId($id);
if($posid == "0")
break;
$position = getPositionParent($id);
$currentCount = MemberExtra::where('user_id',$posid )->first();
$new_lpaid = $currentCount->left_paid;
$new_rpaid = $currentCount->right_paid;
$new_lfree = $currentCount->left_free;
$new_rfree = $currentCount->right_free;
if($position == "L") {
$new_lfree = $new_lfree-1;
$new_lpaid = $new_lpaid+1;
}else {
$new_rfree = $new_rfree-1;
$new_rpaid = $new_rpaid+1;
}
MemberExtra::where('user_id', $posid)
->update([
'left_paid' => $new_lpaid,
'right_paid' => $new_rpaid,
'left_free' => $new_lfree,
'right_free' => $new_rfree,
]);
$id =$posid;
} else {
break;
}
}
return 0;
}
function treeeee($id ='', $uid=''){
while($id!=""||$id!="0") {
if(isMemberExists($id)){
$posid=getParentId($id);
if($posid=="0")
break;
if($posid==$uid){
return true;
}
$id =$posid;
} else {
break;
}
}//while
return 0;
}
function printBV($id){
$cbv = MemberExtra::where('user_id', $id)->first();
$rid = User::whereId($id)->first();
$rnm = User::where('id', $rid->referrer_id)->first();
echo "<b>Referred By:</b> $rnm->username <br>";
echo "<b>Current BV:</b> L-$cbv->left_bv | R-$cbv->right_bv <br>";
}
function printBelowMember($id){
$bmbr = MemberExtra::where('user_id', $id)->first() ;
echo "<b>Paid Member Below:</b> L-$bmbr->left_paid | R-$bmbr->right_paid <br>";
echo "<b>Free Member Below:</b> L-$bmbr->left_free | R-$bmbr->right_free <br>";
}
function updateMemberBelow($id='', $type=''){
while($id!=""||$id!="0") {
if(isMemberExists($id)) {
$posid=getParentId($id);
if($posid=="0")
break;
$position=getPositionParent($id);
$currentCount = MemberExtra::where('user_id', $posid)->first() ;
$new_lpaid = $currentCount->left_paid;
$new_rpaid = $currentCount->right_paid;
$new_lfree = $currentCount->left_free;
$new_rfree = $currentCount->right_free;
if($position=="L") {
if($type=='FREE'){
$new_lfree = $new_lfree + 1;
}else{
$new_lpaid = $new_lpaid+1;
}
}else {
if($type=='FREE'){
$new_rfree = $new_rfree + 1;
}else{
$new_rpaid = $new_rpaid+1;
}
}
MemberExtra::where('user_id', $posid)
->update([
'left_paid' => $new_lpaid,
'right_paid' => $new_rpaid,
'left_free' => $new_lfree,
'right_free' => $new_rfree,
]);
$id =$posid;
} else{
break;
}
}
return 0;
}
function getParentId($id){
$count = User::whereId($id)->count() ;
$posid = User::whereId($id)->first();
if ($count == 1){
return $posid->posid;
}else{
return 0;
}
}
function getPositionParent($id){
$count = User::whereId($id)->count();
$position = User::whereId($id)->first() ;
if ($count == 1){
return $position->position;
}else{
return 0;
}
}
function getLastChildOfLR($parentid ,$position){
$childid = getTreeChildId($parentid, $position);
if($childid!="-1"){
$id = $childid;
} else {
$id = $parentid;
}
while($id!=""||$id!="0") {
if(isMemberExists($id)) {
$nextchildid = getTreeChildId($id, $position);
if($nextchildid == "-1"){
break;
}else{
$id = $nextchildid;
}
}else break;
}
return $id;
}
function getTreeChildId($parentid ,$position){
$cou = User::where('posid', $parentid)->where('position', $position)->count();
$cid = User::where('posid', $parentid)->where('position', $position)->first();
if ($cou == 1){
return $cid->id;
}else{
return -1;
}
}
function isMemberExists($id){
$count = User::where('id', $id)->count();
if ($count == 1){
return true;
}else{
return false;
}
}
function Short_Text($data,$length){
$first_part = explode(" ",$data);
$main_part = strip_tags(implode(' ',array_splice($first_part,0, $length)));
return $main_part ."...." ;
}
function ImageCheck($ext){
if($ext != 'jpg' && $ext != 'jpeg' && $ext != 'png' && $ext != 'bnp'){
$ext = "";
}
return $ext;
}
function NewFile($name, $data){
$fh = fopen($name, "w");
fwrite($fh,$data);
fclose($fh);
}
function ViewFile($name){
$fh = fopen($name, "r");
$data = fread($fh,filesize($name));
fclose($fh);
return $data;
}
function Find_fist_int($string){
preg_match_all('!\d+!', $string, $matches);
if($matches[0] != ""){
foreach($matches[0] as $key => $value){
$url = $value;
return $url;
break;
}
}
}
function Replace($data) {
$data = str_replace("'", "", $data);
$data = str_replace("!", "", $data);
$data = str_replace("@", "", $data);
$data = str_replace("#", "", $data);
$data = str_replace("$", "", $data);
$data = str_replace("%", "", $data);
$data = str_replace("^", "", $data);
$data = str_replace("&", "", $data);
$data = str_replace("*", "", $data);
$data = str_replace("(", "", $data);
$data = str_replace(")", "", $data);
$data = str_replace("+", "", $data);
$data = str_replace("=", "", $data);
$data = str_replace(",", "", $data);
$data = str_replace(":", "", $data);
$data = str_replace(";", "", $data);
$data = str_replace("|", "", $data);
$data = str_replace("'", "", $data);
$data = str_replace('"', "", $data);
$data = str_replace("?", "", $data);
$data = str_replace(" ", "_", $data);
$data = str_replace("'", "", $data);
$data = str_replace(".", "-", $data);
$data = strtolower(str_replace(" ", "-", $data));
$data = strtolower(str_replace(" ", "-", $data));
$data = strtolower(str_replace(" ", "-", $data));
$data = strtolower(str_replace("__", "-", $data));
return str_replace("_", "-", $data);
}
如果您在 .env 文件中配置了您的电子邮件帐户,这只会很困难。
关于laravel - ErrorException 抛出消息“出于安全原因,mail() 已被禁用”,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62627774/
我对cassandra并使用1.2.10非常陌生。我有一个时间戳数据类型的主键列。现在,我正在尝试检索日期范围的数据。由于我们知道不能在cassandra中使用,因此我使用的是大于()来获取日期范围。
我正在尝试进行有条件的转场。但我得到: Terminating app due to uncaught exception 'NSInvalidArgumentException', reas
我有一个游戏项目,在调试和发布模式下在设备上运行得非常好。我有两个版本。旧版本和新版本具有更多(后来我添加了)功能,并且两者的 bundle ID、版本相同。当我构建旧版本时,之前没有安装“myGam
这个问题已经有答案了: 奥 git _a (2 个回答) 已关闭 5 年前。 我正在获取 ClassCastException 。这两个类来自不同的 jar,但是JettyContinuationPr
以下代码行抛出异常: HttpResponse response = client.execute(request); // actual HTTP request 我能够捕获它并打印: Log
就目前情况而言,这个问题不太适合我们的问答形式。我们希望答案得到事实、引用资料或专业知识的支持,但这个问题可能会引发辩论、争论、民意调查或扩展讨论。如果您觉得这个问题可以改进并可能重新开放,visit
public class TwoThreads { private static Object resource = new Object(); private static void
当我输入 6 (int) 作为值时,运行此命令会出现段错误 (gcc filename.c -lm)。请帮助我解决这个问题。预期的功能尚未实现,但我需要知道为什么我已经陷入段错误。 谢谢! #incl
所以,过去一周半我一直在研究这个 .OBJ/.MTL 网格解析器。在这段时间里,我一直在追踪/修复很多错误、清理代码、记录代码等等。 问题是,每修复一个错误,仍然会出现这个问题,而且一张图片胜过一千个
我正在运行一个代码,它基本上围绕 3 个维度旋转一个大数据数组(5000 万行)。但是,我遇到了一个奇怪的问题,我已将其缩小到如何评估旋转矩阵。基本上,对于除绕 x 轴以外的任何旋转,python 代
就在你说这是重复之前,我已经看到了其他问题,但我仍然想发布这个。 所以我正在阅读 Thinking in Java -Bruce Eckel 这篇文章是关于小写命名约定的: In Java 1.0 a
我想在我的应用程序中使用 REST API。它为我从这个应用程序发出的所有请求抛出 SocketTimeoutException。 Logcat 输出:(您也可以在此处看到带有漂亮格式的输出:http
我知道 raise ... from None 并已阅读 How can I more easily suppress previous exceptions when I raise my own
在未能找到各种Unix工具(例如xargs和whatnot)的最新独立二进制文件(this version很好,但需要外部DLL)后,我承担了自己进行编译的挑战。 ...这是痛苦的。 最终,尽管如此,
我有一个用PHP编写的流套接字服务器。 为了查看一次可以处理多少个连接,我用C语言编写了一个模拟器来创建1000个不同的客户端以连接到服务器。 stream_socket_accept几次返回fals
我的Android Studio昨天运行良好,但是今天当我启动Android Studio并想在移动设备上运行应用程序时,发生了以下错误, 我在互联网和stackoverflow上进行了搜索,但没有解
默认情况下,grails似乎为Java域对象的toString()返回:。那当然不是我想要的,所以我尝试@Override toString()返回我想要的。当我尝试grails generate-a
尝试通过LDAP通过LDAP对用户进行身份验证时,出现以下错误。 Reason: Cannot pass null or empty values to constructor. 谁能告诉我做错了什么
我正在尝试使用应用程序附带的 Houdini Python 模块,该模块是 Houdini 安装文件夹的一部分,位于标准 Python 路径之外。按照安装说明操作后,运行 Houdini Termin
简单地说,我正在为基本数据库编写单链表的原始实现。当用户请求打印索引下列出的元素高于数据库中当前记录数量时,我不断出现段错误,但仅当差值为 1 时。对于更高的数字,它只会触发我在那里编写的错误系统。
我是一名优秀的程序员,十分优秀!