ok

Mini Shell

Direktori : /home2/selectio/www/salemgovtitialumni.in/api/
Upload File :
Current File : /home2/selectio/www/salemgovtitialumni.in/api/add-member.php

<?php 
ob_start();
 include '../dashboard/admin/inc/config.php' ;
 
 
 
if(isset($_POST['type']) && $_POST['type']=='create_member'){
         try{
             
            
 
            $name=$_POST['name'];
            $father_name = $_POST['father_name'];
            $present_address = $_POST['present_address'];
            $permanent_address = $_POST['permanent_address'];
            $mobile=$_POST['mobile'];
    	    $email=$_POST['email'];
            $education = $_POST['education'];
            $profession = $_POST['profession'];
            $training = $_POST['training'];
            $trade = $_POST['trade'];
            $password = $_POST['password'];
            $member_ship = $_POST['member_ship'];

            
            
            
            $statement = $pdo->prepare("INSERT INTO  `tbl_member` (`name`, `father_name`, `present_address`, `permanent_address`,
            `phone_no`, `email`, `education`, `business`, `training`, `trade`, `password`, `membership_type`) 
            VALUES (?,?,?,?,
            ?,?,?,?,?,?,?,?)");
            $result=$statement->execute(array($name,$father_name,$present_address,$permanent_address,
            $mobile,$email,$education,$profession,$training,$trade,$password,$member_ship));
                    
                 $lastinsert = $pdo->lastInsertid();
                 
                 $reg_id='ITI-'.str_pad($lastinsert, 3, "0", STR_PAD_LEFT);

                   if($result){ 
                        $return_arr['message']='Registration Successfully...';
                        $return_arr['status']=200;
                    } 
                    
                    
                else{
                    $return_arr['message']='Something Went Wrong..';
                    $return_arr['status']=400;
                }
            
                }catch(Exception $e){
                    $return_arr['message']="$e";
                    $return_arr['status']=500;
                }   
                echo json_encode($return_arr);
    }
    
    
    
    
    if(isset($_POST['type']) && $_POST['type']=='update_member'){
         try{
             
             
             
                 
    
                if(isset($_FILES['profile_image']) && $_FILES["profile_image"]["name"]!=""){
                    $extension = end(explode(".", $_FILES["profile_image"]["name"]));
                    $image = rand(10,1000000000)."-gallery." . $extension;
                    $upload = move_uploaded_file($_FILES['profile_image']['tmp_name'], '../dashboard/admin/img/profile/' . $image);
                    $upload_image = 'dashboard/admin/img/profile/' . $image;   
                }
                else{
                    $upload_image=$_POST['old_profile_image'];
                }
            
             
            
            $ids=$_POST['ids'];
            $name=$_POST['name'];
            $father_name = $_POST['father_name'];
            $present_address = $_POST['present_address'];
            $permanent_address = $_POST['permanent_address'];
            $mobile=$_POST['mobile'];
    	    $email=$_POST['email'];
            $education = $_POST['education'];
            $profession = $_POST['profession'];
            $training = $_POST['training'];
            $trade = $_POST['trade'];
            $password = $_POST['password'];
            $blood_group = $_POST['blood_group'];
          

            $statement = $pdo->prepare("UPDATE tbl_member SET `name`=?, `father_name`=?, `present_address`=?, `permanent_address`=?,
            `phone_no`=?, `email`=?, `education`=?, `business`=?, `training`=?, `trade`=?, `password`=?,`blood_group`=?,`profile`=?  WHERE id=?");
    		$statement->execute(array($name,$father_name,$present_address,$permanent_address,
            $mobile,$email,$education,$profession,$training,$trade,$password,$blood_group,$upload_image,$ids));
            


                   if($statement){ 
                        $return_arr['message']='Profile Updated Successfully...';
                        $return_arr['status']=200;
                    } 
                    
                    
                else{
                    $return_arr['message']='Something Went Wrong..';
                    $return_arr['status']=400;
                }
            
                }catch(Exception $e){
                    $return_arr['message']="$e";
                    $return_arr['status']=500;
                }   
                echo json_encode($return_arr);
    }
    
?>

Zerion Mini Shell 1.0