Файловый менеджер - Редактировать - /home/d46091/udyogaadhaar.net/blog-post/add-blog.php
Назад
<html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Add blog </title> <link rel="icon" href="./assets/img/flag.png" type="image/gif" sizes="16x16"> <link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css" integrity="sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p" crossorigin="anonymous" /> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"> <link rel="stylesheet" href="/assets/css/main.css"> <script src="/assets/ckeditor/ckeditor.js"></script> </head> <body> <?php include"header.php";?> <div class="container"> <?php //login auth if ((empty($_POST['pass'])) || ($_POST['pass'] != "123")) { echo'<form action="" method="post"> <div class="form-group"> <label for="exampleInputPassword1">Password</label> <input type="password" name="pass" class="form-control" id="exampleInputPassword1" placeholder="Password"> </div> <button type="submit" class="btn btn-primary">Submit</button> </form></div>'; include "footer.php"; exit; } if (isset($_POST['filename']) && $_POST['filename'] != '') { include "../config.php"; //canging space to - $filename = preg_replace('/[^a-zA-Z0-9\']/', '-', $_POST['filename']); $filename = strtolower(str_replace("'", '', $filename)); $filename .= ".php"; //makeing blog page $myfile = fopen($filename, "w") or die("Unable to open file!"); $txt_contant = ' <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>'.$_POST['title'].'</title> <meta name="description" content="'.$_POST['meta_description'].'"> <link rel="icon" href="/assets/img/logo.png" type="image/gif" sizes="16x16"> <link rel="stylesheet" href="https://pro.fontawesome.com/releases/v5.10.0/css/all.css" integrity="sha384-AYmEC3Yw5cVb3ZcuHtOA93w35dYTsvhLPVnYs9eStHfGJvOvKxVfELGroGkvsg+p" crossorigin="anonymous"/> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css"> <link rel="stylesheet" href="/assets/css/main.css"> <link rel="stylesheet" href="blog.css"> </head> <?php include("../components/header.php");?> <style> .bs-example{ margin: 20px; } a{ color: var( --e-global-color-primary ); margin-bottom: 0px; font-size:12px; font-weight:700; text-decoration: none !important; } a:hover{ color: var( --e-global-color-primary ); } p.card-text { font-size: 14px; text-transform: unset !important; line-height: 1.2em; } h5.card-title { font-size: 18px; text-transform: unset !important; text-align: center; font-weight: 700; color: #121c03; } </style> <br> <br> <div class="container"> <div class="row"> <div class="col-lg-8"> '.$_POST['contant'].' </div> <div class ="col-lg-4"> <?php include"sidebar.php";?> </div> </div> </div> <?php include"footer.php";?>'; fwrite($myfile, $txt_contant); fclose($myfile); //upload image $target_dir = "images/"; $target_file = $target_dir . basename($_FILES["img"]["name"]); $uploadOk = 1; $imageFileType = strtolower(pathinfo($target_file, PATHINFO_EXTENSION)); $check = getimagesize($_FILES["img"]["tmp_name"]); if ($check !== false) { $uploadOk = 1; } else { $uploadOk = 0; } if (file_exists($target_file)) { $uploadOk = 0; } if ($_FILES["img"]["size"] > 5*1048576) { $uploadOk = 0; } if ($imageFileType != "webp" && $imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg" && $imageFileType != "gif") { $uploadOk = 0; } if ($uploadOk == 1) { if (!move_uploaded_file($_FILES["img"]["tmp_name"], $target_file)) { die('<div class="alert alert-danger" role="alert">Sorry, there was an error uploading your file.</div>'); } } $sql = "INSERT INTO `blog_post`( `title`, `short_description`, `image_url`, `page_url`) VALUES ('".mysqli_real_escape_string($conn, $_POST['title'])."','".mysqli_real_escape_string($conn, $_POST['short_description'])."','/blog/".mysqli_real_escape_string($conn, $target_file)."','/blog/".mysqli_real_escape_string($conn, $filename)."');"; if ((mysqli_query($conn, $sql))) { echo '<div class="alert alert-success" role="alert"> <h5> Blog created successfully</h5></div>'; } else { echo '<div class="alert alert-danger" role="alert"> <h5> ' . $sql . '<br>' . mysqli_error($conn).'</h5></div>'; } } ?> <form action="" method="post" enctype="multipart/form-data"> <div class="form-group"> <label for="exampleFormControlInput1">URL</label> <input type="text" class="form-control" name="filename" required> </div> <div class="form-group"> <label for="exampleFormControlTextarea1">Title</label> <input type="text" class="form-control" name="title" required> </div> <div class="form-group"> <label for="exampleFormControlTextarea1">Meta Discription</label> <input type="text" class="form-control" name="meta_description" required> </div> <div class="form-group"> <label for="exampleFormControlTextarea1">Image</label> <input type="file" class="form-control" name="img" required> </div> <div class="form-group"> <label for="exampleFormControlTextarea1">Short Discription</label> <input type="text" class="form-control" name="short_description" required> </div> <div class="form-group"> <label for="exampleFormControlTextarea1">Contant</label> <textarea class="form-control" name="contant" rows="20" type="text" id="containt" required></textarea> </div> <input type="hidden" value="<?php echo $_POST['pass']; ?>" name="pass" required> <button type="submit" class="btn btn-primary mb-2">Submit</button> </form> </div> <?php include"footer.php";?> </body> <script> CKEDITOR.replace('containt'); </script> </html>
| ver. 1.4 |
Github
|
.
| PHP 8.1.32 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка