Skip to content

Commit ac488b7

Browse files
committed
update chat stuff
1 parent c336950 commit ac488b7

File tree

6 files changed

+73
-27
lines changed

6 files changed

+73
-27
lines changed

chat/chat.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php
22
session_start();
33
ob_start();
4+
require_once "../head-chat.php";
45
ini_set('display_errors', 0);
56
if (!isset($_SESSION["email"])) {
67
include 'head.php';
@@ -40,12 +41,7 @@
4041
</div>
4142
<div class="box box-3">
4243
<ul>
43-
<li>server 1</li>
44-
<li>server 1</li>
45-
<li>server 1</li>
46-
<li>server 1</li>
47-
<li>server 1</li>
48-
<li>server 1</li>
44+
<li>general</li>
4945
</ul>
5046
<!-- <p>&copy; <span id="footer-year">2023</span> G4O2 Chat. All rights reserved.</p> -->
5147
</div>
@@ -57,10 +53,10 @@
5753
<script src="./index.js"></script>
5854
<script>
5955
$('main').hide();
60-
const url = "https://g4o2-api.maxhu787.repl.co";
61-
// const url = "http://localhost:3000";
62-
const chatURL = "https://PHP-SQL-Chat.maxhu787.repl.co";
63-
// const chatURL = "http://localhost/php-sql-chat";
56+
// const url = "https://g4o2-api.maxhu787.repl.co";
57+
const url = "http://localhost:3000";
58+
// const chatURL = "https://PHP-SQL-Chat.maxhu787.repl.co";
59+
const chatURL = "http://localhost/php-sql-chat";
6460
const socket = io(url);
6561
const messages = document.getElementById('messages');
6662
const form = document.getElementById('message-form');

chat/css/chat.css

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,10 @@ a:hover {
189189
}
190190

191191
#message-form {
192-
flex: .7;
192+
flex: .6;
193193
display: flex;
194-
194+
min-height: 40px;
195+
max-height: 40px;
195196
flex-direction: row;
196197
}
197198

@@ -206,7 +207,7 @@ a:hover {
206207
}
207208

208209
#message-form input[type='file'] {
209-
flex: 4;
210+
flex: 2;
210211
}
211212

212213
#message-form button {

head-chat.php

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
2+
<meta charset="utf-8" />
3+
<!-- <meta name="viewport" content="width=device-width, initial-scale=1.0" /> -->
4+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
5+
6+
<meta name="description" content="A chat application made with PHP and SQL">
7+
<meta name="keywords" content="">
8+
<meta name="author" content="Hu Kaixiang">
9+
10+
<meta name="robots" content="index, follow">
11+
<meta name="mobile-web-app-capable" content="yes">
12+
<meta name="apple-mobile-web-app-capable" content="yes">
13+
<meta name="apple-mobile-web-app-status-bar-style" content="default">
14+
15+
<!-- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous"> -->
16+
<!-- <link rel="stylesheet" href="./css/style.css?v=<?php echo time(); ?>"> -->
17+
<!-- <link rel="stylesheet" href="https://kit.fontawesome.com/b60596f9d0.css" crossorigin="anonymous"> -->
18+
19+
<link rel="apple-touch-icon" sizes="180x180" href="../favicon/apple-touch-icon.png">
20+
<link rel="icon" type="image/png" sizes="32x32" href="../favicon/favicon-32x32.png">
21+
<link rel="icon" type="image/png" sizes="16x16" href="../favicon/favicon-16x16.png">
22+
<link rel="manifest" href="../favicon/site.webmanifest">
23+
<link rel="mask-icon" href="../favicon/safari-pinned-tab.svg" color="#5bbad5">
24+
<meta name="msapplication-TileColor" content="#da532c">
25+
<meta name="theme-color" content="#ffffff">
26+
27+
<meta property="fb:page_id" content="">
28+
<meta property="og:title" content="g4o2-chat">
29+
<meta property="og:image" content="https://user-images.githubusercontent.com/103299803/196030342-1b944181-2ba5-4c1b-b762-c6e6827cc5cd.PNG">
30+
<meta property="og:description" content="A chat application made with PHP and SQL">
31+
<meta property="og:url" content="https://php-sql-chat.maxhu787.repl.co">
32+
<meta property="og:site_name" content="g4o2-chat">
33+
<meta property="og:type" content="website">
34+
35+
<meta name="twitter:card" content="summary">
36+
<meta name="twitter:title" content="g4o2-chat">
37+
<meta name="twitter:image" content="https://user-images.githubusercontent.com/103299803/196030342-1b944181-2ba5-4c1b-b762-c6e6827cc5cd.PNG">
38+
<meta name="twitter:description" content="A chat application made with PHP and SQL">
39+
<meta name="twitter:url" content="https://php-sql-chat.maxhu787.repl.co/">
40+
<meta name="twitter:site" content="https://php-sql-chat.maxhu787.repl.co/">
41+
42+
<meta name="google" value="notranslate">
43+
44+
<!-- <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous"> -->
45+
<!-- <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script> -->
46+
<!-- <script src="https://kit.fontawesome.com/b60596f9d0.js" crossorigin="anonymous"></script> -->
47+
<!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script> -->
48+
<!-- <script src="./scripts/main.js"></script> -->

