Skip to content
This repository has been archived by the owner on Jan 14, 2025. It is now read-only.

Commit

Permalink
update chat stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
Maxhu787 committed May 26, 2023
1 parent c336950 commit ac488b7
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 27 deletions.
16 changes: 6 additions & 10 deletions chat/chat.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php
session_start();
ob_start();
require_once "../head-chat.php";
ini_set('display_errors', 0);
if (!isset($_SESSION["email"])) {
include 'head.php';
Expand Down Expand Up @@ -40,12 +41,7 @@
</div>
<div class="box box-3">
<ul>
<li>server 1</li>
<li>server 1</li>
<li>server 1</li>
<li>server 1</li>
<li>server 1</li>
<li>server 1</li>
<li>general</li>
</ul>
<!-- <p>&copy; <span id="footer-year">2023</span> G4O2 Chat. All rights reserved.</p> -->
</div>
Expand All @@ -57,10 +53,10 @@
<script src="./index.js"></script>
<script>
$('main').hide();
const url = "https://g4o2-api.maxhu787.repl.co";
// const url = "http://localhost:3000";
const chatURL = "https://PHP-SQL-Chat.maxhu787.repl.co";
// const chatURL = "http://localhost/php-sql-chat";
// const url = "https://g4o2-api.maxhu787.repl.co";
const url = "http://localhost:3000";
// const chatURL = "https://PHP-SQL-Chat.maxhu787.repl.co";
const chatURL = "http://localhost/php-sql-chat";
const socket = io(url);
const messages = document.getElementById('messages');
const form = document.getElementById('message-form');
Expand Down
7 changes: 4 additions & 3 deletions chat/css/chat.css
Original file line number Diff line number Diff line change
Expand Up @@ -189,9 +189,10 @@ a:hover {
}

#message-form {
flex: .7;
flex: .6;
display: flex;

min-height: 40px;
max-height: 40px;
flex-direction: row;
}

Expand All @@ -206,7 +207,7 @@ a:hover {
}

#message-form input[type='file'] {
flex: 4;
flex: 2;
}

#message-form button {
Expand Down
48 changes: 48 additions & 0 deletions head-chat.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta charset="utf-8" />
<!-- <meta name="viewport" content="width=device-width, initial-scale=1.0" /> -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />

<meta name="description" content="A chat application made with PHP and SQL">
<meta name="keywords" content="">
<meta name="author" content="Hu Kaixiang">

<meta name="robots" content="index, follow">
<meta name="mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="default">

<!-- <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous"> -->
<!-- <link rel="stylesheet" href="./css/style.css?v=<?php echo time(); ?>"> -->
<!-- <link rel="stylesheet" href="https://kit.fontawesome.com/b60596f9d0.css" crossorigin="anonymous"> -->

<link rel="apple-touch-icon" sizes="180x180" href="../favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="../favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="../favicon/favicon-16x16.png">
<link rel="manifest" href="../favicon/site.webmanifest">
<link rel="mask-icon" href="../favicon/safari-pinned-tab.svg" color="#5bbad5">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="theme-color" content="#ffffff">

<meta property="fb:page_id" content="">
<meta property="og:title" content="g4o2-chat">
<meta property="og:image" content="https://user-images.githubusercontent.com/103299803/196030342-1b944181-2ba5-4c1b-b762-c6e6827cc5cd.PNG">
<meta property="og:description" content="A chat application made with PHP and SQL">
<meta property="og:url" content="https://php-sql-chat.maxhu787.repl.co">
<meta property="og:site_name" content="g4o2-chat">
<meta property="og:type" content="website">

<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="g4o2-chat">
<meta name="twitter:image" content="https://user-images.githubusercontent.com/103299803/196030342-1b944181-2ba5-4c1b-b762-c6e6827cc5cd.PNG">
<meta name="twitter:description" content="A chat application made with PHP and SQL">
<meta name="twitter:url" content="https://php-sql-chat.maxhu787.repl.co/">
<meta name="twitter:site" content="https://php-sql-chat.maxhu787.repl.co/">

