>

Thursday, November 10, 2016

CI_view

<?php
include('nav.php'); ?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="<?php echo base_url(); ?>css/style.css">
</head>
<body>


<div class="container">
<div class="card card-containerAdminpage" >
<h3 style="font-weight:700; background:#127185;font-size:21px;color:#fff;padding-top: 4px;padding-bottom: 4px;padding-left: 20px;padding-right: 20px;">Gallery Admin</h3><br/>

<?php
//print_r($user_list); //this print assosiative array ?>

<div class="row">
<div class="col-md-2">
   <h4>Select User :</h4>
</div>

            <div class="col-md-4">
                <?php
// $js = 'id="Ultra" onChange="run();"';
$js = 'id="userdropdown" class="form-control"';
                 //echo form_dropdown('username', $user_list,'',$js);
echo form_dropdown('username',array('0' => 'Please select User') + $user_list,'',$js);
                //echo form_dropdown('username', $user_list,'id="username"');
?>
            </div>
           
         
            <div class="col-md-2">  
            </div>
           
            <div class="col-md-2">
       <!-- in use  
<input type="button" class="btn btn-primary"  value="Display Gallery" name="dispalygallery"
id="displaygallery" />
-->
   <!-- not use
                <input type="button" class="btn btn-primary"  value="Display Gallery" name="dispalygallery"
onClick="getData()" id="dispalygallery" />
-->
            </div>
           
            <div class="col-md-2">

           <a href="<?php echo site_url('admin_cont/gallery_controller/createGallery'); ?>"><input class="btn btn-primary" type="button" value="Create Gallery" name="addUser" /></a>
            </div>
           

        </div>

<br>
<?php echo $ui="<input type='hidden' name='userid'  id='texthide' />" ; //this is imporatant pass userid to controller
?>
<div id="divjsondata" class="table-responsive"></div>

<div class="row" id="divcreategallery">

</div>


   </div>
</div>


</body>
</html>


<script type="text/javascript">
// Ajax post for Display Gallery
$(document).ready(function() {
$("#userdropdown").on('change',function(event) {
//var user_id = document.getElementById("userdropdown").value;
//alert(user_id);

event.preventDefault();
var user_id = document.getElementById("userdropdown").value;
jQuery.ajax({
type: "POST",
url: "<?php echo base_url(); ?>" + "admin_cont/gallery_controller/user_userdata",
dataType: 'json',
data: {userid: user_id},
success: function(res) {
//console.log( res );
 var html = "<table class='table table-striped table-bordered table-hover' id='example'>";
            html += "<thead>";

            html += "<tr style='color:#127185;'>";
            html += "<th>#</th>";
            html += "<th>Gallery Name</th>";
            html += "<th>Event Date</th>";
            html += "<th>Total Photo</th>";
            html += "<th>Selected Photo</th>";
            html += "<th>Gallery lock</th>";
html += "<th>Edit</th>";
html += "<th>Manage</th>";
html += "<tr>";

            html += "</thead>";

html += "<tfoot>";

            html += "<tr style='color:#127185;'>";
            html += "<th>#</th>";
            html += "<th>Gallery Name</th>";
            html += "<th>Event Date</th>";
            html += "<th>Total Photo</th>";
            html += "<th>Selected Photo</th>";
            html += "<th>Gallery lock</th>";
html += "<th>Edit</th>";
html += "<th>Manage</th>";
html += "<tr>";

            html += "</tfoot>";


            html += "<tbody>";

if(user_id == 0){
"<br/>";
html += "<tr>";
                html += "<td colspan='7' align='center' ><span style='color:blue'><b>" + "Oops.... Please Select User First.....!!" + "</b></span></td>";
                html += "<tr>";
html += "</tbody>";
                html += "</table>";
                $("#divjsondata").html(html);
}
else if(res.r.length >= 1) {
            for (i = 0; i <= res.r.length - 1; i++) {
                html += "<tr align='center'>";
                html += "<td style='color:#127185;'>" + res.r[i].galleryid + "</td>";
                html += "<td align='left'>" + res.r[i].gname + "</td>";
                html += "<td>" + res.r[i].eventdate + "</td>";
                html += "<td>" + res.r[i].totalphoto + "</td>";
                html += "<td>" + res.r[i].selectedphoto + "</td>";
                html += "<td>" + res.r[i].glock + "</td>";
html += "<td>" +

"<a href='<?php echo base_url(); ?>" +'admin_cont/gallery_controller/EditGallery/' + res.r[i].galleryid +"'><img src='<?php echo base_url(); ?>" +'images/edit2.png'+ "'/>";"</a>"
              + "</td>";
 
html += "<td>" +
         "<a href='<?php echo base_url(); ?>" +'admin_cont/gallery_controller/galleryphotos/' + res.r[i].galleryid +"'><img src='<?php echo base_url(); ?>" +'images/edit.png'+ "'/>";
         "</a>"
              + "</td>";
 
 
/*
for userid getting code

html += "<td>" +
"<a href='http://localhost/studio/admin_cont/gallery_controller/EditGallery/"+res.r[i].userid+"'>Edit";"</a>"
              + "</td>";
 
*/  
                html += "<tr>";
            }
            html += "</tbody>";
            html += "</table>";
            $("#divjsondata").html(html);
}
else{
"<br/>";
html += "<tr>";
                html += "<td colspan='7' align='center' >" + "Sorry No Gallery information is available..!!" + "</td>";
                html += "<tr>";
html += "</tbody>";
                html += "</table>";
                $("#divjsondata").html(html);
}

}
});
});
});
</script>

