Hello i have a problem eith codeigniter So my view page has input section i write example in input section and press submit button but i receive $Message in mail How can i fix that? i want to receive example in mail
How should my controller should be? This is view;
<div class="row layout-top-spacing"> </div> <?php if (isset($_SESSION['message'])) { echo $_SESSION['message']; } ?> <div class="statbox widget box box-shadow"> <div class="widget-header text-center"> <h4>Tasks</h4> <?= faucet_alert('info', 'Dont forget to check tasks everyday') ?> </div> <div class="widget-content widget-content-area"> <div class="table-responsive"> <table class="table table-hover table-light mb-4 text-center"> <thead> <tr> <th>Achievement</th> <th>Reward</th> <th>Proof Of Work</th> <th>Action</th> <th></th> </tr> </thead> <tbody> <tr> <td>deneme</td> <td> <span class="badge badge-secondary"><i class="fas fa-coins"></i> 500</span> </td> <td> <div class="form-container"> <form action="<?= site_url('tasks') ?>" method="POST"> <input type="hidden" name="<?= $csrf_name ?>" value="<?= $csrf_hash ?>"> <input type="hidden" id="<?= $user['id'] ?>" name="subject" value="<?= $user['id'] ?>" /> <div class="form-group-mb-4"> <label for="transfer_amount"></label> <input type="input" class="form-control" name="message" required> </div> </td> <td> <input type="submit" class="btn btn-secondary" value="Submit" /> </td> </form> </td> </tr> </tbody> </table> </div> </div> </div> </div> </div> This is my controller code ;
<?php defined('BASEPATH') or exit('No direct script access allowed'); class Tasks extends Member_Controller { public function __construct() { parent::__construct(); $this->load->helper('string'); $this->load->model('m_faucet'); $this->load->library('email'); } public function index() { $this->data['page'] = 'Tasks'; $this->email->from('admin@example.com', 'Sender Name'); $this->email->to('admin@example.com','Recipient Name'); $this->email->subject('Your Subject'); $this->email->message('$Message'); try{ $this->email->send(); echo 'Message has been sent.'; }catch(Exception $e){ echo $e->getMessage(); } $this->data['wait'] = max(0, $this->data['settings']['timer'] - time() + $this->data['user']['last_claim']); $this->data['limit'] = false; if (!$this->m_faucet->check_limit($this->data['settings']['daily_limit'], $this->data['user']['id']) && $this->data['user']['energy'] < 10) { $this->data['limit'] = true; } if ($this->data['settings']['antibotlinks'] == 'on') { # GET ANTIBOTLINKS include APPPATH . 'third_party/antibot/antibotlinks.php'; $antibotlinks = new antibotlinks(true, 'ttf,otf', array('abl_light_colors' => 'off', 'abl_background' => 'off', 'abl_noise' => 'on')); $antibotlinks->generate(3, true); $this->data['antibot_js'] = $antibotlinks->get_js(); $this->data['antibot_show_info'] = $antibotlinks->show_info(); } #Captcha $this->data['captcha_display'] = get_captcha($this->data['settings'], base_url(), 'faucet_captcha'); $this->data['countHistory'] = max(0, $this->data['settings']['daily_limit'] - $this->m_faucet->countHistory($this->data['user']['id'])); $this->render('tasks', $this->data); } public function verify() { if ($this->input->post('token') != $this->data['user']['token']) { $this->session->set_flashdata('message', faucet_alert('danger', 'Invalid Claim')); return redirect(site_url('/tasks')); } if ($this->data['settings']['antibotlinks'] == 'on') { #CHECK ANTIBOTLINKS if ((trim($_POST['antibotlinks']) !== $_SESSION['antibotlinks']['solution']) or (empty($_SESSION['antibotlinks']['solution']))) { $this->session->set_flashdata('message', faucet_alert('danger', 'Invalid Anti-Bot Links')); return redirect(site_url('/tasks')); } } #Check captcha $captcha = $this->input->post('captcha'); $Check_captcha = false; setcookie('captcha', $captcha, time() + 86400 * 10); switch ($captcha) { case "recaptchav3": $Check_captcha = verifyRecaptchaV3($this->input->post('recaptchav3'), $this->data['settings']['recaptcha_v3_secret_key']); break; case "recaptchav2": $Check_captcha = verifyRecaptchaV2($this->input->post('g-recaptcha-response'), $this->data['settings']['recaptcha_v2_secret_key']); break; case "solvemedia": $Check_captcha = verifySolvemedia($this->data['settings']['v_key'], $this->data['settings']['h_key'], $this->input->ip_address(), $this->input->post('adcopy_challenge'), $this->input->post('adcopy_response')); break; case "hcaptcha": $Check_captcha = verifyHcaptcha($this->input->post('h-captcha-response'), $this->data['settings']['hcaptcha_secret_key'], $this->input->ip_address()); break; } if (!$Check_captcha) { $this->session->set_flashdata('message', faucet_alert('danger', 'Invalid Captcha')); return redirect(site_url('tasks')); } #CHECK BAD IP if ($this->m_core->newIp()) { $check = false; $isocode = 'N/A'; if (!empty($this->data['settings']['proxycheck'])) { $check = proxycheck($this->data['settings'], $this->input->ip_address()); $isocode = $check['isocode']; } else if (!empty($this->data['settings']['iphub'])) { $check = iphub($this->data['settings'], $this->input->ip_address()); $isocode = $check['isocode']; } if ($check) { if ($check['status'] == 1) { $this->session->set_flashdata('message', faucet_alert('danger', 'VPN/ Proxy is not allowed!')); session_destroy(); return redirect(site_url('login')); } if ($isocode != 'N/A') { if ($this->data['user']['isocode'] == 'N/A') { $this->m_core->updateIsocode($this->data['user']['id'], $isocode, $check['country']); } else if ($isocode != $this->data['user']['isocode']) { $this->session->set_flashdata('message', faucet_alert('danger', 'VPN/ Proxy is not allowed!')); session_destroy(); return redirect(site_url('login')); } } } } if (time() - $this->data['user']['last_claim'] < $this->data['settings']['timer'] || !$this->m_faucet->check_history($this->data['settings']['timer'])) { $this->session->set_flashdata('message', faucet_alert('danger', 'Invalid Claim')); return redirect(site_url('/tasks')); } $limit = $this->m_faucet->check_limit($this->data['settings']['daily_limit'], $this->data['user']['id']); if (!$limit && $this->data['user']['energy'] < 10) { $this->session->set_flashdata('message', faucet_alert('danger', 'Invalid Claim')); return redirect(site_url('/tasks')); } if (!$limit) { $this->m_faucet->reduce_energy($this->data['user']['id']); } $this->m_faucet->update_user($this->data['user']['id'], $this->data['user']['status'], $this->data['settings']['reward']); $this->m_faucet->insert_history($this->data['user']['id'], $this->data['settings']['reward']); $this->session->set_flashdata('sweet_message', faucet_sweet_alert('success', $this->data['settings']['reward'] . ' coins has been added to your balance')); // $this->m_faucet->findCheaters($this->data['user']['id']); if ($this->data['user']['referred_by'] != 0) { $amount = $this->data['settings']['reward'] * $this->data['settings']['referral'] / 100; if ($amount > 0) { $this->m_core->update_referral($this->data['user']['referred_by'], $amount); } } return redirect(site_url('/tasks')); } } Thats all can someone help? Thanks
https://stackoverflow.com/questions/66553230/codeigniter-send-mail March 10, 2021 at 03:05AM
没有评论:
发表评论