Skip to content

Commit ce618d8

Browse files
committed
update
1 parent 1c1971f commit ce618d8

File tree

5 files changed

+33
-33
lines changed

5 files changed

+33
-33
lines changed

new-g4o2-chat/account-settings.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,11 @@
9090
$stmt->execute(array(
9191
':pfp' => $base64,
9292
':usrid' => $_SESSION['user_id'],
93-
':newUsername' => str_replace('<', ' ¯\_(ツ)_/¯ ', $_POST['username']),
94-
':newName' => str_replace('<', ' ¯\_(ツ)_/¯ ', $_POST['name']),
95-
':email' => str_replace('<', ' ¯\_(ツ)_/¯ ', $_POST['email']),
93+
':newUsername' => $_POST['username'],
94+
':newName' => $_POST['name'],
95+
':email' => $_POST['email'],
9696
':password' => $hash,
97-
':about' => str_replace('<', ' ¯\_(ツ)_/¯ ', $_POST['about']),
97+
':about' => $_POST['about'],
9898
':showEmail' => $show_email
9999
));
100100
$_SESSION['success'] = 'Account details updated.';
@@ -177,13 +177,13 @@
177177
Select image to upload for <?= $_SESSION['username'] ?>
178178
<input type="file" name="fileToUpload" id="fileToUpload">
179179
<label for="name" class="sr-only">Username</label>
180-
<input type="text" name="username" class="form-control" placeholder="" required="" autofocus="" value="<?= $response['username'] ?>">
180+
<input type="text" name="username" class="form-control" placeholder="" required="" autofocus="" value="<?= htmlentities($response['username']) ?>">
181181
<label for="name" class="sr-only">Name</label>
182-
<input type="text" name="name" class="form-control" placeholder="" required="" autofocus="" value="<?= $response['name'] ?>">
182+
<input type="text" name="name" class="form-control" placeholder="" required="" autofocus="" value="<?= htmlentities($response['name']) ?>">
183183
<label for="email" class="sr-only">Email</label>
184-
<input type="email" name="email" class="form-control" placeholder="" required="" value="<?= $response['email'] ?>">
184+
<input type="email" name="email" class="form-control" placeholder="" required="" value="<?= htmlentities($response['email']) ?>">
185185
<label for="about" class="sr-only">About</label>
186-
<input type="text" name="about" class="form-control" placeholder="" required="" value="<?= $response['about'] ?>">
186+
<input type="text" name="about" class="form-control" placeholder="" required="" value="<?= htmlentities($response['about']) ?>">
187187
<label for="password" class="sr-only">New Password</label>
188188
<input type="password" name="password" class="form-control" placeholder="Password" required="">
189189
<div class="checkbox mb-3">

new-g4o2-chat/head.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414

1515
<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">
1616
<link rel="stylesheet" href="./css/style.css?v=<?php echo time(); ?>">
17-
<!-- <link rel="stylesheet" href="https://kit.fontawesome.com/b60596f9d0.css" crossorigin="anonymous"> -->
17+
<link rel="stylesheet" href="https://kit.fontawesome.com/b60596f9d0.css" crossorigin="anonymous">
1818

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

new-g4o2-chat/index.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
$pfpsrc = $pfpsrc_default;
116116
}
117117

118-
$pfp = "<a class='pfp-link' href='./profile.php?user={$account[' user_id']}'><img style='border-radius: 100px; margin-left: 10px; ' height='20px' width='20px' src='$pfpsrc'></a>";
118+
$pfp = "<a class='pfp-link' href='./profile.php?id={$account['user_id']}'><img style='border-radius: 100px; margin-left: 10px; ' height='20px' width='20px' src='$pfpsrc'></a>";
119119

120120
$statement = $pdo->prepare("SELECT * FROM user_status_log where user_Id = :usr");
121121
$statement->execute(array(':usr' => $account['user_id']));
@@ -153,11 +153,11 @@
153153
echo ($account['user_id']);
154154
echo $pfp;
155155
echo ("</th><td>");
156-
echo "<a href='./profile.php?user={$account['user_id']}'>" . $account['username'] . "</a>";
156+
echo "<a href='./profile.php?id={$account['user_id']}'>" . htmlentities($account['username']) . "</a>";
157157
echo "</td><td>";
158-
echo "<p>" . $account['name'] . "</p>";
158+
echo "<p>".htmlentities($account['name']) . "</p>";
159159
echo "</td><td>";
160-
echo ($account['show_email'] === "True") ? "<p class=''>" . $account['email'] . "</p>" : "<p class='text-warning'>Hidden</p>";
160+
echo ($account['show_email'] === "True") ? "<p class=''>" . htmlentities($account['email']) . "</p>" : "<p class='text-warning'>Hidden</p>";
161161
echo ("</td><td>");
162162
echo $diff;
163163
echo ("</td></tr>\n");

new-g4o2-chat/pdo.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,27 @@
33
ob_start();
44
ini_set('display_errors', 0);
55

6-
// $HOST = 'sql12.freemysqlhosting.net';
7-
// $PORT = 3306;
8-
// $DB_NAME = 'sql12561191';
9-
// $DB_USER = 'sql12561191';
10-
// $DB_PASSWORD = getenv('DB_PASSWORD');
11-
// $pdo = new PDO(
12-
// "mysql:host=$HOST;port=$PORT;dbname=$DB_NAME",
13-
// $DB_USER,
14-
// $DB_PASSWORD
15-
// );
16-
// $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
17-
18-
19-
$HOST = 'localhost';
6+
$HOST = 'sql12.freemysqlhosting.net';
207
$PORT = 3306;
21-
$DB_NAME = 'g4o2-chat';
22-
$DB_USER = 'g4o2';
23-
$DB_PASSWORD = 'g4o2';
8+
$DB_NAME = 'sql12561191';
9+
$DB_USER = 'sql12561191';
10+
$DB_PASSWORD = getenv('DB_PASSWORD');
2411
$pdo = new PDO(
2512
"mysql:host=$HOST;port=$PORT;dbname=$DB_NAME",
2613
$DB_USER,
2714
$DB_PASSWORD
2815
);
2916
$pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
17+
18+
19+
// $HOST = 'localhost';
20+
// $PORT = 3306;
21+
// $DB_NAME = 'g4o2-chat';
22+
// $DB_USER = 'g4o2';
23+
// $DB_PASSWORD = 'g4o2';
24+
// $pdo = new PDO(
25+
// "mysql:host=$HOST;port=$PORT;dbname=$DB_NAME",
26+
// $DB_USER,
27+
// $DB_PASSWORD
28+
// );
29+
// $pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);

new-g4o2-chat/profile.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@
4343
<div class="card" style="width: 18rem;margin: auto;">
4444
<img src="<?= $pfp ?>" height="280px" class="card-img-top" alt="User profile picture">
4545
<div class="card-body">
46-
<h5 class="card-title"><?= $username ?></h5>
47-
<p class="card-text"><?=$name?></p>
46+
<h5 class="card-title"><?= htmlentities($username) ?></h5>
47+
<p class="card-text"><?= htmlentities($name)?></p>
4848
</div>
4949
<ul class="list-group list-group-flush">
5050
<li class="list-group-item"><?= htmlentities($about)?></li>

0 commit comments

Comments
 (0)