CI_gallery_model

<?php
class Gallery_model extends CI_Model
{
   
public function get_dropdown_list()
    {
          $this->db->from('login');
          $this->db->order_by('username');
          $result = $this->db->get();
 
          $return = array();

          if($result->num_rows() > 0)
 {
               foreach($result->result_array() as $row)
      {
 $return[$row['userid']] = $row['username'];
 /*this will return like this
 $userid=>$username
                  0=>admin
                  1=>user
 2=>jalpesh*/
               }
          }
               return $return;
   
}
public function gallery_data($userid)

    {   //$userid=$this->input->post('userid'); its not give require output
   $query = $this->db->where(['userid'=>$userid])
                      ->get('gallery');

      return $query->result();
}

public function insert_gallery($data)

    {   $query = $this->db->insert('gallery',$data);
      return $query;
}

public function getonerow_edit($galleryid)

    {   $this->db->where('galleryid',$galleryid);
$query=$this->db->get('gallery');
return $query->row();
}

public function getonerow_edit_login($userid)
{
$this->db->where('userid',$userid);
$query=$this->db->get('login');
return $query->row();
}

public function EditGalleryModel_insert($data)

    {
  $galleryid=$this->input->post('galleryid');
 
  $query = $this->db->where('galleryid',$galleryid);
           $this->db->update('gallery',$data);

//return $query;
}

public function gallery_photos($galleryid)

    {   //$userid=$this->input->post('userid'); its not give require output
   $query = $this->db->where(['galleryid'=>$galleryid])
                      ->get('album');

      return $query->result();
}

public function Photo_del()
{  
   //1. Below line fetch PhotoID from Url and store in variable
   $PhotoID=$this->input->get('PhotoID');
//2. Below code use for update total Photo in gallery i.e. fetch galleryid before delete photo
//this quey getch row which has match PhotoID
$query = $this->db->where('PhotoID',$PhotoID)
             ->get('album');

foreach ($query->result() as $row)
{
              $galleryid = $row->galleryid;
 $userid = $row->userid;
 $PhotoName = $row->PhotoName;
}

//finding Gallery Name
$queryG = $this->db->where('galleryid',$galleryid)
              ->get('gallery');
foreach ($queryG->result() as $row)
{
              $gname = $row->gname;
}

//finding User Name
$queryU = $this->db->where('userid',$userid)
              ->get('login');
foreach ($queryU->result() as $row)
{
              $username = $row->username;
}

//3.Delete requested photo
$PhotoID=$this->db->where('PhotoID',$PhotoID);
$this->db->delete('album',$PhotoID);

$path="./userlist/".$username."/".$gname."/".$PhotoName;
unlink($path);

//4.Find total Photo in Album table by specific User has gallery
        $sql = "SELECT * FROM `album` WHERE `galleryid` = '".$galleryid."'";
        $query = $this->db->query($sql);
//5.Find total Photo and store in variable
        $count = $query->num_rows();
//6. Update gallery table
$sql1 ="UPDATE `gallery` SET `totalphoto` = '".$count."' WHERE `galleryid` = '".$galleryid."'";
   $query1 = $this->db->query($sql1);

return $galleryid;

}

public function AllPhoto_del()
{  
    //PART 1
   $galleryid=$this->input->get('galleryid');
$query = $this->db->where('galleryid',$galleryid)
             ->get('album');

foreach ($query->result() as $row)
{
              $galleryid = $row->galleryid;
 $userid = $row->userid;
}

//finding Gallery Name
$queryG = $this->db->where('galleryid',$galleryid)
              ->get('gallery');
foreach ($queryG->result() as $row)
{
              $gname = $row->gname;
}

//finding User Name
$queryU = $this->db->where('userid',$userid)
              ->get('login');
foreach ($queryU->result() as $row)
{
              $username = $row->username;
}


   // PART 2
   //Below line fetch PhotoID from Url and store in variable
   $galleryid=$this->input->get('galleryid');

$galleryid=$this->db->where('galleryid',$galleryid);
$this->db->delete('album',$galleryid);

//PART 2 after delete entry from DB ,Delete all Images from perticular gallery Directory
   array_map('unlink', glob("./userlist/".$username."/".$gname."/*"));

// PART 3
//Update gallery table set totalphoto field to 0.
$galleryid=$this->input->get('galleryid');
$sql ="UPDATE `gallery` SET `totalphoto` = 0 WHERE `galleryid` = '".$galleryid."' ";
   $query = $this->db->query($sql);

/*CI style also working
$galleryid=$this->input->get('galleryid');
$query = $this->db->where('galleryid',$galleryid);
        $this->db->set('totalphoto',0);
$this->db->update('gallery');
        */

return $galleryid;

}
         
}

