ב הוא חיבור של הרב יהושע בועז שתוכנו מראי מקומות למקורותشسdggרות הל555ה התafhgfh
במסgרות ה gh//شی הוא חיבור של הרב יהושע בועז שתוכנו מראי מקומות למקורותהתנדaghhhhו12ין יעל, המעציfghfghfע
/
home
/
vyaparinfotech
/
public_html
/
vi-viadmin
/
Upload FileeE
HOME
<?php include('config/conn.php'); include('config/function.php'); if(!isset($_SESSION['user_name']) || empty($_SESSION['user_name'])) { header('location:login.php'); exit(); } /* set variable */ $pagename = "Latest Buyers"; $pagetaskname = " Add "; /* set var blank */ $id = ""; $msg = ""; $sess_msg = ""; $name = ""; $product = ""; $quantity = ""; $country = ""; $content = ""; $d_date = ""; $status = ""; /* get id */ if(isset($_GET['id']) && $_GET['id']!="") { $id = $_GET['id']; } if(isset($_POST['submit']) && $_POST['submit']=="add") { $name = addslashes(trim($_POST['name'])); $product = addslashes(trim($_POST['product'])); $quantity = addslashes(trim($_POST['quantity'])); $country = addslashes(trim($_POST['country'])); $content = addslashes(trim($_POST['content'])); $d_date = addslashes(trim($_POST['d_date'])); if(!empty($_POST['status'])) { $status=1; } else{ $status=0; } /* check title in database */ if($id!="") { $query_update="UPDATE tbl_tips SET name='".$name."',product='".$product."',status='".$status."',quantity='".$quantity."',d_date='".$d_date."',country='".$country."',content='".$content."' WHERE id='".$id."'"; if($sql_update=$conn->prepare($query_update)) { $sql_update->execute(); $sess_msg = " Update Successfully."; } } else { $query_insert="INSERT INTO tbl_tips SET name='".$name."',product='".$product."',status='".$status."',quantity='".$quantity."',d_date='".$d_date."',country='".$country."',content='".$content."'"; // echo $query_insert; // die; if($sql_insert=$conn->prepare($query_insert)) { $sql_insert->execute(); $id = mysqli_insert_id($conn); $sess_msg = " Added Successfully."; } } if(isset($_FILES['image']) && $_FILES['image']['error']==0) { $array = explode('.', $_FILES['image']['name']); $tbl_newsimage = $array[0]; $tbl_newsimage1 = $array[1]; $time =time(); $tbl_newsimage = $time.$tbl_newsimage; $tbl_newsimage = str_replace("---","-",preg_replace("/[^-a-zA-Z0-9s]/", "-", strtolower(trim($tbl_newsimage)))); $tbl_newsimage = $tbl_newsimage.".".$tbl_newsimage1; $tbl_newsimagename = ""; if($id!="") { $queryinfo = "SELECT image FROM `tbl_tips` WHERE id = '".$id."'"; if($sql_select = $conn->query($queryinfo)) { if($sql_select->num_rows>0) { $resultinfo = $sql_select->fetch_array(MYSQLI_ASSOC); $tbl_newsimagename = trim($resultinfo['image']); } } } if($tbl_newsimagename!="") { $unlkheaderfile = "uploads/tips/".$tbl_newsimagename; if (file_exists($unlkheaderfile)) { unlink($unlkheaderfile); } } $tbl_newsfilename = "uploads/tips/". $tbl_newsimage; $mv =move_uploaded_file($_FILES['image']['tmp_name'],$tbl_newsfilename); $query_imageup="UPDATE tbl_tips SET image='".$tbl_newsimage."' WHERE id='".$id."'"; if($sql_imageup=$conn->prepare($query_imageup)) $sql_imageup->execute(); } echo "<script>document.location.href='view-tips.php?msg=".$sess_msg."';</script>"; exit; } /* Listing */ if($id!="") { $query_select="SELECT * FROM tbl_tips WHERE id='".$id."'"; if($sql_select=$conn->query($query_select)) { if($sql_select->num_rows>0) { $result=$sql_select->fetch_array(MYSQLI_ASSOC); $name = stripslashes($result['name']); $product = stripslashes($result['product']); $quantity = stripslashes($result['quantity']); $country = stripslashes($result['country']); $content = stripslashes($result['content']); $d_date = stripslashes($result['d_date']); $status = $result['status']; $image = $result['image']; $pagetaskname = " Update "; } else { echo "<script>document.location.href='view-tips.php';</script>"; exit; } } } ?> <!DOCTYPE html> <html> <meta http-equiv="content-type" content="text/html;charset=utf-8" /> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport"> <title>Dashboard</title> <link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css"> <link rel="stylesheet" href="bower_components/Ionicons/css/ionicons.min.css"> <link rel="stylesheet" href="dist/css/AdminLTE.min.css"> <link rel="stylesheet" href="dist/css/skins/_all-skins.min.css"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script> <script src="dist/js/editor.js"></script> <script> $(document).ready(function() { $("#txtEditor").Editor(); }); </script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css"> <link href="dist/css/editor.css" type="text/css" rel="stylesheet"/> </head> <body class="hold-transition skin-blue sidebar-mini"> <div class="wrapper"> <?php include('header.php') ?> <?php include('left-menu.php') ?> <div class="content-wrapper"> <section class="content"> <div class="row"> <div class="col-md-12"> <?php if($msg!="") { ?><h5 class="h5-headn" style="color:red;"><?php echo $msg; ?></h5><?php } else { ?> <div class="main-title"> <h3>Add Latest Buyers</h3> </div> <?php } ?> </div> <div class="col-md-12"> <div class="field-section"> <form method="post" enctype="multipart/form-data"> <div class="row"> <div class="col-md-4"> <label class="input-text">Name</label> <div class="form-group"> <input type="text" name="name" value="<?php echo $name; ?>" class="from-control custom-type"> </div> </div> <div class="col-md-4"> <label class="input-text">Product</label> <div class="form-group"> <input type="text" name="product" value="<?php echo $product; ?>" class="from-control custom-type"> </div> </div> <div class="col-md-4"> <label class="input-text">Quantity</label> <div class="form-group"> <input type="text" name="quantity" value="<?php echo $quantity; ?>" class="from-control custom-type"> </div> </div> <div class="row"> <div class="col-md-4"> <label class="input-text">Country</label> <div class="form-group"> <input type="text" name="country" value="<?php echo $country; ?>" class="from-control custom-type"> </div> </div> <div class="col-md-4"> <label class="input-text">Why do you need this ?</label> <div class="form-group"> <input type="text" name="content" value="<?php echo $content; ?>" class="from-control custom-type"> </div> </div> <div class="col-md-4"> <label class="input-text">Date</label> <div class="form-group"> <input type="date" name="d_date" value="<?php echo $d_date; ?>" class="from-control custom-type"> </div> </div> </div> <div class="col-md-12"> <div class="col-md-4"> <label class="input-text">flag</label> <div class="form-group"> <?php if($image!="") { ?> <img src="<?php echo $site_root; ?>/uploads/tips/<?php echo $result['image']?>" height="100" width="120" title="<?php echo $title; ?> Image"> <?php } ?> <input type="file" name="image" value="<?php echo $result['image']?>" class="from-control custom-type"> </div> </div> <div class="col-md-4"> <label class="input-text">Status?</label> <br> <label class="switch"> <input type="checkbox" class="form-control" name="status[]" id="status" value="1" <?php if($status== 1) { echo "checked"; } ?>/> <div id="status_status"></div> </label> </div> <button type="submit" name="submit" value="add" class="btn btn-submit">Submit</button> </div> </div> </form> </div> </div> </div> </section> </div> <!-- /.content-wrapper --> <?php include('footer.php');?> </div> <script src="bower_components/jquery-ui/jquery-ui.min.js"></script> <script> $.widget.bridge('uibutton', $.ui.button); </script> <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script> <script src="dist/js/adminlte.min.js"></script> <script src="http://ajax.aspnetcdn.com/ajax/jquery.validate/1.12.0/jquery.validate.min.js" type="text/javascript"></script> <link rel="stylesheet" href="lib/ToggleSwitch.css"/> <script src="lib/ToggleSwitch.js"></script> <script> $(function(){ $("#status").toggleSwitch(); $("#myonoffswitch2").toggleSwitch(); }); </script> <script src="https://cdn.ckeditor.com/4.15.0/standard/ckeditor.js"></script> </body> </html>