HOME


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



function getExtn($filename){

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

return $ext[1];

}

$imgfile="";



include '../connection.php';

$slno = $_POST["slno"];

$descr = $_POST["descr"];

$fname = $_POST["fname"];

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

$descr = str_replace("'"," ",$_POST["descr"]);



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 patron(name,img,descr)values('$fname','$imgfile','$descr')";

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

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


}else{



	if(empty($imgfile)){

	$update = "update patron set descr='$descr',name='$fname' where id='$slno'";

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

    echo "Patron Update Succesfully";



	}else{



	$update = "update patron set descr='$descr',img='$imgfile',name='$fname' where id='$slno'";

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

    echo "Patron Update Succesfully";



	}

	

}



?>