CI_gallery_controller

<?php

class Gallery_controller extends CI_Controller {

        public function index()
        {        
 
        }

   public function __construct() {

parent::__construct();
if(! $this->session->userdata('session_username'))
redirect();

}

public function galleryAdmin()
        {
$this->load->model('gallery_model');
$data['user_list'] = $this->gallery_model->get_dropdown_list();
$this->load->view('admin/galleryAdmin_view', $data);
}

public function user_userdata()
{  
   $userid = $this->input->post('userid');

        $this->load->model('gallery_model');
        $data['r'] = $this->gallery_model->gallery_data($userid);
echo json_encode($data);

//$this->load->view('admin/galleryAdmin_view2', $data);
}

public function createGallery()
        {   $this->load->model('gallery_model');
$data['user_list'] = $this->gallery_model->get_dropdown_list();
$this->load->view('admin/createGallery',$data);
}

public function createGallery_insert()
        {  
$userid = $this->input->post('userid');
if($userid == 0 || $userid == null || $userid == '')
{
$this->load->model('gallery_model');
$data['user_list'] = $this->gallery_model->get_dropdown_list();
$this->load->view('admin/createGallerySelectuser',$data);
}
else
{
            $username = $this->input->post('username1'); //for directory creation
   $galleryname = $this->input->post('galleryname');
$eventdate = $this->input->post('eventdate');
$totalphoto = "";
$selectedphoto = "";
$glock="";
/* already write at start function so skip here$userid
$userid = $this->input->post('userid'); */

$data = array(
                'gname' => trim($galleryname),
                'eventdate' => trim($eventdate),
'totalphoto' =>$totalphoto,
'selectedphoto' => $selectedphoto,
'glock' =>$glock,
'userid' => $userid
);
         
$this->load->model('gallery_model');
$data['user_list'] = $this->gallery_model->insert_gallery($data);

// create "gallername" folder under userlist/username folder
$path="./userlist/".$username."/".$galleryname;
mkdir($path,0777,true);
header('Location:'.base_url().'admin_cont/adminpage');
            //echo "insert successfully";
//$this->load->view('admin/createGallery',$data);
//$this->load->view('admin/galleryAdmin_view');
            }

}

public function EditGallery($galleryid)
        {
  $this->load->model('gallery_model');
  $row=$this->gallery_model->getonerow_edit($galleryid);
  $data['r']=$row;
  $this->load->view('admin/editgallery',$data);
}

public function EditGallery_insert()
        {  
   $galleryid=$this->input->post('galleryid');

   $data= array(
'gname' => trim($this->input->post('gname')),
'eventdate' => trim($this->input->post('eventdate')),
   );

$this->load->model('gallery_model');
   //$row=$this->gallery_model->EditGalleryModel_insert($data); same thinf in if else but give return
if($this->gallery_model->EditGalleryModel_insert($data)){
//Successfull insertion
header('Location:'.base_url().'admin_cont/gallery_controller/galleryAdmin');
}
else
//not Successfull insertion
header('Location:'.base_url().'admin_cont/gallery_controller/galleryAdmin');
}

//For View -> galleryphotos
public function galleryphotos($galleryid)
        {   //$username = $this->input->post('username1');
    $this->load->model('gallery_model');
    $row=$this->gallery_model->getonerow_edit($galleryid);
$data['r']=$row;

$userid= $row->userid;

$this->load->model('gallery_model');
$row1=$this->gallery_model->getonerow_edit_login($userid);
    $data['r1']=$row1;

    $this->load->view('admin/galleryphotos',$data);
}

//gallery_photos function => Use for galleryAdmin_view
public function gallery_photos()
{  
   $galleryid = $this->input->post('galleryid');


        $this->load->model('gallery_model');
        $data['r'] = $this->gallery_model->gallery_photos($galleryid);
echo json_encode($data);

//$this->load->view('admin/galleryAdmin_view2', $data);
}


//Call from view->galleryphotos on deleteMe function
public function Photo_delete()
{  
   $this->load->model('gallery_model');
        $galleryid = $this->gallery_model->Photo_del();
header('Location:'.base_url().'admin_cont/gallery_controller/galleryphotos/'.$galleryid);
//header('Location:'.base_url().'admin_cont/gallery_controller/galleryAdmin');
}

public function AllPhoto_delete()
{  
   $this->load->model('gallery_model');
        $galleryid = $this->gallery_model->AllPhoto_del();
header('Location:'.base_url().'admin_cont/gallery_controller/galleryphotos/'.$galleryid);
//header('Location:'.base_url().'admin_cont/gallery_controller/galleryAdmin');
}

}

CI_admin_controller

