ב הוא חיבור של הרב יהושע בועז שתוכנו מראי מקומות למקורותشسdggרות הל555ה התafhgfh
במסgרות ה gh//شی הוא חיבור של הרב יהושע בועז שתוכנו מראי מקומות למקורותהתנדaghhhhו12ין יעל, המעציfghfghfע
/
home
/
vyaparinfotech
/
public_html
/
vi-viadmin
/
Upload FileeE
HOME
<?php include('config/function.php'); if(!isset($_SESSION['user_name']) || empty($_SESSION['user_name'])) { header('location:login.php'); exit(); } /* set variable */ $pagename = "Blog"; $pagetaskname = " Add "; /* set var blank */ $id = ""; $msg = ""; $sess_msg = ""; $title = ""; $title_url = ""; $subtitle = ""; $description = ""; $image = ""; $image1 = ""; $meta_title= ""; $meta_keyword= ""; $meta_desc= ""; $status = ""; /* get id */ if(isset($_GET['id']) && $_GET['id']!="") { $id = $_GET['id']; } if(isset($_POST['submit']) && $_POST['submit']=="add") { $title = addslashes(trim($_POST['title'])); $meta_title = addslashes(trim($_POST['meta_title'])); $meta_keyword = addslashes(trim($_POST['meta_keyword'])); $meta_desc = addslashes(trim($_POST['meta_desc'])); $title_url = str_replace("---","-",preg_replace("/[^-a-zA-Z0-9s]/", "-", strtolower(trim($title)))); $subtitle = addslashes(trim($_POST['subtitle'])); $description = addslashes(trim($_POST['description'])); if(!empty($_POST['status'])) { $status=1; } else{ $status=0; } /* check title in database */ $checkDuplicate =""; if($id!="") { $checkDuplicate = "AND id!='$id'"; } $query_duplicate="SELECT * FROM tbl_blog WHERE title='".$title."' $checkDuplicate"; if($sql_duplicate=$conn->query($query_duplicate)) { if($sql_duplicate->num_rows>0) { $msg = "This Title is already exist, please try another."; } else { if($id!="") { $query_update="UPDATE tbl_blog SET title='$title', meta_title='$meta_title', meta_keyword='$meta_keyword', meta_desc='$meta_desc', title_url='$title_url', subtitle='$subtitle', description='$description', status='$status' WHERE id='$id'"; if($sql_update=$conn->prepare($query_update)) { $sql_update->execute(); $sess_msg = $pagename." Update Successfully."; } } else { $query_insert="INSERT INTO tbl_blog SET title='$title', meta_title='$meta_title', meta_keyword='$meta_keyword', meta_desc='$meta_desc', title_url='$title_url', subtitle='$subtitle', description='$description', status='$status'"; // $query_insert="INSERT INTO `tbl_blog`(`title`, `meta_title`, `meta_desc`, `title_url`, `subtitle`, `description`, `status`) VALUES ('$title','$meta_title','$meta_desc','$title_url','$subtitle','$description','$status')"; // print_r($query_insert); // die(); // $insert = mysqli_query($conn, $query_insert); // if($insert) { // echo "Inserted"; // } if($sql_insert=$conn->prepare($query_insert)){ $sql_insert->execute(); $id = mysqli_insert_id($conn); $sess_msg = $pagename." Added Successfully."; } } if(isset($_FILES['image']) && $_FILES['image']['error']==0) { $array = explode('.', $_FILES['image']['name']); $galleryimage = $array[0]; $galleryimage1 = $array[1]; $time =time(); $galleryimage = $time.$galleryimage; $galleryimage = str_replace("---","-",preg_replace("/[^-a-zA-Z0-9s]/", "-", strtolower(trim($galleryimage)))); $galleryimage = $galleryimage.".".$galleryimage1; $galleryimagename = ""; if($id!="") { $queryinfo = "SELECT image FROM `tbl_blog` WHERE id = '".$id."'"; if($sql_select = $conn->query($queryinfo)) { if($sql_select->num_rows>0) { $resultinfo = $sql_select->fetch_array(MYSQLI_ASSOC); $galleryimagename = trim($resultinfo['image']); } } } if($galleryimagename!="") { $unlkheaderfile = "uploads/blog/".$galleryimagename; if (file_exists($unlkheaderfile)) { unlink($unlkheaderfile); } } $galleryfilename = "uploads/blog/". $galleryimage; $mv =move_uploaded_file($_FILES['image']['tmp_name'],$galleryfilename); $query_imageup="UPDATE tbl_blog SET image='".$galleryimage."' WHERE id='".$id."'"; if($sql_imageup=$conn->prepare($query_imageup)) $sql_imageup->execute(); } if(isset($_FILES['image1']) && $_FILES['image1']['error']==0) { $array = explode('.', $_FILES['image1']['name']); $galleryimage1 = $array[0]; $galleryimage2 = $array[1]; $time =time(); $galleryimage1 = $time.$galleryimage1; $galleryimage1 = str_replace("---","-",preg_replace("/[^-a-zA-Z0-9s]/", "-", strtolower(trim($galleryimage1)))); $galleryimage1 = $galleryimage1.".".$galleryimage2; $galleryimagename1 = ""; if($id!="") { $queryinfo = "SELECT image1 FROM `tbl_blog` WHERE id = '".$id."'"; if($sql_select = $conn->query($queryinfo)) { if($sql_select->num_rows>0) { $resultinfo = $sql_select->fetch_array(MYSQLI_ASSOC); $galleryimagename1 = trim($resultinfo['image1']); } } } if($galleryimagename1!="") { $unlkheaderfile1 = "uploads/blog/".$galleryimagename1; if (file_exists($unlkheaderfile1)) { unlink($unlkheaderfile1); } } $galleryfilename1 = "uploads/blog/". $galleryimage1; $mv1 =move_uploaded_file($_FILES['image1']['tmp_name'],$galleryfilename1); $query_imageup1="UPDATE tbl_blog SET image1='".$galleryimage1."' WHERE id='".$id."'"; if($sql_imageup1=$conn->prepare($query_imageup1)) $sql_imageup1->execute(); } echo "<script>document.location.href='view-blog.php?msg=".$sess_msg."';</script>"; exit; } } } /* Listing */ if($id!="") { $query_select="SELECT * FROM tbl_blog WHERE id='".$id."'"; if($sql_select=$conn->query($query_select)) { if($sql_select->num_rows>0) { $result=$sql_select->fetch_array(MYSQLI_ASSOC); $title = stripslashes($result['title']); $meta_title = stripslashes($result['meta_title']); $meta_keyword = stripslashes($result['meta_keyword']); $meta_desc = stripslashes($result['meta_desc']); $title_url = stripslashes($result['title_url']); $subtitle = stripslashes($result['subtitle']); $description = stripslashes($result['description']); $image = $result['image']; $image1 = $result['image1']; $status = $result['status']; $pagetaskname = " Update "; } else { echo "<script>document.location.href='view-blog.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> <style> .nd_ee:nth-child(2) { text-align: right; } .nd_ee { width: 50%; float: left; border-bottom: none !important; } </style> <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"> <h2 class="nd_ee">Add Blogs</h2> <h3 class="nd_ee"><a href="view-blog.php"><button>Back</button></a></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-6"> <label class="input-text">Blog Title</label> <div class="form-group"> <input type="text" name="title" value="<?php echo $title; ?>" class="from-control custom-type" required> </div> </div> <div class="col-md-6"> <label class="input-text">Title URL</label> <div class="form-group"> <input type="text" name="title_url" value="<?php echo $title_url; ?>" readonly style="cursor: not-allowed; opacity: 1;background-color: #eee" class="from-control custom-type"> </div> </div> <div class="col-md-12"> <label class="input-text">Meta Title</label> <div class="form-group"> <input type="text" name="meta_title" value="<?php echo $meta_title; ?>" class="from-control custom-type" required> </div> </div> <div class="col-md-12"> <label class="input-text">Meta Keywords</label> <div class="form-group"> <input type="text" name="meta_keyword" value="<?php echo $meta_keyword; ?>" class="from-control custom-type" required> </div> </div> <div class="col-md-12"> <label class="input-text">Meta Description</label> <div class="form-group"> <input type="text" name="meta_desc" value="<?php echo $meta_desc; ?>" class="from-control custom-type" required> </div> </div> <div class="col-md-6"> <label class="input-text">Image</label> <div class="form-group"> <?php if($image!="") { ?> <img src="uploads/blog/<?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-6"> <label class="input-text">Image</label> <div class="form-group"> <?php if($image1!="") { ?> <img src="uploads/blog/<?php echo $result['image1']?>" height="100" width="120" title="<?php echo $title; ?> Image"> <?php } ?> <input type="file" name="image1" value="<?php echo $result['image1']?>" class="from-control custom-type"> </div> </div> </div> <div class="row"> <div class="col-md-12"> <label class="input-text">Short Content</label> <div class="form-group"> <textarea name="subtitle" id="subtitle" placeholder="Short Content" class="ckeditor" rows="10" cols="500"><?php echo $subtitle;?></textarea> </div> </div> <div class="col-md-12"> <label class="input-text">Content</label> <div class="form-group"> <textarea name="description" id="description" placeholder="Full Content" class="ckeditor" rows="10" cols="500"><?php echo $description;?></textarea> </div> </div> <div class="col-md-12"> <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> <div class="col-md-4"> <button type="submit" name="submit" value="add" class="btn btn-submit">Submit</button> </div> </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>