Professional Documents
Culture Documents
Hacked by Mom
Hacked by Mom
php
session_start();
// Database configuration
$servername = "localhost";
$username = "your_mysql_user";
$password = "your_mysql_password";
$dbname = "your_database_name";
// Signup functionality
if (isset($_POST['signup'])) {
$username = $_POST['username'];
$password = $_POST['password'];
// Login functionality
if (isset($_POST['login'])) {
$username = $_POST['username'];
$password = $_POST['password'];
// Chat functionality
if (isset($_POST['send']) && isset($_SESSION['username'])) {
$message = $_POST['message'];
$username = $_SESSION['username'];
?>
<!DOCTYPE html>
<html>
<head>
<title>Hacker Chat</title>
<style>
body {
background-color: #000;
color: #0F0;
font-family: monospace;
}
#chatbox {
width: 600px;
height: 400px;
background-color: #111;
padding: 10px;
overflow-y: scroll;
}
#inputArea {
display: flex;
margin-top: 10px;
}
#messageInput {
flex: 1;
background-color: #222;
border: none;
color: #0F0;
padding: 5px;
}
#sendButton {
background-color: #333;
color: #0F0;
border: none;
padding: 5px 10px;
cursor: pointer;
}
#loginArea {
margin-top: 20px;
}
#usernameInput,
#passwordInput {
background-color: #222;
border: none;
color: #0F0;
padding: 5px;
margin-right: 10px;
}
#loginButton,
#signupButton {
background-color: #333;
color: #0F0;
border: none;
padding: 5px 10px;
cursor: pointer;
}
</style>
</head>
<body>
<h1>Welcome to Hacker Chat</h1>
<div id="loginArea">
<form method="post" action="">
<input type="text" name="username" placeholder="Username"
required />
<input type="password" name="password" placeholder="Password"
required />
<button type="submit" name="login" id="loginButton">Login</button>
<button type="submit" name="signup" id="signupButton">Sign
Up</button>
</form>
</div>
<div id="chatbox">
<?php while ($row = $result->fetch_assoc()) : ?>
<p>[<?php echo $row['timestamp']; ?>] <?php echo
$row['username']; ?>: <?php echo $row['message']; ?></p>
<?php endwhile; ?>
</div>
<div id="inputArea">
<form method="post" action="">
<input type="text" name="message" id="messageInput"
placeholder="Type your message" required />
<button type="submit" name="send" id="sendButton">Send</button>
</form>
</div>
</body>
</html>
<?php
$conn->close();
?>
<?php
session_start();
// Database configuration
$servername = "localhost";
$username = "your_mysql_user";
$password = "your_mysql_password";
$dbname = "your_database_name";
// Signup functionality
if (isset($_POST['signup'])) {
$username = $_POST['username'];
$password = $_POST['password'];
// Login functionality
if (isset($_POST['login'])) {
$username = $_POST['username'];
$password = $_POST['password'];
// Chat functionality
if (isset($_POST['send']) && isset($_SESSION['username'])) {
$message = $_POST['message'];
$username = $_SESSION['username'];
?>
<!DOCTYPE html>
<html>
<head>
<title>Hacker Chat</title>
<style>
body {
background-color: #000;
color: #0F0;
font-family: monospace;
}
#chatbox {
width: 600px;
height: 400px;
background-color: #111;
padding: 10px;
overflow-y: scroll;
}
#inputArea {
display: flex;
margin-top: 10px;
}
#messageInput {
flex: 1;
background-color: #222;
border: none;
color: #0F0;
padding: 5px;
}
#sendButton {
background-color: #333;
color: #0F0;
border: none;
padding: 5px 10px;
cursor: pointer;
}
#loginArea {
margin-top: 20px;
}
#usernameInput,
#passwordInput {
background-color: #222;
border: none;
color: #0F0;
padding: 5px;
margin-right: 10px;
}
#loginButton,
#signupButton {
background-color: #333;
color: #0F0;
border: none;
padding: 5px 10px;
cursor: pointer;
}
</style>
</head>
<body>
<h1>Welcome to Hacker Chat</h1>
<div id="loginArea">
<form method="post" action="">
<input type="text" name="username" placeholder="Username"
required />
<input type="password" name="password" placeholder="Password"
required />
<button type="submit" name="login" id="loginButton">Login</button>
<button type="submit" name="signup" id="signupButton">Sign
Up</button>
</form>
</div>
<div id="chatbox">
<?php while ($row = $result->fetch_assoc()) : ?>
<p>[<?php echo $row['timestamp']; ?>] <?php echo
$row['username']; ?>: <?php echo $row['message']; ?></p>
<?php endwhile; ?>
</div>
<div id="inputArea">
<form method="post" action="">
<input type="text" name="message" id="messageInput"
placeholder="Type your message" required />
<button type="submit" name="send" id="sendButton">Send</button>
</form>
</div>
</body>
</html>
<?php
$conn->close();
?>