<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Adminpage extends CI_Controller
{

public function __construct() {

parent::__construct();
if(! $this->session->userdata('session_username'))
redirect('');

}

    public function index()
    {

//First we need to load the model
    $this->load->model('insertuser');

    //Now we need to get our user list using the function we write on our model
    $user_list = $this->insertuser->viewdata();

   //Finally, we send are list to the view so we can display it.
    $data["user_lst"] = $user_list;

    $this->load->view("admin/adminpage", $data); // this view is load and shows result

    }
   
    public function user_edit($id)
{
$this->load->model('insertuser');

$row=$this->insertuser->getonerow($id);

$data['r']=$row;
$this->load->view('admin/useredit',$data);
//redirect('Student/edit');
}

public function user_update()
{

 $id=$this->input->post('userid');
 $usertype=$this->input->post('usertype');
 $username=$this->input->post('username');

 $dataid = array('id' => $id,
                 'usertype' =>$usertype,
 'username' =>$username
 );

 if ($this->form_validation->run('edit_user'))
          {  
// form validation successfull
$data= array(
'firstname' => $this->input->post('firstname'),
'lastname' => $this->input->post('lastname'),
                        //'password' => $hashpwd,
       'email' => $this->input->post('emailid'),
                        'mobilenumber' => $this->input->post('mobilenumber'),
       'altermobilenum' => $this->input->post('altermobilenum'),
       'city' => $this->input->post('city'),
                        'state' => $this->input->post('state'),
       'country' => $this->input->post('country'),
                        'address' => $this->input->post('address'),
       'comment' => $this->input->post('comment'),
'usertype' => $usertype,
);

$this->db->where('userid',$id);
$this->db->update('login',$data);

redirect("admin_cont/adminpage");
 }
          else
          {
        // form validation NOT successfull
    $this->load->view('admin/usereditnotvalidate',$dataid);
 }

}

public function user_delete($id)
{  
        $id=$this->db->where('userid',$id);
$this->db->delete('login',$id);
header('Location:'.base_url().'admin_cont/adminpage');
}

public function resetpass()
{
$this->load->view('admin/resetpass');
}

public function resetpass_validate()
{
 $username=$this->input->post('username');
 $password=$this->input->post('password');

  //codeigniter-bcrypt for password secure
  $this->load->library('bcrypt');
  $hashpwd = $this->bcrypt->hash_password($password);
 
          if ($this->form_validation->run('reset_pass'))
          {
$this->load->model('loginmodel');
$username = $this->loginmodel->reset_pass($username);
if($username != null)
{
$data = array('password' => $hashpwd);

       $this->db->where('username',$username);
           $this->db->update('login',$data);

redirect("admin_cont/adminpage");
}
else
{
$this->load->view('admin/resetusernotexist');
}
 }
 else
 {
$this->load->view('admin/resetpass');
 }
}


// for allowing space in inputbox
public function alpha_space($str)
{   //alpha+space allow for space[a-z ] is valid but [a-z] not valid
   $this->form_validation->set_message('alpha_space', 'Only alphabetic and space are allowed');
return ( ! preg_match("/^([a-z ])+$/i", $str)) ? FALSE : TRUE;

//alpha+numeric+space+dash+underscore+comma allow
//return ( ! preg_match("/^([-a-z_,0-9 ])+$/i", $str)) ? FALSE : TRUE;
}
}

mail.php

<?PHP
 session_start();


    $examids=$_GET['examids'];
$login_user=$_GET['login_user'];
$eid=explode(",",$examids);
$total_exam = count($eid);

$current_username=$login_user;

$con = mysql_connect("localhost","a196f69e_anil","anil51990")or die("Database connection not worked".__LINE__);
$db = mysql_select_db("a196f69e_english_sikho",$con)or die("database not found");

$query1="select Userid,Firstname,Lastname from usermaster where Username='$current_username'";
$r1=mysql_query($query1);
$row1=mysql_fetch_array($r1);

$userid=$row1[0];//user id

// for current user address
$queryaddress = "SELECT Address FROM usermaster WHERE Userid=$userid";
$qadd=mysql_query($queryaddress)or die("mail address error".__LINE__);
$qadd1=mysql_fetch_array($qadd);
$useraddress=$qadd1[0];

//part1...
 $query="select useranswer.Quetinoid,useranswer.Useranswer,useranswer.Wrongright,useranswer.comment,question.Questiontitle,answer.answer_option_dis,answer.Answeroptions FROM useranswer INNER JOIN question ON question.Questionid = useranswer.Quetinoid INNER JOIN answer ON answer.Questionid=question.Questionid where useranswer.Userid=$userid and useranswer.Examid=$eid[0]";
$r=mysql_query($query)or die("view result quer1 not fire...".__LINE__);
$exam=mysql_fetch_array($r);




//part2...
$query2="select useranswer.Quetinoid,useranswer.Useranswer,useranswer.Wrongright,useranswer.comment,question.Questiontitle FROM useranswer INNER JOIN
question ON question.Questionid = useranswer.Quetinoid where useranswer.Userid=$userid and useranswer.Examid=$eid[1]";
 
