Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if (!defined('BASEPATH'))
- exit('No direct script access allowed');
- class Registration extends CI_Controller {
- public function __construct() {
- parent::__construct();
- $this->data['site_title'] = 'Registration';
- $this->data['current_url'] = current_url();
- }
- public function unsubscribe() {
- $email = $this->input->get('m');
- $this->db->query("UPDATE mt_guest SET unsubscribe='Y' WHERE email '".$email."'"));
- $this->data['page_title'] = "Thank you";
- $this->data['message'] = "You will be no longer to receive our offers.";
- $this->load->view('yourFile',$this->data);
- }
- public function complete_subscribe() {
- if ($this->input->server('REQUEST_METHOD') == 'POST') {
- $this->load->helper("citstudio-mailer/mailer");
- $this->load->library("SMTP_validateEmail");
- $data['mail'] = $email = $this->input->post('mail-subscriber');
- $data['code'] = $code = $this->input->post('verification-code');
- $data['name'] = $name = $this->input->post('name-subscriber');
- $mx_email_validator = new SMTP_validateEmail();
- $check_mx_email = $mx_email_validator->validEmail($email);
- if (!$check_mx_email) {
- $this->data['page_title'] = "Subscribe Signup Error";
- $this->data['pages'] = $this->data['error_pages'] . "subscribe";
- $this->data['message'] = "We're Sorry, we're only send great Information to a Human";
- $this->load->view('yourFile',$this->data);
- } else {
- if ($this->subscribe_check($email, TRUE, $data)) {
- $content = subscribe_finish($data['mail'], $data['name']);
- $dump = sendmail($content);
- redirect(base_url(), 'refresh');
- } else {
- $this->data['page_title'] = "Subscribe Signup Error " . $mail;
- $this->data['message'] = "We're Sorry, email already taken.";
- $this->load->view('yourFile',$this->data);
- }
- }
- } else {
- $this->data['page_title'] = "Subscribe Signup Error";
- $this->data['message'] = "We're Sorry, we're only send great Information to a Human";
- $this->load->view('yourFile',$this->data);
- }
- }
- public function subscribe_check($mail, $insert = FALSE, $data = NULL) {
- $result = TRUE;
- $rec = $this->db->query("SELECT * FROM mt_guest WHERE email='".$mail."' AND type='SUBSCRIBER'")->result_array();
- if (sizeof($rec) > 0) {
- $result = FALSE;
- }
- if ($insert) {
- $email = $data['mail'];
- $name = $data['name'];
- $code = $data['code'];
- $this->db->query("INSERT INTO mt_guest (fields) VALUES (value)")
- $this->crud->create("mt_guest", $in);
- $result = TRUE;
- }
- return $result;
- }
- public function subscribe() {
- // check if mail-subscriber parameter are provided
- $mail = @$_REQUEST["mail-subscriber"];
- $code = @$_GET["activation-code"];
- if (isset($mail)) {
- $this->load->helper("citstudio-mailer/mailer");
- $this->load->library("SMTP_validateEmail");
- $mx_email_validator = new SMTP_validateEmail();
- $check_mx_email = $mx_email_validator->validEmail($mail);
- if (!$check_mx_email) {
- $this->data['page_title'] = "Subscribe Signup Error";
- $this->data['pages'] = $this->data['error_pages'] . "subscribe";
- $this->data['message'] = "We're Sorry, we're only send great Information to a Human";
- $this->load->view('yourFile',$this->data);
- } else {
- $this->data['email'] = $mail;
- if (!$this->subscribe_check($mail)) {
- $this->data['page_title'] = "Subscribe Signup Error " . $mail;
- $this->data['message'] = "We're Sorry, email already taken.";
- $this->load->view('yourFile',$this->data);
- } else {
- $_subscribe["email"] = $mail;
- $_subscribe["confirmation_code"] = md5("code" . " Subscribe" . $mail);
- if ($this->input->server('REQUEST_METHOD') == 'GET') {
- $this->data['activation_code'] = $_subscribe["confirmation_code"];
- } else {
- if (!isset($code)) {
- $content = subscribe_verify_content($mail, $_subscribe["confirmation_code"]);
- $dump = sendmail($content);
- }
- $this->data['activation_code'] = "";
- if (isset($code)) {
- $this->data['activation_code'] = $code;
- }
- }
- $this->data['page_title'] = "Subscribe Signup";
- $this->data['pages'] = $this->data['view'];
- $this->load->view('yourFile',$this->data);
- }
- }
- } else {
- $this->data['page_title'] = "Subscribe Signup Error";
- $this->data['message'] = "We're Sorry. The page cannot be found.";
- }
- $this->load->view('yourFile',$this->data);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement