%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
<?php defined('BASEPATH') OR exit('No direct script access allowed'); class Registration extends MY_Controller { public function __construct() { parent::__construct(); $this->load->library('form_validation','session'); $this->load->Model(array('Common_model','Api_model')); } /* * Function: index */ public function index($page = 0) { $data = array(); $head = array(); if(@$_POST['submit']=='Submit') { $post = $this->input->post(); $req = array('required'=>'%s required.', 'is_unique'=>'This %s is already registered', 'integer'=>'This %s is invalid'); $this->form_validation->set_rules('fullname', 'Please Enter Full Name', 'required|min_length[4]|max_length[50]', $req); $this->form_validation->set_rules('email_id', 'Please Enter Your Email', 'required|valid_email', $req); //$this->form_validation->set_rules('programmename', 'Please Enter Programme Name', 'required', $req); //$this->form_validation->set_rules('academicyear', 'Please Enter Academic Year', 'required', $req); $this->form_validation->set_rules('system_id', 'Please Enter Employee ID', 'required', $req); $this->form_validation->set_rules('mobile_no', 'Please Enter Your Mobile Number ', 'required|regex_match[/^[0-9]{10}$/]', $req); //{10} for 10 digits number if ($this->form_validation->run() == FALSE) { $data['error_array'] = $this->form_validation->error_array(); $data['details'] = $_POST; } else { $details = $this->Api_model->getEmpDetails($_POST['system_id']); if($details[0]->EMPLID!=''){ $data = array(); $data = array('enrollment_no'=>$post['system_id']); $results = $this->checkAddessExist('grievance_users', $data); if(empty($results['id'])) { $response_id = $this->saveregistrationinfo($post,$details[0]); unset($_POST); $data['success_msg'] = 'You have Successfully registered. We have send the login credentials to your registered email id.'; } else { $data['error_array'] = array('system_id'=>'Sorry! This Employee Id is already registered with us.'); $data['details'] = $_POST; } } else { $data['error_array'] = array('system_id'=>'Sorry! This Employee Id is not registered with us.'); $data['details'] = $_POST; } } } $arrSeo = $this->Public_model->getSeo('home'); $head['title'] = @$arrSeo['title']!=''? $arrSeo['title'] : 'New User Registration - Sharda Grievance Portal'; $head['description'] = @$arrSeo['description']; $head['keywords'] = str_replace(" ", ",", $head['title']); $this->load->view('_parts/empty_header', $head); $this->load->view('registration', $data); $this->load->view('_parts/footer'); } /* * Function : saveregistrationinfo */ public function saveregistrationinfo($post, $otherInfo) { // Create grievance_users array $params = array(); $params['fullName'] = $post['fullname']; $params['contactNo'] = $post['mobile_no']; $params['userEmail'] = $post['email_id']; $params['programme_name'] = $otherInfo->DESCR100A; $params['enrollment_no'] = $post['system_id']; $params['academic_year'] = $otherInfo->DEPTID; if(!empty($params)) { $data = array(); $data = array('userEmail'=>$post['email_id']); $results = $this->checkAddessExist('grievance_users', $data); if($results['id']>0) { $params['updationDate'] = date('Y-m-d h:i:s'); $this->Common_model->updateinfo($tbl_name='grievance_users', $params, 'id', $results['id']); $last_id = $results['id']; $post['registration_id'] = $last_id; } else { unset($post['submit']); $random_password = $this->randomPassword(); $params['password'] = md5($random_password); $params['regDate'] = date('Y-m-d h:i:s'); $params['status'] = '1'; $last_id = $this->Common_model->saveinfo('grievance_users',$params); $post['registration_id'] = $last_id; // Send Verification SMS/Email $this->sendSMSEmail($params,$random_password); } return $last_id; } } /* * Function : randomPassword */ function createUsername($name) { $randomNumber = rand(pow(10, $digits-1), pow(10, $digits)-1); $nameArray = explode(' ',$name); // get first 3 letters of firstname $first = substr($nameArray[0], 0, 1); // get first 3 letters of lastname $last = substr($nameArray[1], 0, 3); // set user to $first3, $last3, and $randomNumber $username = $first .''.time().'' . $last . '' . $randomNumber; return $username; } /* * Function : randomPassword */ function randomPassword() { return rand(111111, 999999); /*$alphabet = '1234567890'; $pass = array(); //remember to declare $pass as an array $alphaLength = strlen($alphabet) - 1; //put the length -1 in cache for ($i = 0; $i < 8; $i++) { $n = rand(0, $alphaLength); $pass[] = $alphabet[$n]; } return implode($pass); //turn the array into a string */ } /* * Function : generate_otp */ private function generateOTP() { return rand(111111, 999999); //return '232524'; } /* * Function: goOut */ private function goOut($page) { if ($page == null) { redirect(); } } /* * Function: checkAddessExist */ private function checkAddessExist($tbl_name, $programme_array) { $dataResponse = array(); if(empty($programme_array)) { $programme_array = array(); $programme_array = array('userEmail'=>$post['userEmail']); $dataResponse = $this->Common_model->checkApplicationDetails($tbl_name, '*', $programme_array); } else { $dataResponse = $this->Common_model->checkApplicationDetails($tbl_name, '*', $programme_array); } return $dataResponse; } /* * Function : sendSMSEmail */ private function sendSMSEmail($params, $password) { $mobile = $params['contactNo']; $email_id = $params['userEmail']; $name = $params['fullName']; $params['password'] = $password; if($email_id!='') { $template = $this->load->view('email_template/confirmation_email', $params, true); $subject = 'Registration Confirmation - Incident Online Portal'; $this->sendCommonEmail($email_id, $subject, $template); } if($mobile!='') { $sms_content="Incident Online Portal: Your portal login Username: $email_id and Password: $password. Use these credentials to lodge your complaint."; //$this->sendSMS($mobile, $sms_content); } } /* * Function : sendCommonEmail */ private function sendCommonEmail($to, $subject, $message) { $resp = send_email_pepipost($to, $subject, $message); return $resp; /*$CI =& get_instance(); $CI->load->library('email'); $mail=$CI->email; $mail->clear(); $from_email = 'grievance@sharda.ac.in'; $from_name = 'Sharda University Grievance Redressal Online Portal'; $config['charset'] = 'utf-8'; $config['wordwrap'] = TRUE; $config['mailtype'] = 'html'; $config['protocol'] = "smtp"; $config['smtp_host'] = 'ssl://smtp.gmail.com'; $config['smtp_user'] = 'grievance@sharda.ac.in'; $config['smtp_pass'] = 'grievance@2020'; $config['smtp_port'] = '465'; $config['_auth_smtp'] = TRUE; $config['newline'] = "\r\n"; $config['crlf'] = "\r\n"; $mail->initialize($config); $mail->from($from_email, $from_name); $mail->to($to); $mail->reply_to($from_email, $from_name); $mail->subject($subject); $mail->message($message); return $mail->send();*/ } /* * Function : sendSMS */ private function sendSMS($mob, $msg) { if($mob>0 && $msg!='') { $msg=urlencode($msg); $ch = curl_init(); curl_setopt($ch,CURLOPT_URL, "http://bulkpush.mytoday.com/BulkSms/SingleMsgApi"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, "feedid=363901&username=9015129267&password=wgtpt&To=".$mob."&Text=".$msg."&time=&senderid=shardacom_trans"); $buffer = curl_exec($ch); curl_close($ch); return true; } } /* * Function : getDetails * */ public function getDetails() { $systemId = $_GET['systemid']; $details = $this->Api_model->getStudentTestDetails($systemId); print_r($details); die; } }