Skip to content

Commit c336950

Browse files
committed
fixed some tags in policies remove padding index
1 parent 5a3b1a7 commit c336950

File tree

7 files changed

+67
-259
lines changed

7 files changed

+67
-259
lines changed

chat.php

Lines changed: 1 addition & 197 deletions
Original file line numberDiff line numberDiff line change
@@ -1,199 +1,3 @@
11
<?php
22
header("Location: ./chat/chat.php");
3-
4-
require_once "pdo.php";
5-
// date_default_timezone_set('UTC');
6-
date_default_timezone_set('Asia/Taipei');
7-
8-
if (!isset($_SESSION["email"])) {
9-
include 'head.php';
10-
echo "<p align='center'>PLEASE LOGIN</p>";
11-
echo "<br />";
12-
echo "<p align='center'>Redirecting in 3 seconds</p>";
13-
header("refresh:3;url=login.php");
14-
die();
15-
}
16-
17-
$stmt = $pdo->query(
18-
"SELECT * FROM chatlog"
19-
);
20-
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
21-
22-
23-
if (isset($_POST['logout'])) {
24-
header("Location: logout.php");
25-
return;
26-
}
27-
28-
if (isset($_SESSION['user_id'])) {
29-
if (isset($_POST['message'])) {
30-
$stmta = $pdo->prepare(
31-
'INSERT INTO chatlog
32-
(message, message_date, account, user_id)
33-
VALUES (:msg, :msgd, :acc, :usrid)'
34-
);
35-
36-
$stmta->execute(
37-
array(
38-
':msg' => $_POST['message'],
39-
':msgd' => date(DATE_RFC2822),
40-
':acc' => $_SESSION['username'],
41-
':usrid' => $_SESSION['user_id']
42-
)
43-
);
44-
$stmt = $pdo->query(
45-
"SELECT * FROM chatlog"
46-
);
47-
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
48-
} else {
49-
foreach ($_POST as $edit_msg) {
50-
$key = array_search($edit_msg, $_POST);
51-
52-
53-
$sql = "UPDATE chatlog SET message = :msg
54-
WHERE message_id = :message_id";
55-
$stmt = $pdo->prepare($sql);
56-
$stmt->execute(array(
57-
':msg' => $edit_msg,
58-
':message_id' => $key
59-
));
60-
61-
break;
62-
}
63-
}
64-
}
65-
?>
66-
<html>
67-
<title>g4o2 chat</title>
68-
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, minimum-scale=1.0">
69-
<link rel="stylesheet" href="./css/chat.css?v=<?php echo time(); ?>">
70-
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script>
71-
</head>
72-
73-
<body>
74-
<section id="page-header">
75-
<h1 id="index-page-link"><a href="./index.php">g4o2&nbsp;chat</a></h1>
76-
<section style="overflow: auto;" id="guide">
77-
<p>Press <kbd>Enter</kbd> to submit message</p>
78-
<p>Press <kbd>/</kbd> to select <kbd>Esc</kbd> to deselect</p>
79-
</section>
80-
</section>
81-
<section>
82-
<div class="progress" id="chatcontent">
83-
<!-- <img class="spinner" src="spinner.gif" alt="Loading..." /> -->
84-
<p style='text-align:center;color: #ffa500;'>This is the start of all messages</p>
85-
<?php
86-
require_once "messages.php";
87-
?>
88-
</div>
89-
<form id='form' autocomplete="off" method="post" action="chat.php">
90-
<div>
91-
<input id='message-input' type="text" name="message" size="60" style="width: 55vw;" placeholder="Enter message and submit" />
92-
<input class='button not-allowed' id="submit" type="submit" value="Chat" />
93-
<input class='button' id='logout' type="submit" name="logout" value="Logout" />
94-
</div>
95-
</form>
96-
</section>
97-
<script type="text/javascript">
98-
function handleEdit(id) {
99-
let parent_id = id + "parent";
100-
let input_id = id + "input";
101-
let message = document.getElementById(id).innerText;
102-
document.getElementById(parent_id).innerHTML = `<form method='post'><input class='edit-input' id='${input_id}' type='text' style='width:90%' name=${id}> <input class='btn chat-btn' type='submit' value='Save'></form>`;
103-
document.getElementById(input_id).value = message;
104-
}
105-
106-
let input = document.getElementById('message-input');
107-
input.focus();
108-
input.select();
109-
let pageBody = document.getElementsByTagName('body')[0];
110-
111-
$("#submit").prop("disabled", true);
112-
$(input).keyup(function() {
113-
if (!$(input).val().replace(/\s/g, '').length) {
114-
$("#submit").prop("disabled", true);
115-
$('#submit').addClass("not-allowed")
116-
} else {
117-
$("#submit").prop("disabled", false);
118-
$('#submit').removeClass("not-allowed");
119-
}
120-
});
121-
window.addEventListener("keydown", event => {
122-
if ((event.keyCode == 191)) {
123-
if (input === document.activeElement) {
124-
return;
125-
} else {
126-
input.focus();
127-
input.select();
128-
event.preventDefault();
129-
}
130-
}
131-
if ((event.keyCode == 27)) {
132-
if (input === document.activeElement) {
133-
document.activeElement.blur();
134-
window.focus();
135-
event.preventDefault();
136-
}
137-
}
138-
});
139-
$(document).ready(function() {
140-
setTimeout(
141-
function() {
142-
$("#chatcontent").removeClass("progress");
143-
}, 1000);
144-
})
145-
146-
function chatScroll() {
147-
let chat = document.getElementById('chatcontent')
148-
chat.scrollTop = chat.scrollHeight;
149-
}
150-
chatScroll()
151-
152-
if (window.history.replaceState) {
153-
window.history.replaceState(null, null, window.location.href);
154-
}
155-
156-
var timezone_offset_minutes = new Date().getTimezoneOffset();
157-
timezone_offset_minutes = timezone_offset_minutes == 0 ? 0 : -timezone_offset_minutes;
158-
159-
document.cookie = "timezone=" + timezone_offset_minutes;
160-
161-
/*let inverval = window.setInterval(function() {
162-
$.ajax({
163-
url: "messages.php",
164-
success: function(data) {
165-
document.getElementById("chatcontent").innerHTML = data
166-
}
167-
});
168-
let chat = document.getElementById("chatcontent")
169-
if (chat.scrollTop >= (chat.scrollHeight - chat.offsetHeight) - 100) {
170-
chatScroll()
171-
}
172-
}, 1000)*/
173-
/*
174-
let inverval = window.setInterval(function() {
175-
$.ajax({
176-
url: "msglength.php",
177-
success: function(data) {
178-
let chat = document.getElementById("chatcontent");
179-
let chatLength = (chat.childElementCount - 1) / 2;
180-
181-
if (data != chatLength) {
182-
$.ajax({
183-
url: "messages.php",
184-
success: function(data) {
185-
document.getElementById("chatcontent").innerHTML = data;
186-
let chat = document.getElementById("chatcontent")
187-
if (chat.scrollTop >= (chat.scrollHeight - chat.offsetHeight) - 100) {
188-
chatScroll()
189-
}
190-
console.log('chat updated')
191-
}
192-
});
193-
}
194-
}
195-
});
196-
}, 1000)
197-
*/
198-
</script>
199-
</body>
3+
?>