$r2=mysql_query($query2)or die("view quetion and result query not working.");
//$que_res=mysql_fetch_array($r2);


//part3...exam1

$query3="SELECT exam.Examshorttitle, exam.Totalmark, userexam.Examstatus, userexam.Exammark, userexam.Comment
FROM exam
INNER JOIN userexam ON exam.Examid =$eid[2]
AND userexam.Examid =$eid[2]
AND userexam.Userid =$userid";
$r3=mysql_query($query3)or die(" query4 not working.");
$part_3_exam_1=mysql_fetch_array($r3);

$query4="SELECT exam.Examshorttitle, exam.Totalmark, userexam.Examstatus, userexam.Exammark, userexam.Comment
FROM exam
INNER JOIN userexam ON exam.Examid =$eid[3]
AND userexam.Examid =$eid[3]
AND userexam.Userid =$userid";
$r4=mysql_query($query4)or die(__LINE__);
$part_3_exam_2=mysql_fetch_array($r4);
               
$query5="SELECT exam.Examshorttitle, exam.Totalmark, userexam.Examstatus, userexam.Exammark, userexam.Comment
FROM exam
INNER JOIN userexam ON exam.Examid =$eid[4]
AND userexam.Examid =$eid[4]
AND userexam.Userid =$userid";
$r5=mysql_query($query5)or die(__LINE__);
$part_3_exam_3=mysql_fetch_array($r5);



$query6="SELECT exam.Examshorttitle, exam.Totalmark, userexam.Examstatus, userexam.Exammark, userexam.Comment
FROM exam
INNER JOIN userexam ON exam.Examid =$eid[5]
AND userexam.Examid =$eid[5]
AND userexam.Userid =$userid";
$r6=mysql_query($query6)or die(__LINE__);
$part_4_exam=mysql_fetch_array($r6);





//part4 ......


mysql_close($con)or die("LINE No:".__LINE__);

?>
<html>
<header>
<head>
<meta charset="UTF-8">
</head>
</header>
<body>
<img src="header_image.PNG" style="text-aligh:center; width:100%" />
<?php echo "\n"; ?>
<p>To : <?php echo $current_username; ?><br>
<p>Address: <?php echo $useraddress; ?><br>
Dear, <b><?php echo $row1[1]." ".$row1[2]; ?></b>
</p>

We are pleased to invite you at <span style='color:red;'> "Personality Development Academy" </span><br/>
We have just conducted your English tests.Now, we know your needs and your choice of learning method.  

<!-- Old mail texts
<p> અંગ્રેજી ભાષા સુધારવા અને શીખવા માટે તમે ગંભીર છો તેની મને ખાતરી છે કારણકે  તમે અમારી કસોટી/ટેસ્ટ  આપવામાં તમારો  કીમતી સમય આપ્યો છે . નીચે તમારો ટેસ્ટ રીપોર્ટ આપેલો છે  </p>
<h2>Part 1: Choose right training method:</h2>
 <p>વિભાગ ૧  તમને અનુકુળ કે યોગ્ય લાગે તે તાલીમ પદ્ધતિ પસંદ કરો </p>
 <h2>તમે કેવી રીતે  ઈંગ્લીશ શીખવાનું પસંદ કરશો ?</h2>
-->

<!-- ૧ તમે  પર્સનાલિટી ડેવલોપમેન્ટ અકાદમીમાં કેવી  રીતે ઈંગ્લીશ શીખવાનું પસંદ કરશો?  -->
<h2>1.Which is the most suitable method for you to learn English ?</h2>
<p>There are many learning methods at PDA.We offer you following method of learning according to your choice.</p>
<div style="background:#DBDBDB;"><b>YOU Choose :</b> <h4> <?php echo $exam['Useranswer'];?></h4>

<?php
$RightAnswers=explode("|",$exam['Answeroptions']);
$answer_option_dis=explode("|",$exam['answer_option_dis']);
$index_answer_option_dis = array_search($exam['Useranswer'],$RightAnswers);
echo "<span style='color:green;'>".$answer_option_dis[$index_answer_option_dis]."</span>";
?>
</div>

<!-- ૨ તમે પર્સનાલિટી ડેવલોપમેન્ટ અકાદમીમાં કયો કોર્સ કરવાનું પસંદ કરશો ?  -->

 <!-- Old mail texts
<h2>Part 2:  Choose right training programs:</h2>
વિભાગ ૨ : તમને જરૂરી હોય તે તાલીમ પ્રોગામ પસંદ કરો<br>
<strong>તમે ઈંગ્લીશ શા માટે શીખવા ઈચ્છો છો અને તે માટે તમારે કેવા વિડીયો પ્રોગ્રામ કરવા જોઈએ ?</strong></br>
તમારી જરૂરતોને જાણવા માટે આ કસોટી લેવામાં આવી. આ ટેસ્ટને આધારે હવે અમે જાણીએ છીએ કે</br>
 -->