logs/logs.log

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,3 +200,4 @@ Login success maxhu787@gmail.com 220.142.231.39 (Fri, 21 Apr 2023 22:58:12 +0800
200200
Login fail wrong password fff@fff.com 8b7e3e29d811ae8d658113107bb3fb16 209.23.10.215 (Sat, 22 Apr 2023 15:58:08 +0800)
201201
Login success maxhu787@gmail.com 220.142.231.39 (Sat, 22 Apr 2023 18:07:48 +0800)
202202
Login success maxhu787@gmail.com 220.142.231.39 (Sat, 22 Apr 2023 21:18:19 +0800)
203+
Logout success (Fri, 26 May 2023 22:23:13 +0800)

pdo.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
session_start();
33
ob_start();
44
ini_set('display_errors', 0);
5-
5+
/*
66
$HOST = 'sql12.freemysqlhosting.net';
77
$PORT = 3306;
88
$DB_NAME = 'sql12561191';
@@ -14,11 +14,11 @@
1414
$DB_PASSWORD
1515
);
1616
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
17-
/*
17+
*/
18+
1819
$HOST = 'localhost';
1920
$PORT = 3306;
20-
// $DB_NAME = 'sql12561191';
21-
$DB_NAME = 'g4o2-chat';
21+
$DB_NAME = 'sql12561191';
2222
$DB_USER = 'g4o2';
2323
$DB_PASSWORD = 'g4o2';
2424
$pdo = new PDO(
@@ -27,4 +27,3 @@
2727
$DB_PASSWORD
2828
);
2929
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
30-
*/

signup.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050
?>
5151

5252
<head>
53-
<title>Create Account</title>
53+
<title>Sign up</title>
5454
<style>
5555
html,
5656
body {
@@ -78,6 +78,7 @@
7878
max-width: 330px;
7979
padding: 15px;
8080
margin: 0 auto;
81+
/* text-align: center; */
8182
}
8283

8384
.form-signin .checkbox {
@@ -110,8 +111,8 @@
110111
</style>
111112
</head>
112113
<form class="form-signin" method="post" action="./signup.php" enctype="multipart/form-data">
113-
<img class="mb-4" src="./favicon.ico" alt="" width="72" height="72">
114-
<h1 class="h3 mb-3 font-weight-normal">Signup</h1>
114+
<img class="mb-4" src="./favicon.ico" alt="" width="72" height="72" style="float: left;">
115+
<h1 class="h3 mb-3 font-weight-normal" style="margin-top: 24px; margin-left: 90px;">Sign up</h1>
115116
<?php
116117
if (isset($_SESSION["error"])) {
117118
echo ('<p class="text-danger">' . htmlentities($_SESSION["error"]) . "</p>");
@@ -138,13 +139,13 @@
138139
<p class="mt-5 mb-3 text-muted">© <?= date("Y") ?></p>
139140
By registering, you agree to our <a href="./terms-of-service.php" target="_blank">Terms</a>, <a href="./privacy-policy.php" target="_blank">Privacy Policy</a> and <a href="./cookie-policy.php" target="_blank">Cookie Policy</a>.<br />
140141
</form>
141-
142-
<script src="./particles/particles.js"></script>
143142
<script>
144143
document.getElementById('username').onkeydown = function(e) {
145144
var value = e.target.value;
146-
if (!e.key.match(/[a-zA-Z0-9_]/) || (e.key == '_' && value[value.length - 1] == '_')) {
147-
e.preventDefault();
145+
if (value) {
146+
if (!e.key.match(/[a-zA-Z0-9_]/) || (e.key == '_' && value[value.length - 1] == '_')) {
147+
e.preventDefault();
148+
}
148149
}
149150
};
150151

@@ -181,7 +182,7 @@ function doValidate() {
181182
return false;
182183
}
183184
setTimeout(function() {
184-
document.querySelector('.popup-msg').style.display = "none";
185-
document.querySelector('.error').style.display = "none";
185+
// document.querySelector('.popup-msg').style.display = "none";
186+
// document.querySelector('.error').style.display = "none";
186187
}, 2200);
187188
</script>

0 commit comments

Comments
 (0)