chat/chat.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,10 +96,11 @@ function waitUntilTrue(variable, callback) {
9696
$("#copy-right").hide();
9797
$('main').show(1000);
9898
$('body').css({
99-
'background': 'url(../assets/backgrounds/burj-khalifa.jpg)',
100-
'background-repeat': 'no-repeat',
101-
'background-attachment': 'fixed',
102-
'background-size': '100% 100%'
99+
'background-color': 'rgba(41, 41, 41)',
100+
// 'background': 'url(../assets/backgrounds/burj-khalifa.jpg)',
101+
// 'background-repeat': 'no-repeat',
102+
// 'background-attachment': 'fixed',
103+
// 'background-size': '100% 100%'
103104
});
104105
// $('body').css({
105106
// 'background': 'radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%)'

chat/css/chat.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ a:hover {
7070
/* min-width: 200px; */
7171
overflow-y: auto;
7272
overflow-x: hidden;
73+
/* overflow-x: auto; */
7374
text-overflow: ellipsis;
75+
/* resize: horizontal; */
7476
}
7577

7678
.box-2 {

cookie-policy.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@
156156
</head>
157157

158158
<body style="margin-left: 30px;">
159+
<h2>Cookie Policy</h2>
159160
<p>We use Cookies and similar tracking technologies to track the activity on Our Service and store certain
160161
information. Tracking technologies used are beacons, tags, and scripts to collect and track information and to
161162
improve and analyze Our Service. The technologies We use may include:</p>

index.php

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -129,40 +129,40 @@
129129
$('iframe').fadeIn(1000);
130130
});
131131
</script>
132-
<div class="w-75 p-2" style="background-color: #eee;margin: auto;">
133-
<main class="table-responsive">
132+
<div class="w-100" style="background-color: #eee;margin: auto;">
133+
<main class="table-responsive">
134+
<?php
135+
if (isset($_SESSION["error"])) {
136+
echo ('<p class="text-danger">' . htmlentities($_SESSION["error"]) . "</p>");
137+
unset($_SESSION["error"]);
138+
}
139+
if (isset($_SESSION["success"])) {
140+
echo ('<p class="text-success">' . htmlentities($_SESSION["success"]) . "</p>");
141+
unset($_SESSION["success"]);
142+
}
143+
144+
if (isset($_SESSION['user_id'])) {
145+
echo '<p>User ID >> ' . $_SESSION['user_id'] . "</p>";
146+
} else {
147+
echo '<p>Please <a class="btn btn-outline-success" href="./login.php">Login</a></p>';
148+
}
149+
echo '<a href="https://github.com/g4o2/PHP-SQL-Chat" target="_blank"><img src="https://github-readme-stats.vercel.app/api/pin/?username=g4o2&repo=PHP-SQL-Chat" alt="github repo"></a>';
150+
echo '<a href="https://github.com/g4o2/g4o2-api" target="_blank"><img src="https://github-readme-stats.vercel.app/api/pin/?username=g4o2&repo=g4o2-api" alt="github repo"></a><hr/>';
151+
?>
152+
<div class="img-container">
153+
<img src='./assets/images/showcase/demo-2.PNG' />
154+
<img src='./assets/images/showcase/demo-3.PNG' />
155+
<img src='./assets/images/showcase/demo-2.PNG' />
156+
<img src='./assets/images/showcase/demo-1.PNG' />
157+
</div>
158+
</main>
134159
<?php
135-
if (isset($_SESSION["error"])) {
136-
echo ('<p class="text-danger">' . htmlentities($_SESSION["error"]) . "</p>");
137-
unset($_SESSION["error"]);
138-
}
139-
if (isset($_SESSION["success"])) {
140-
echo ('<p class="text-success">' . htmlentities($_SESSION["success"]) . "</p>");
141-
unset($_SESSION["success"]);
142-
}
143-
144160
if (isset($_SESSION['user_id'])) {
145-
echo '<p>User ID >> ' . $_SESSION['user_id'] . "</p>";
161+
// echo '<script> sessionStorage.setItem("user_id", "' . $_SESSION['user_id'] . '");</script>';
146162
} else {
147-
echo '<p>Please <a class="btn btn-outline-success" href="./login.php">Login</a></p>';
163+
// echo '<script> sessionStorage.removeItem("user_id"); </script>';
148164
}
149-
echo '<a href="https://github.com/g4o2/PHP-SQL-Chat" target="_blank"><img src="https://github-readme-stats.vercel.app/api/pin/?username=g4o2&repo=PHP-SQL-Chat" alt="github repo"></a>';
150-
echo '<a href="https://github.com/g4o2/g4o2-api" target="_blank"><img src="https://github-readme-stats.vercel.app/api/pin/?username=g4o2&repo=g4o2-api" alt="github repo"></a><hr/>';
151165
?>
152-
<div class="img-container">
153-
<img src='./assets/images/showcase/demo-2.PNG' />
154-
<img src='./assets/images/showcase/demo-3.PNG' />
155-
<img src='./assets/images/showcase/demo-2.PNG' />
156-
<img src='./assets/images/showcase/demo-1.PNG' />
157-
</div>
158-
</main>
159-
<?php
160-
if(isset($_SESSION['user_id'])) {
161-
// echo '<script> sessionStorage.setItem("user_id", "' . $_SESSION['user_id'] . '");</script>';
162-
} else {
163-
// echo '<script> sessionStorage.removeItem("user_id"); </script>';
164-
}
165-
?>
166166
</div>
167167
<footer class="text-center text-lg-start bg-light text-muted">
168168
<section class="d-flex justify-content-center justify-content-lg-between p-4 border-bottom">
@@ -239,9 +239,9 @@
239239
<div class="col-md-4 col-lg-3 col-xl-3 mx-auto mb-md-0 mb-4">
240240
<h6 class="text-uppercase fw-bold mb-4">Contact</h6>
241241
<!-- <p><i class="fas fa-home me-3"></i> New York, NY 10012, US</p> -->
242-
<p><i class="fas fa-envelope me-3"></i>Maxhu787@gmail.com</p>
243-
<p><i class="fas fa-envelope me-3"></i>[email protected]</p>
244-
<p><i class="fas fa-envelope me-3"></i>[email protected]</p>
242+
<p><i class="fas fa-envelope me-3"></i><a href="mailto:maxhu787@gmail.com">[email protected]</a></p>
243+
<p><i class="fas fa-envelope me-3"></i><a href="mailto:[email protected]">[email protected]</a></p>
244+
<p><i class="fas fa-envelope me-3"></i><a href="mailto:[email protected]">[email protected]</a></p>
245245
<p><i class="fas fa-print me-3"></i> + 01 234 567 89</p>
246246
</div>
247247
</div>

0 commit comments

Comments
 (0)