-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsendChat.php
34 lines (28 loc) · 895 Bytes
/
sendChat.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$query = "SELECT * FROM chat";
$result = mysqli_query($con, $query);
$cred = "SELECT * FROM userNames";
$credChat = mysqli_query($con, $cred);
$theName = $_GET['name'];
$thePass = $_GET['pass'];
$theMessage = $_GET['message'];
$test = false;
while ($rows = mysqli_fetch_assoc($credChat)) {
if ($theName == $rows['user']) {
while ($row = mysqli_fetch_assoc($credChat)) {
if ($thePass == $row['password']) {
$sql = "INSERT INTO 'dj239'.'chat' (username, message)
VALUES ($theName, $theMessage)";
mysqli_query($con, $sql);
$test = true;
}
}
}
}
if ($test == FALSE) {
echo "Data was not sent, check login details";
}
?>