<h2>2.Which course do you want study at personality development academy?</h2>
<p>We have done your need analysis , you should do following programs according to your needs.</p>
<div>
<?php
echo "<br>";
$i=1;
while($row=mysql_fetch_array($r2)){
echo "<div style='background:#DBDBDB;'><b>".$i++."  ).  ".$row['Questiontitle']."</b>";

echo "<br><b>Your Answer:</b> ".$row['Useranswer'];

echo "<br>";

echo "<b>Comment: </b>". $row['comment']."</div>";

}
?>

</div>


<h2>3. This is your English language test report</h2>
<p>You should do following courses according to English language test report </p>
<div>
<h2>Exam:1</h2>
<?php
echo "<div style='background:#DBDBDB;'>";


//echo "<tr><td>Exam Title</td><td>Exam Status</td><td>Your Marks</td><td>Total Marks</td></tr>";
// echo "<tr><td>$part_3_exam_1[0]</td><td>$part_3_exam_1[2]</td><td>$part_3_exam_1[3]</td><td>$part_3_exam_1[1]</td></tr>";
?>
<span style="color:<?php if($part_3_exam_1[2]=='Fail'){echo 'red';}else{echo 'green';}?>">

<?php if($part_3_exam_1[2]=='Fail')
{    
         echo 'You must learn English from A,B,C,D .we offer complete program for beginners, please, click the following link to learn more about over video program <br> ';
              echo "<a href='englishsikho.nhnfoods.com/videouser.php?videoid=42'>https://youtu.be/OzIlg_0rIes</a>";
}
else  echo $part_3_exam_1[4];
?>
         

</span>
<?php

echo "</div>";

?>
<br>



<!-- static comment
<p>( ENGLISH 4 BEGIINERS) નો સંપૂર્ણ કોર્સ કરવો જોઈએ. આ વિડીયો પ્રોગ્રામ વિષે વધુ જાણવા માટે અહીં કિલક કરો” </p>
<p><a href="englishsikho.nhnfoods.com/videouser.php?videoid=42">http://englishsikho.nhnfoods.com/</a></p> -->


<br>
<h2>Exam 2:</h2>

<?php
echo "<div style='background:#DBDBDB;'>";

//echo "<tr><td>Exam Title</td><td>Exam Status</td><td>Your Marks</td><td>Total Marks</td></tr>";
//echo "<tr><td>$part_3_exam_2[0]</td><td>$part_3_exam_2[2]</td><td>$part_3_exam_2[3]</td><td>$part_3_exam_2[1]</td></tr>";
?>
<span style="color:<?php if($part_3_exam_2[2]=='Fail'){echo 'red';}else{echo 'green';}?>">
<?php if($part_3_exam_2[2]=='Fail')
{    
         echo 'You must get “spelling master program” to learn Basic words and to improve your word power.
                    Please, click the following link to know more<br>';
              echo "<a href='englishsikho.nhnfoods.com/videouser.php?videoid=42'>https://youtu.be/vGwZ5nsRGkk</a>";
}
else
echo $part_3_exam_2[4];
?>

</span>
<?php

echo "</div>";

?><br>



<!-- static output
<p>“તમને રોજબરોજના વપરાશમાં કામ લાગતાં અંગ્રેજી શબ્દો (સ્પેલિંગ)ની જાણકારી નથી  માટે નીચે જણાવેલાં વિડીયો પ્રોગ્રામ ખરીદો . <br>
“૯ દિવસમાં ૯૦૦ શબ્દો શીખો : આ વિડીયો પ્રોગ્રામ વિષે વધુ જાણવા  માટે અહીં કિલક કરો” </p>
<p><a href="englishsikho.nhnfoods.com/videouser.php?videoid=43">http://englishsikho.nhnfoods.com/</a></p>
  -->




<p><h2>Exam 3:</h2>

<?php
echo "<div style='background:#DBDBDB;'>";


// echo "<tr><td>Exam Title</td><td>Exam Status</td><td>Your Marks</td><td>Total Marks</td></tr>";
//echo "<tr><td>$part_3_exam_3[0]</td><td>$part_3_exam_3[2]</td><td>$part_3_exam_3[3]</td><td>$part_3_exam_3[1]</td></tr>";
?>
<span style="color:<?php if($part_3_exam_3[2]=='Fail'){echo 'red';}else{echo 'green';}?>">

<?php if($part_3_exam_3[2]=='Fail')
{    
         echo 'You do not have knowledge of basic structure of sentences. You should get “come on! Speak English confidently” please, click the following link to know more<br>';
              echo "<a href='englishsikho.nhnfoods.com/videouser.php?videoid=42'>https://www.youtube.com/watch?v=S-SuktFrGOQ</a>";
}
else
     echo $part_3_exam_3[4];
?>


</span>
<?php


echo "</div>";

?></p><br>