<meta name="google" value="notranslate">

<!-- <link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous"> -->
<!-- <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script> -->
<!-- <script src="https://kit.fontawesome.com/b60596f9d0.js" crossorigin="anonymous"></script> -->
<!-- <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.1/jquery.min.js"></script> -->
<!-- <script src="./scripts/main.js"></script> -->
1 change: 1 addition & 0 deletions logs/logs.log
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,4 @@ Login success [email protected] 220.142.231.39 (Fri, 21 Apr 2023 22:58:12 +0800
Login fail wrong password [email protected] 8b7e3e29d811ae8d658113107bb3fb16 209.23.10.215 (Sat, 22 Apr 2023 15:58:08 +0800)
Login success [email protected] 220.142.231.39 (Sat, 22 Apr 2023 18:07:48 +0800)
Login success [email protected] 220.142.231.39 (Sat, 22 Apr 2023 21:18:19 +0800)
Logout success (Fri, 26 May 2023 22:23:13 +0800)
9 changes: 4 additions & 5 deletions pdo.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
session_start();
ob_start();
ini_set('display_errors', 0);

/*
$HOST = 'sql12.freemysqlhosting.net';
$PORT = 3306;
$DB_NAME = 'sql12561191';
Expand All @@ -14,11 +14,11 @@
$DB_PASSWORD
);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
/*
*/

$HOST = 'localhost';
$PORT = 3306;
// $DB_NAME = 'sql12561191';
$DB_NAME = 'g4o2-chat';
$DB_NAME = 'sql12561191';
$DB_USER = 'g4o2';
$DB_PASSWORD = 'g4o2';
$pdo = new PDO(
Expand All @@ -27,4 +27,3 @@
$DB_PASSWORD
);
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
*/
19 changes: 10 additions & 9 deletions signup.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
?>

<head>
<title>Create Account</title>
<title>Sign up</title>
<style>
html,
body {
Expand Down Expand Up @@ -78,6 +78,7 @@
max-width: 330px;
padding: 15px;
margin: 0 auto;
/* text-align: center; */
}

.form-signin .checkbox {
Expand Down Expand Up @@ -110,8 +111,8 @@
</style>
</head>
<form class="form-signin" method="post" action="./signup.php" enctype="multipart/form-data">
<img class="mb-4" src="./favicon.ico" alt="" width="72" height="72">
<h1 class="h3 mb-3 font-weight-normal">Signup</h1>
<img class="mb-4" src="./favicon.ico" alt="" width="72" height="72" style="float: left;">
<h1 class="h3 mb-3 font-weight-normal" style="margin-top: 24px; margin-left: 90px;">Sign up</h1>
<?php
if (isset($_SESSION["error"])) {
echo ('<p class="text-danger">' . htmlentities($_SESSION["error"]) . "</p>");
Expand All @@ -138,13 +139,13 @@
<p class="mt-5 mb-3 text-muted">© <?= date("Y") ?></p>
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 />
</form>

<script src="./particles/particles.js"></script>
<script>
document.getElementById('username').onkeydown = function(e) {
var value = e.target.value;
if (!e.key.match(/[a-zA-Z0-9_]/) || (e.key == '_' && value[value.length - 1] == '_')) {
e.preventDefault();
if (value) {
if (!e.key.match(/[a-zA-Z0-9_]/) || (e.key == '_' && value[value.length - 1] == '_')) {
e.preventDefault();
}
}
};

Expand Down Expand Up @@ -181,7 +182,7 @@ function doValidate() {
return false;
}
setTimeout(function() {
document.querySelector('.popup-msg').style.display = "none";
document.querySelector('.error').style.display = "none";
// document.querySelector('.popup-msg').style.display = "none";
// document.querySelector('.error').style.display = "none";
}, 2200);
</script>

0 comments on commit ac488b7

Please sign in to comment.