-
-
-
・
- -From f9b533b74b8bacd6c4a85f8bb48ead85144d7ea2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E3=81=A0=E3=81=84=E3=81=A1=E3=81=BE=E3=82=8B?=
<98202777+Daichimarukana@users.noreply.github.com>
Date: Thu, 17 Aug 2023 19:59:13 +0900
Subject: [PATCH] Delete ueuse directory
---
ueuse/index.php | 620 ------------------------------------------------
1 file changed, 620 deletions(-)
delete mode 100644 ueuse/index.php
diff --git a/ueuse/index.php b/ueuse/index.php
deleted file mode 100644
index cec3dae..0000000
--- a/ueuse/index.php
+++ /dev/null
@@ -1,620 +0,0 @@
- PDO::ERRMODE_EXCEPTION,
- PDO::MYSQL_ATTR_MULTI_STATEMENTS => false
- );
- $pdo = new PDO('mysql:charset=utf8mb4;dbname='.DB_NAME.';host='.DB_HOST , DB_USER, DB_PASS, $option);
-
-} catch(PDOException $e) {
-
- // 接続エラーのときエラー内容を取得する
- $error_message[] = $e->getMessage();
-}
-
-if(isset($_SESSION['admin_login']) && $_SESSION['admin_login'] === true) {
-
- $passQuery = $pdo->prepare("SELECT username,userid,loginid,admin FROM account WHERE userid = :userid");
- $passQuery->bindValue(':userid', $_SESSION['userid']);
- $passQuery->execute();
- $res = $passQuery->fetch();
- if(empty($res["userid"])){
- header("Location: ../login.php");
- exit;
- }elseif($_SESSION['loginid'] === $res["loginid"]){
- // セッションに値をセット
- $userid = $_SESSION['userid']; // セッションに格納されている値をそのままセット
- $username = $_SESSION['username']; // セッションに格納されている値をそのままセット
- $_SESSION['admin_login'] = true;
- $_SESSION['userid'] = $userid;
- $_SESSION['username'] = $username;
- $_SESSION['loginid'] = $res["loginid"];
- setcookie('userid', $userid, time() + 60 * 60 * 24 * 14);
- setcookie('username', $username, time() + 60 * 60 * 24 * 14);
- setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14);
- setcookie('admin_login', true, time() + 60 * 60 * 24 * 14);
- }else{
- header("Location: ../login.php");
- exit;
- }
-
-
-} elseif (isset($_COOKIE['admin_login']) && $_COOKIE['admin_login'] == true) {
-
- $passQuery = $pdo->prepare("SELECT username,userid,loginid,admin FROM account WHERE userid = :userid");
- $passQuery->bindValue(':userid', $_COOKIE['userid']);
- $passQuery->execute();
- $res = $passQuery->fetch();
- if(empty($res["userid"])){
- header("Location: ../login.php");
- exit;
- }elseif($_COOKIE['loginid'] === $res["loginid"]){
- // セッションに値をセット
- $userid = $_COOKIE['userid']; // クッキーから取得した値をセット
- $username = $_COOKIE['username']; // クッキーから取得した値をセット
- $_SESSION['admin_login'] = true;
- $_SESSION['userid'] = $userid;
- $_SESSION['username'] = $username;
- $_SESSION['loginid'] = $res["loginid"];
- setcookie('userid', $userid, time() + 60 * 60 * 24 * 14);
- setcookie('username', $username, time() + 60 * 60 * 24 * 14);
- setcookie('loginid', $res["loginid"], time() + 60 * 60 * 24 * 14);
- setcookie('admin_login', true, time() + 60 * 60 * 24 * 14);
- }else{
- header("Location: ../login.php");
- exit;
- }
-
-
-} else {
- // ログインが許可されていない場合、ログインページにリダイレクト
- header("Location: ../login.php");
- exit;
-}
-if(empty($userid)){
- header("Location: ../login.php");
- exit;
-}
-if(empty($username)){
- header("Location: ../login.php");
- exit;
-}
-
-$ueuseid = str_replace('!', '', $_GET['ueuseid']);
-$touserid = str_replace('~', '', $_GET['touser']);
-
-
-if( !empty($_POST['btn_submit']) ) {
-
- $ueuse = $_POST['ueuse'];
-
- // メッセージの入力チェック
- if( empty($ueuse) ) {
- $error_message[] = '内容を入力してください。';
- } else {
-
- // 文字数を確認
- if( 1024 < mb_strlen($ueuse, 'UTF-8') ) {
- $error_message[] = '内容は1024文字以内で入力してください。';
- }
- }
-
-
- if (empty($_FILES['upload_images']['name'])) {
- $photo1 = "none";
- } else {
- // アップロードされたファイル情報
- $uploadedFile = $_FILES['upload_images'];
-
- // アップロードされたファイルの拡張子を取得
- $extension = pathinfo($uploadedFile['name'], PATHINFO_EXTENSION);
-
- // 新しいファイル名を生成(uniqid + 拡張子)
- $newFilename = uniqid() . '-'.$userid.'.' . $extension;
-
- // 保存先のパスを生成
- $uploadedPath = '../ueuseimages/' . $newFilename;
-
- // ファイルを移動
- $result = move_uploaded_file($uploadedFile['tmp_name'], $uploadedPath);
-
- if ($result) {
- $photo1 = $uploadedPath; // 保存されたファイルのパスを使用
- } else {
- $error_message[] = 'アップロード失敗!(1)エラーコード:' . $uploadedFile['error'].'
'.var_dump($_FILES['upload_images']);
- }
- }
-
- if (empty($_FILES['upload_images2']['name'])) {
- $photo2 = "none";
- } else {
-
- if (empty($_FILES['upload_images']['name'])){
- $error_message[] = '画像1から画像を選択してください!!!';
- }
- // アップロードされたファイル情報
- $uploadedFile2 = $_FILES['upload_images2'];
-
- if( 10000000 < $uploadedFile2["size"] ) {
- $error_message[] = 'ファイルサイズが大きすぎます!';
- }
- // アップロードされたファイルの拡張子を取得
- $extension2 = pathinfo($uploadedFile2['name'], PATHINFO_EXTENSION);
-
- // 新しいファイル名を生成(uniqid + 拡張子)
- $newFilename2 = uniqid() . '-'.$userid.'.' . $extension2;
-
- // 保存先のパスを生成
- $uploadedPath2 = '../ueuseimages/' . $newFilename2;
-
- // ファイルを移動
- $result2 = move_uploaded_file($uploadedFile2['tmp_name'], $uploadedPath2);
-
- if ($result2) {
- $photo2 = $uploadedPath2; // 保存されたファイルのパスを使用
- } else {
- $error_message[] = 'アップロード失敗!(2)エラーコード:' . $uploadedFile2['error'].'
'.var_dump($_FILES['upload_images']);
- }
- }
-
-
- if (empty($_FILES['upload_videos1']['name'])) {
- $video1 = "none";
- } else {
- // アップロードされたファイル情報
- $uploadedFile3 = $_FILES['upload_videos1'];
-
- // アップロードされたファイルの拡張子を取得
- $extension3 = strtolower(pathinfo($uploadedFile3['name'], PATHINFO_EXTENSION)); // 小文字に変換
-
- // サポートされている動画フォーマットの拡張子を配列で定義
- $supportedExtensions = array("mp4", "avi", "mov", "webm");
-
- if (in_array($extension3, $supportedExtensions)) {
- // 正しい拡張子の場合、新しいファイル名を生成
- $newFilename3 = uniqid() . '-'.$userid.'.' . $extension3;
- // 保存先のパスを生成
- $uploadedPath3 = '../ueusevideos/' . $newFilename3;
-
- // ファイルを移動
- $result3 = move_uploaded_file($uploadedFile3['tmp_name'], $uploadedPath3);
-
- if ($result3) {
- $video1 = $uploadedPath3; // 保存されたファイルのパスを使用
- } else {
- $error_message[] = 'アップロード失敗!エラーコード:' . $uploadedFile3['error'];
- }
- } else {
- $error_message[] = '対応していないファイル形式です!';
- }
-
-
- }
-
- if( empty($error_message) ) {
-
- // 書き込み日時を取得
- $datetime = date("Y-m-d H:i:s");
- $uniqid = createUniqId();
- $abi = "none";
-
- // トランザクション開始
- $pdo->beginTransaction();
-
- try {
-
- // SQL作成
- $stmt = $pdo->prepare("INSERT INTO ueuse (username, account, uniqid, rpuniqid, ueuse, photo1, photo2, video1, datetime, abi) VALUES (:username, :account, :uniqid, :rpuniqid, :ueuse, :photo1, :photo2, :video1, :datetime, :abi)");
-
- $stmt->bindParam(':username', $username, PDO::PARAM_STR);
- $stmt->bindParam(':account', $userid, PDO::PARAM_STR);
- $stmt->bindParam(':uniqid', $uniqid, PDO::PARAM_STR);
- $stmt->bindParam(':rpuniqid', $ueuseid, PDO::PARAM_STR);
- $stmt->bindParam(':ueuse', $ueuse, PDO::PARAM_STR);
-
- $stmt->bindParam(':photo1', $photo1, PDO::PARAM_STR);
- $stmt->bindParam(':photo2', $photo2, PDO::PARAM_STR);
- $stmt->bindParam(':video1', $video1, PDO::PARAM_STR);
- $stmt->bindParam(':datetime', $datetime, PDO::PARAM_STR);
-
- $stmt->bindParam(':abi', $abi, PDO::PARAM_STR);
-
- // SQLクエリの実行
- $res = $stmt->execute();
-
- // コミット
- $res = $pdo->commit();
-
- $pdo->beginTransaction();
-
- $msg = ''.$ueuse.'';
- $title = ''.$userid.'さんが返信しました!';
- $url = $_SERVER['REQUEST_URI'];
- $userchk = 'none';
- // 通知用SQL作成
- $stmt = $pdo->prepare("INSERT INTO notification (touserid, msg, url, datetime, userchk, title) VALUES (:touserid, :msg, :url, :datetime, :userchk, :title)");
-
- $stmt->bindParam(':touserid', $touserid, PDO::PARAM_STR);
- $stmt->bindParam(':msg', $msg, PDO::PARAM_STR);
- $stmt->bindParam(':url', $url, PDO::PARAM_STR);
- $stmt->bindParam(':userchk', $userchk, PDO::PARAM_STR);
- $stmt->bindParam(':title', $title, PDO::PARAM_STR);
-
- $stmt->bindParam(':datetime', $datetime, PDO::PARAM_STR);
-
- // SQLクエリの実行
- $res = $stmt->execute();
-
- // コミット
- $res = $pdo->commit();
-
- } catch(Exception $e) {
-
- // エラーが発生した時はロールバック
- $pdo->rollBack();
- }
-
- if( $res ) {
- $url = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
- header("Location:".$url."");
- exit;
- } else {
- $error_message[] = $e->getMessage();
- }
-
- // プリペアドステートメントを削除
- $stmt = null;
- }
-}
-
-if( !empty($_POST['logout']) ) {
- if (isset($_SERVER['HTTP_COOKIE'])) {
- $cookies = explode(';', $_SERVER['HTTP_COOKIE']);
- foreach($cookies as $cookie) {
- $parts = explode('=', $cookie);
- $name = trim($parts[0]);
- setcookie($name, '', time()-1000);
- setcookie($name, '', time()-1000, '/');
- }
- }
- // リダイレクト先のURLへ転送する
- $url = '../index.php';
- header('Location: ' . $url, true, 303);
-
- // すべての出力を終了
- exit;
-}
-
-
-
-// データベースの接続を閉じる
-$pdo = null;
-
-?>
-
-
-
・
- -