0byt3m1n1
Path:
C:
/
wamp64
/
www
/
cpms_new
/
USER
/
[
Home
]
File: edit_student_ctrl.php
<?php require_once "../lib/config.php"; require_once BASE_DIR."/lib/db/connection.php"; require_once"../model/employee_mdl.php"; require_once "../model/defaultValues_mdl.php"; require_once "../model/uploader_mdl.php"; require_once BASE_DIR."/Proposels/imagePath.php"; //$p_id=@$_SESSION['project_id']; $u_id=@$_SESSION['user_id']; $empdb_id=$_GET['id']; $sql="select * from student where user_id='$u_id' and s_id = '$empdb_id'"; $sql1=mysql_query($sql); while($row=mysql_fetch_array($sql1)) { //1 $student_id=$row['s_id']; $empName=$row['name']; $empAddress= $row['address']; $empPhone= $row['phone']; $title = $row['title']; $remark = $row['remarks']; $empEmail=$row['email']; $course=$row['course']; $college= $row['college']; $category= $row['category']; $joindate=$row['start_date']; $endingdate=$row['end_date']; list($JD_yy, $JD_mm, $JD_dd) = split('[/.-]', $joindate); list($ED_yy, $ED_mm, $ED_dd) = split('[/.-]', $endingdate); }//1 if(isset($_POST['Update'])) { //2 $error_flag=0; $empName=@$_POST['txtename']; $editempid=@$_POST['txtid']; $empAddress= @$_POST['txtempaddress']; $empPhone= @$_POST['txteph']; $title=@$_POST['txttitle']; $remark=@$_POST['txtremarks']; $empEmail=@$_POST['txtmailid']; $course=@$_POST['txtcourse']; $college= @$_POST['txtcollege']; $category= @$_POST['cmbcategory']; $JD_mm= @$_POST['cmbjoinmm']; $JD_dd=@$_POST['cmbjoindd']; $JD_yy=@$_POST['txtjoinyy']; $JD=$JD_yy."-".$JD_mm."-".$JD_dd; $ED_mm= @$_POST['cmbendmm']; $ED_dd=@$_POST['cmbenddd']; $ED_yy=@$_POST['cmbendyy']; $ED=$ED_yy."-".$ED_mm."-".$ED_dd; if (@$_POST['cmbcategory']=="Select") { $error['category']="Please select category"; $error_flag=1; } if (!is_numeric(@$_POST['txteph'])) { $error['phone_numeric']="Only allow numbers"; $error_flag=1; } if (!is_numeric(@$_POST['txtjoinyy'])) { $error['JD_numeric']="Please enter valid year"; $error_flag=1; } if (!is_numeric(@$_POST['cmbendyy'])) { $error['Ed_numeric']="Please enter valid year"; $error_flag=1; } if($empName=="") { $error['name_null']="Please Enter Name"; $error_flag=1; } if(ED_yy=="") { $error['Ed_null']="Please Enter Year"; $error_flag=1; } if(@$_POST['txtjoinyy']=="") { $error['JD_null']="Please Enter Date of Joining"; $error_flag=1; } $file_selected_flag=0; if( is_uploaded_file($_FILES['ffphoto']['tmp_name'])) { //59 $original_file_name=$_FILES['ffphoto']['name']; //echo $editempid.$original_file_name;exit(); $result= Filecheck::doccumentCheck("student","file", $editempid.$original_file_name); if($result==true) { //22 $error_flag=1; $error['filename']="File name already exists. Please rename the file and try again"; } if($error_flag==0) { $type_temp = $_FILES['ffphoto']['type']; $original_file_name_temp=$_FILES['ffphoto']['name']; $temp_filepath= $_FILES['ffphoto']['tmp_name']; $result=Upload::uploadDoccument("employe",$editempid,$type_temp,$original_file_name_temp,$temp_filepath); $temp_fn_restore= $result['filename']; $error_flag=0; $file_selected_flag=1; } } //59 else //uploading failed {//59 $error_flag==1; $error['filename']="File uploading failed"; }//59 if($error_flag==1) { include "edit_student.php"; exit(); /* $url=$server_ip."/USER/search_student.php?message=$message"; echo "<script>window.location='$url'</script>"; */ } else { $sql="select * from student where user_id='$u_id' and s_id='$editempid'"; $sql1=mysql_query($sql); while($row=mysql_fetch_array($sql1)) { //1 $old_photo_name=$row['file']; } $result= Employee::UpdateStudent($editempid,$empName,$empAddress,$empPhone,$empEmail,$course,$college,$category,$JD,$ED,$title,$remark,$temp_fn_restore,$old_photo_name); if ($result=="True") { $message="Updation Completed successfully.."; $url= $server_ip."/USER/search_student.php?message=$message"; echo "<script>window.location='$url'</script>"; } else { $message="Updation Failed.."; $url=$server_ip."/USER/search_student.php?message=$message"; echo "<script>window.location='$url'</script>"; } } } ?>