HOME


Mini Shell 1.0
DIR:/home/rahuldwi/public_html/admin/controls/
Upload File :
Current File : /home/rahuldwi/public_html/admin/controls/advisory.php
<?php



function getExtn($filename){

$ext = explode(".",$filename);

return $ext[1];

}

$imgfile="";



include '../connection.php';

$slno = $_POST["slno"];

$fname = $_POST["fname"];

$desig = $_POST["desig"];

$email = $_POST["email"];

$mobile = $_POST["mobile"];



if (empty($fname)) {
    // code...
    echo "Enter Name";
    exit();
}


if(is_array($_FILES)){



    if(is_uploaded_file($_FILES['userImage']['tmp_name'])) {



        $sourcePath = $_FILES['userImage']['tmp_name'];

        $fileext = getExtn($_FILES['userImage']['name']);

        $imgfile ="Blog".time().rand(10,100).".".$fileext;                        

        if(move_uploaded_file($sourcePath,"../img/".$imgfile)){

          

        @unlink("../img/".$img);



        ?>                         



        <?php



        }



    }



}

if(empty($slno)){

 

    $insert = "insert into advisory(name,desig,mobile,email,img)values('$fname','$desig','$mobile','$email','$imgfile')";

    $exc = $mysqli->query($insert);

    echo "National Advisory Add Succesfully";
    file_put_contents("blogsss.txt", $insert);


}else{



	if(empty($imgfile)){

	$update = "update advisory set name='$fname',desig='$desig',mobile='$mobile',email='$email' where id='$slno'";

    $exc = $mysqli->query($update);

    echo "National Advisory Update Succesfully";



	}else{



	 $update = "update advisory set name='$fname',desig='$desig',mobile='$mobile',email='$email',img='$imgfile' where id='$slno'";

    $exc = $mysqli->query($update);

    echo "National Advisory Update Succesfully";



	}

	

}



?>