<!-- static output
<p> તમને અંગ્રેજી વાક્યોની રચના કરવાની જાણકારી નથી આથી તમે સારી રીતે લખી કે બોલી શકતા નથી માટે તમે નીચે જણાવેલાં વિડીયો પ્રોગ્રામ ખરીદો .<br>
<p><a href="englishsikho.nhnfoods.com/videouser.php?videoid=44">http://englishsikho.nhnfoods.com/</a></p>
</p>
-->

      <p><h2>Exam 4:</h2>
<div>
<?php
echo "<div style='background:#DBDBDB;'>";
 ?>

<span style="color:<?php if($part_4_exam[2]=='Fail'){echo 'red';}else{echo 'green';}?>">

<?php if($part_4_exam[2]=='Fail')
{    
         echo 'You do not know how to communicate well,you should take up a course on communication skills. Please, click the following links to know more about the communicative English program<br>';
              echo "<a href='englishsikho.nhnfoods.com/videouser.php?videoid=42'>https://www.youtube.com/watch?v=cpBrzM3PxBU</a>";
}
else
    echo $part_4_exam[4];
?>

</span>
<?php

echo "</div>";

?><br>

<!-- static output
    <p> “તમને અંગ્રેજીમાં સંવાદ્કલા કરવાનું ફાવતું નથી આથી તમે સારી રીતે લખી કે બોલી શકતા નથી માટે તમે  નીચે જણાવેલાં વિડીયો પ્રોગ્રામ ખરીદો .<br>“કોમ્યુનિકેટીવ ઈંગ્લીશ વિડીયો પ્રોગ્રામ  ”  : આ વિડીયો પ્રોગ્રામ વિષે વધુ જાણવા અહીં કિલક કરો” <br>
<p><a href="englishsikho.nhnfoods.com/videouser.php?videoid=45">http://englishsikho.nhnfoods.com/</a></p>
</p> -->
</div>
</div>


<!-- ૪ .અમે  પર્સનાલીટી ડેવલોપમેન્ટ અકાદમીમાં કેવી રીતે ઈંગ્લીશ શીખવાડીએ છીએ ? અમારા ગ્રાહકો/વિદ્યાર્થીઓ  શું કહે છે ?     -->
<!-- Old mail texts
<p>તમારું ઈંગ્લીશનું જ્ઞાન કેટલું છે અને તમારે કેવા  વિડીયો પ્રોગ્રામ કરવા જોઈએ ? </p>
-->
<h2>4.How do we teach English at Personality Development Academy?</h2>
<p>Please, click the following links to know more </p>
<a href="http://englishsikho.nhnfoods.com/videouser.php?videoid=53">1. Click here</a><br>
<a href="http://englishsikho.nhnfoods.com/videouser.php?videoid=54">2. Click here</a><br>  


<!-- ૫ તમે પર્સનાલીટી ડેવલોપમેન્ટ અકાદમીમાં ઈંગ્લીશ શીખવા કેવી રીતે  જોડાશો ?  -->

<h2>5.How can you join Personality Development Academy?</h2>
<p>1. Call English coach at 94262 14800  and follow the instuctions<br>  
2. Call English coach at 02832 250326  and follow the instuctions<br>
3. Deposit the fee amount in following account<br>
<a href="http://englishsikho.nhnfoods.com/payment.php">Click here for Payment</a>
</p>
<p>If you join <span style="color:red;">Personality Development Academy</span> , your communication skills will improve, your confidence will develop.<br/>
You are welcome in personality development academy !</br>
All my best wishes !</p>

Founder</br>
<span style="color:blue;">Neerav  Gadhai</span>
Personality Development Academy</br>
Mobile : 94262 14800</br>
</body>
</html>

smtp.php

<?php
include("../../../conn.php");
$con=new connection();
$r=$con->display_smtp_configuration();

while($row=mysql_fetch_array($r)){

$id=$row[0];

$row[0];
$row[1];
$adminemail = $row[1];
$row[2];
$smtpemail = $row[2];
$Host = $row[3];
$row[4];
$port = $row[4];
$row[5];
$smtppass = $row[5];

}


$login_user=$_GET['login_user'];
//session_start();
/**
 * This example shows making an SMTP connection with authentication.
 */

//SMTP needs accurate times, and the PHP time zone MUST be set
//This should be done in your php.ini, but this is how to do it if you don't have access to that
date_default_timezone_set('Etc/UTC');

require '../PHPMailerAutoload.php';

