?
Current Path : /home1/savoy/public_html/unova.in/application/controllers/ |
Linux gator3171.hostgator.com 4.19.286-203.ELK.el7.x86_64 #1 SMP Wed Jun 14 04:33:55 CDT 2023 x86_64 |
Current File : /home1/savoy/public_html/unova.in/application/controllers/site.php |
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); class Site extends CI_Controller { /** * Index Page for this controller. * * Maps to the following URL * http://example.com/index.php/welcome * - or - * http://example.com/index.php/welcome/index * - or - * Since this controller is set as the default controller in * config/routes.php, it's displayed at http://example.com/ * * So any other public methods not prefixed with an underscore will * map to /index.php/welcome/<method_name> * @see http://codeigniter.com/user_guide/general/urls.html */ function __construct() { parent::__construct(); session_start(); $this->load->model('mastermodel'); $this->load->library('Fpaginate'); // $this->load->helper('captcha'); $this->load->model('adminmodel'); } function index($page='') { if($page=='') $page='home'; redirect('site/'.$page); } function home() { $_SESSION['page']='home'; $_SESSION['spage']=''; $output1=$this->mastermodel->get_data('programme','1','active','order','asc'); $data['programmes']=$output1['results']; $output=$this->mastermodel->getdatas('testimonial','sort'); $data['testimonial']=$output['results']; $data['quote']=$this->mastermodel->get_data_srow('quote','1','quote_id'); $this->load->view('site/home',$data); } function about_us() { $_SESSION['page']='home'; $_SESSION['spage']='about_us'; $this->load->view('site/about-us'); } function team() { $_SESSION['page']='home'; $_SESSION['spage']='team'; $this->load->view('site/team'); } function testimonials($pagenum="1") { $_SESSION['page']='home'; $_SESSION['spage']='testimonials'; $perpage= $this->config->item('perpage'); $data['pagenum']=$pagenum; if($pagenum==1) { $data['id']=1; } else { $data['id']= (($pagenum-1)*$perpage)+1; } $output=$this->mastermodel->getdatas('testimonial','sort','',$pagenum); $data['startpage']=$output['startpage']; $data['endpage']=$output['endpage']; $data['testimonial']=$output['results']; $this->load->view('site/testimonials',$data); } function testimonials_1() { $_SESSION['page']='home'; $_SESSION['spage']='testimonials'; $this->load->view('site/testimonials_1'); } function leadership_workshops() { $_SESSION['page']='leadership_workshops'; $_SESSION['spage']='about_jessica_sajan'; $this->load->view('site/about_jessica_sajan'); } function leadershipworkshops() { $_SESSION['page']='leadership_workshops'; $_SESSION['spage']='leadershipworkshops'; $output=$this->mastermodel->getdatas('leadership_workshops','order'); $data['leadership_workshops']=$output['results']; $this->load->view('site/leadershipworkshops',$data); } function contact_jessica() { $_SESSION['page']='leadership_workshops'; $_SESSION['spage']='about_jessica_sajan'; $this->load->view('site/contact-us'); } function coaching_services() { $_SESSION['page']='leadership_workshops'; $_SESSION['spage']='coaching_services'; $output=$this->mastermodel->getdatas('coaching','order'); $data['coaching']=$output['results']; $this->load->view('site/coaching-services',$data); } function training_services() { $_SESSION['page']='training_services'; $_SESSION['spage']='training_services'; $output=$this->mastermodel->getdatas('training','order'); $data['training']=$output['results']; $this->load->view('site/training-services',$data); } function nlp() { $_SESSION['page']='training_services'; $_SESSION['spage']='training_services'; $this->load->view('site/nlp'); } function upcoming_programs() { $_SESSION['page']='training_services'; $_SESSION['spage']='upcoming_programs'; $output=$this->mastermodel->get_data('programme','1','active','order','asc'); $data['programs']=$output['results']; $this->load->view('site/upcoming-programs',$data); } function recent_events() { $_SESSION['page']='training_services'; $_SESSION['spage']='recent_events'; $output=$this->mastermodel->get_data('programme','2','active','order','asc'); $data['programs']=$output['results']; $output=$this->mastermodel->get_data_thumbs(); $data['gallery']=$output['results']; $this->load->view('site/recent-events',$data); } function training_registration($training_id) { $data['training']=$this->mastermodel->get_data_srow('training',$training_id,'training_id'); $vals = array('img_path' => './assets/captcha/','img_url' => base_url().'/assets/captcha/'); $captcha = $this->create_captcha($vals); $data['captcha'] = $captcha; $this->session->set_userdata('captchaWord', $captcha['word']); $_SESSION['page']='training_services'; $_SESSION['spage']='training_services'; $this->load->view('site/training-registration',$data); } function coaching_registration($coaching_id) { $data['coaching']=$this->mastermodel->get_data_srow('coaching',$coaching_id,'coaching_id'); $_SESSION['page']='coaching_services'; $_SESSION['spage']='coaching_services'; $this->load->view('site/coaching-registration',$data); } function event_registration($programme_id) { $data['course']=$this->mastermodel->get_data_srow('programme',$programme_id,'programme_id'); $vals = array('img_path' => './assets/captcha/','img_url' => base_url().'/assets/captcha/'); $captcha = $this->create_captcha($vals); $data['captcha'] = $captcha; $this->session->set_userdata('captchaWord', $captcha['word']); $_SESSION['page']='training_services'; $_SESSION['spage']='upcoming_programs'; $this->load->view('site/event-registration',$data); } function workshop_registration($workshop_id) { $data['workshop']=$this->mastermodel->get_data_srow('leadership_workshops',$workshop_id,'workshop_id'); $_SESSION['page']='leadershipworkshops'; $_SESSION['spage']='leadershipworkshops'; $this->load->view('site/workshop-registration',$data); } function insert_workshop_registration() { $postdata = $this->mastermodel->get_post_values(); $this->mastermodel->insert_workshop_registration($postdata); $data['msg'] = "Thank You! <br/> YOU WILL HEAR FROM US SHORTLY."; $this->load->view('site/view-message',$data); } function contact_us() { $data = array(); $vals = array('img_path' => './assets/captcha/','img_url' => base_url().'/assets/captcha/'); $captcha = $this->create_captcha($vals); $data['captcha'] = $captcha; $this->session->set_userdata('captchaWord', $captcha['word']); $_SESSION['page']='contact_us'; $_SESSION['spage']='contact_us'; $this->load->view('site/contact-us',$data); } function feedback() { $data = array(); $vals = array('img_path' => './assets/captcha/','img_url' => base_url().'/assets/captcha/'); $captcha = $this->create_captcha($vals); $data['captcha'] = $captcha; $this->session->set_userdata('captchaWord', $captcha['word']); $_SESSION['page']='contact_us'; $_SESSION['spage']='feedback'; $this->load->view('site/feedback',$data); } function careers() { $_SESSION['page']='careers'; $_SESSION['spage']=''; $this->load->view('site/careers'); } function resources() { $_SESSION['page']='resources'; $_SESSION['spage']=''; $this->load->view('site/resources'); } function gallery() { $_SESSION['page']='photo_gallery'; $_SESSION['spage']=''; $output=$this->mastermodel->getdatas('directory','sort','asc'); $data['folders']=$output['results']; $this->load->view('site/gallery',$data); } function photo_gallery($directory_id) { $_SESSION['page']='photo_gallery'; $_SESSION['spage']=''; $output=$this->mastermodel->get_data('gallery',$directory_id,'directory_id','sort'); $data['gallery']=$output['results']; $this->load->view('site/photo-gallery',$data); } function insert_contact() { $privatekey = "6Lfzh-ESAAAAAAOlYukR_YYOq7Z703JAZHNk0GNy"; $postdata = $this->mastermodel->get_post_values(); $data['viewinfo']=$postdata; $userCaptcha =$postdata['q10_captcha']; $word = $this->session->userdata('captchaWord'); if(strcmp(strtoupper($userCaptcha),strtoupper($word)) == 0) { $this->session->unset_userdata('captchaWord'); $this->mastermodel->insert_contact($postdata); $data['msg'] = "Thank You! <br/> YOU WILL HEAR FROM US SHORTLY."; $_SESSION['page']='contact_us'; $_SESSION['spage']=''; $this->load->view('site/view-message',$data); } else { $vals = array('img_path' => './assets/captcha/','img_url' => base_url().'/assets/captcha/'); $captcha = $this->create_captcha($vals); $data['captcha'] = $captcha; $this->session->set_userdata('captchaWord', $captcha['word']); echo '<script>alert("Invalid Captcha")</script>'; $this->load->view('site/contact-us',$data); } } function insert_feedback() { $privatekey = "6Lfzh-ESAAAAAAOlYukR_YYOq7Z703JAZHNk0GNy"; $postdata = $this->mastermodel->get_post_values(); $data['viewinfo']=$postdata; $userCaptcha =$postdata['q10_captcha']; $word = $this->session->userdata('captchaWord'); if(strcmp(strtoupper($userCaptcha),strtoupper($word)) == 0) { $this->mastermodel->insert_feedback($postdata); $data['msg'] = "Thank You! <br/> WE VALUE YOUR SUGGESTIONS / FEEDBACK"; $_SESSION['page']='contact_us'; $_SESSION['spage']=''; $this->load->view('site/view-message',$data); } else { $vals = array('img_path' => './assets/captcha/','img_url' => base_url().'/assets/captcha/'); $captcha = $this->create_captcha($vals); $data['captcha'] = $captcha; $this->session->set_userdata('captchaWord', $captcha['word']); echo '<script>alert("Invalid Recaptcha")</script>'; $this->load->view('site/feedback',$data); } } function insert_training_registration() { $postdata = $this->mastermodel->get_post_values(); $data['viewinfo']=$postdata; $userCaptcha =$postdata['q10_captcha']; $word = $this->session->userdata('captchaWord'); if(strcmp(strtoupper($userCaptcha),strtoupper($word)) == 0) { $this->mastermodel->insert_training_registration($postdata); $data['msg'] = "Thank You! <br/> YOU WILL HEAR FROM US SHORTLY."; $_SESSION['page']='contact_us'; $_SESSION['spage']=''; $this->load->view('site/view-message',$data); } else { $data['training']=$this->mastermodel->get_data_srow('training',$postdata['q12_trainingService_id'],'training_id'); $vals = array('img_path' => './assets/captcha/','img_url' => base_url().'/assets/captcha/'); $captcha = $this->create_captcha($vals); $data['captcha'] = $captcha; $this->session->set_userdata('captchaWord', $captcha['word']); echo '<script>alert("Invalid Recaptcha")</script>'; $this->load->view('site/training-registration',$data); } } function insert_coaching_registration() { $privatekey = "6Lfzh-ESAAAAAAOlYukR_YYOq7Z703JAZHNk0GNy"; $postdata = $this->mastermodel->get_post_values(); $data['viewinfo']=$postdata; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { echo '<script>alert("Invalid Recaptcha")</script>'; $data['coaching']=$this->mastermodel->get_data_srow('coaching',$postdata['q12_coachingService_id'],'coaching_id'); $this->load->view('site/coaching-registration',$data); } else { $this->mastermodel->insert_coaching_registration($postdata); $data['msg'] = "Thank You! <br/> YOU WILL HEAR FROM US SHORTLY."; $_SESSION['page']='contact_us'; $_SESSION['spage']=''; $this->load->view('site/view-message',$data); } } function insert_programme_registration() { $postdata = $this->mastermodel->get_post_values(); $data['viewinfo']=$postdata; $userCaptcha =$postdata['q10_captcha']; $word = $this->session->userdata('captchaWord'); if(strcmp(strtoupper($userCaptcha),strtoupper($word)) == 0) { $this->mastermodel->insert_programme_registration($postdata); $data['msg'] = "Thank You! <br/> YOU WILL HEAR FROM US SHORTLY."; $_SESSION['page']='contact_us'; $_SESSION['spage']=''; $this->load->view('site/view-message-programme',$data); } else { $event_id=$postdata['q11_eventSelected']; $data['course']=$this->mastermodel->get_data_srow('programme',$event_id,'programme_id'); $_SESSION['page']='training_services'; $_SESSION['spage']='upcoming_programs'; $vals = array('img_path' => './assets/captcha/','img_url' => base_url().'/assets/captcha/'); $captcha = $this->create_captcha($vals); $data['captcha'] = $captcha; $this->session->set_userdata('captchaWord', $captcha['word']); echo '<script>alert("Invalid Recaptcha")</script>'; $this->load->view('site/event-registration',$data); } } function unovaadmin() { $this->load->view('admin/login'); } public function login($res="") { if($res=='false') $data['result']='<font color="red" size=2px; >Username and Password does not match</font>'; else $data['result']=''; $this->load->view('admin/login',$data); } public function authenticate() { $username=mysql_real_escape_string($this->input->post('username')); $password=mysql_real_escape_string($this->input->post('password')); $data=$this->adminmodel->authenticate($username,$password); if ($data['numrows']>0) { $_SESSION['loggedin']='true'; $_SESSION['userid']=$data['userid']; $_SESSION['username']=$data['username']; redirect('admin/home/'); } else { redirect('site/login/false'); } } function create_captcha($data = '', $img_path = '', $img_url = '', $font_path = '') { $defaults = array('word' => '', 'img_path' => '', 'img_url' => '', 'img_width' => '150', 'img_height' => '30', 'font_path' => '', 'expiration' => 7200); foreach ($defaults as $key => $val) { if ( ! is_array($data)) { if ( ! isset($$key) OR $$key == '') { $$key = $val; } } else { $$key = ( ! isset($data[$key])) ? $val : $data[$key]; } } if ($img_path == '' OR $img_url == '') { return FALSE; } if ( ! @is_dir($img_path)) { return FALSE; } if ( ! is_writable($img_path)) { return FALSE; } if ( ! extension_loaded('gd')) { return FALSE; } // ----------------------------------- // Remove old images // ----------------------------------- list($usec, $sec) = explode(" ", microtime()); $now = ((float)$usec + (float)$sec); $current_dir = @opendir($img_path); while ($filename = @readdir($current_dir)) { if ($filename != "." and $filename != ".." and $filename != "index.html") { $name = str_replace(".jpg", "", $filename); if (($name + $expiration) < $now) { @unlink($img_path.$filename); } } } @closedir($current_dir); // ----------------------------------- // Do we have a "word" yet? // ----------------------------------- if ($word == '') { $pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; $str = ''; for ($i = 0; $i < 8; $i++) { $str .= substr($pool, mt_rand(0, strlen($pool) -1), 1); } $word = $str; } // ----------------------------------- // Determine angle and position // ----------------------------------- $length = strlen($word); $angle = ($length >= 6) ? rand(-($length-6), ($length-6)) : 0; $x_axis = rand(6, (360/$length)-16); $y_axis = ($angle >= 0 ) ? rand($img_height, $img_width) : rand(6, $img_height); // ----------------------------------- // Create image // ----------------------------------- // PHP.net recommends imagecreatetruecolor(), but it isn't always available if (function_exists('imagecreatetruecolor')) { $im = imagecreatetruecolor($img_width, $img_height); } else { $im = imagecreate($img_width, $img_height); } // ----------------------------------- // Assign colors // ----------------------------------- $bg_color = imagecolorallocate ($im, 255, 255, 255); $border_color = imagecolorallocate ($im, 153, 102, 102); $text_color = imagecolorallocate ($im, 204, 153, 153); $grid_color = imagecolorallocate($im, 255, 182, 182); $shadow_color = imagecolorallocate($im, 255, 240, 240); // ----------------------------------- // Create the rectangle // ----------------------------------- ImageFilledRectangle($im, 0, 0, $img_width, $img_height, $bg_color); // ----------------------------------- // Create the spiral pattern // ----------------------------------- $theta = 1; $thetac = 7; $radius = 16; $circles = 20; $points = 32; for ($i = 0; $i < ($circles * $points) - 1; $i++) { $theta = $theta + $thetac; $rad = $radius * ($i / $points ); $x = ($rad * cos($theta)) + $x_axis; $y = ($rad * sin($theta)) + $y_axis; $theta = $theta + $thetac; $rad1 = $radius * (($i + 1) / $points); $x1 = ($rad1 * cos($theta)) + $x_axis; $y1 = ($rad1 * sin($theta )) + $y_axis; imageline($im, $x, $y, $x1, $y1, $grid_color); $theta = $theta - $thetac; } // ----------------------------------- // Write the text // ----------------------------------- $use_font = ($font_path != '' AND file_exists($font_path) AND function_exists('imagettftext')) ? TRUE : FALSE; if ($use_font == FALSE) { $font_size = 5; $x = rand(0, $img_width/($length/3)); $y = 0; } else { $font_size = 16; $x = rand(0, $img_width/($length/1.5)); $y = $font_size+2; } for ($i = 0; $i < strlen($word); $i++) { if ($use_font == FALSE) { $y = rand(0 , $img_height/2); imagestring($im, $font_size, $x, $y, substr($word, $i, 1), $text_color); $x += ($font_size*2); } else { $y = rand($img_height/2, $img_height-3); imagettftext($im, $font_size, $angle, $x, $y, $text_color, $font_path, substr($word, $i, 1)); $x += $font_size; } } // ----------------------------------- // Create the border // ----------------------------------- imagerectangle($im, 0, 0, $img_width-1, $img_height-1, $border_color); // ----------------------------------- // Generate the image // ----------------------------------- $img_name = $now.'.jpg'; ImageJPEG($im, $img_path.$img_name); $img = "<img src=\"$img_url$img_name\" width=\"$img_width\" height=\"$img_height\" style=\"border:0;\" alt=\" \" />"; ImageDestroy($im); return array('word' => $word, 'time' => $now, 'image' => $img); } } /* End of file welcome.php */ /* Location: ./application/controllers/welcome.php */