//Create a new PHPMailer instance
$mail = new PHPMailer;
//Tell PHPMailer to use SMTP
$mail->isSMTP();
//Enable SMTP debugging
// 0 = off (for production use)
// 1 = client messages
// 2 = client and server messages
$mail->SMTPDebug = 0;
//Ask for HTML-friendly debug output
$mail->Debugoutput = 'html';
//Set the hostname of the mail server
// $mail->Host = "ssl://Linuxindia2.securehostdns.com";
$mail->Host = $Host;
//Set the SMTP port number - likely to be 25, 465 or 587
$mail->Port = $port;
//Whether to use SMTP authentication
$mail->SMTPAuth = true;
$mail->CharSet = "UTF-8";
//Username to use for SMTP authentication
$mail->Username = $smtpemail;
//Password to use for SMTP authentication
$mail->Password = $smtppass;
//Set who the message is to be sent from
$mail->setFrom($smtpemail, 'English-sikho.com Report');
//Set an alternative reply-to address
$mail->addReplyTo($smtpemail, 'English-sikho.com Report');
//Set who the message is to be sent to
$mail->addAddress($login_user, "$login_user");
$mail->addAddress($adminemail, "$login_user");//send to admin...
//Set the subject line
$mail->Subject = 'English-sikho Report';
//Read an HTML message body from an external file, convert referenced images to embedded,
//convert HTML into a basic plain-text alternative body

//$mail->msgHTML(file_get_contents('mail_page.php'), dirname(__FILE__));

$File="mail_page.php";

//$output = shell_exec("php -n -s $File");
//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
function get_data($url){
$ch=curl_init();curl_setopt($ch,CURLOPT_URL,$url);curl_setopt($ch,CURLOPT_RETURNTRANSFER,true);$data=curl_exec($ch);
curl_close($ch);
return $data;
}

$examids=$_GET['examids'];
$language=$_GET['language'];


if($_SESSION[language] == "Gujrati")
{
$returned=get_data("http://englishsikho.nhnfoods.com/mail/2/examples/mail_pageguj.php?examids=$examids&login_user=$login_user");

$mail->msgHTML($returned);$mail->AltBody = 'This is a plain-text message body';

if (!$mail->send()) {
    echo "Mailer Error: " . $mail->ErrorInfo;
} else {
    header("location:http://englishsikho.nhnfoods.com/Thankyouguj.php");
}
}
else
{
$returned=get_data("http://englishsikho.nhnfoods.com/mail/2/examples/mail_pageeng.php?examids=$examids&login_user=$login_user");

$mail->msgHTML($returned);$mail->AltBody = 'This is a plain-text message body';

if (!$mail->send()) {
    echo "Mailer Error: " . $mail->ErrorInfo;
} else {
    header("location:http://englishsikho.nhnfoods.com/Thankyoueng.php");
}

}

?>

video.php

<?php
//header('Content-Type: text/html;charset=utf-8');
include("header.php");
include("../conn.php");
$videoid=$_GET['videoid'];
$con=new connection();
$r=$con->display_selected_videos($videoid);
?>


<?php
while($row=mysql_fetch_array($r)){
?>
<input type="hidden" name="videoid" value="<?php echo $row[0];?>">

<!-- <div class="row">
<div class="col-md-2">
<h4>Update Video</h4>
</div>
<div class="col-md-2"></div>
<div class="col-md-2"></div>
<div class="col-md-2"></div>
<div class="col-md-2"></div>
<div class="col-md-2">
<label>Language<span class="required">* </span></label>
<select id="lang" name="lang" class="form-control">
<option value="English" <?php if($row['Language']=='English'){ echo "selected";}?>>English</option>
<option value="Gujrati"<?php if($row['Language']=='Gujrati'){ echo "selected";}?>>Gujrati</option>
</select>
</div>
</div>
-->

<!-- <section class="col-md-12 col-sm-12">
<div class="col-right">
<div id="datetimepicker" class="input-append" style="position:relative;">
<label>Date/Time<span class="required">* </span></label>
<input type="text" class=" dateinput form-control" id="date_visit" name="datetime" value="<?php echo $row[4];?>">
<span class="add-on" style="position:absolute; top:34px; right:5px; cursor:pointer"><i data-time-icon="icon-time" data-date-icon="icon-calendar" class="icon-calendar"></i></span>
</div>
 
</div>
-->
<div class="container">
<section class="col-md-12 col-sm-12">

<div class="col-right">
<h4><?php echo $row[1];?></h4>



<!-- Start code --  Show video -->
       <?php $link=$row[3]; ?>


<iframe src="<?php echo $link; ?>" width="560" height="400" frameborder="0" allowfullscreen></iframe>
       <!-- Stop code Show video -->
<br><br><h4><!-- Description --></h4>
<div>
<?php echo $row[2];?>    

</div>


     


</section>
</div>
</div>

<script>
CKEDITOR.replace( 'Newsdescription' );

</script>

<?php
}
?>
<!-- <div class="row">
<div class="col-md-2"></div>
<div class="col-md-2"></div>
<div class="col-md-2"></div>
<div class="col-md-2"></div>
<div class="col-md-2"></div>
<div class="col-md-2">
<input type="submit" id="submit-contact" value="Update video" class=" button_medium">
</div>
</div>
-->


<script type="text/javascript" src="../js/bootstrap-datetimepicker.min.js"></script>
<script type="text/javascript">
      $('#datetimepicker').datetimepicker({
        format: 'yyyy-MM-dd hh:mm',
pick12HourFormat: false,   // enables the 12-hour format time picker
  pickSeconds: false,
        language: 'en'
      });
</script>
<?php
include("footer.php");
?>