Minor fixes and closing DB connections as needed
This commit is contained in:
@@ -24,4 +24,6 @@ $result = mysqli_query($conn, $sql);
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?php
|
||||
$db_connection = null;
|
||||
?>
|
||||
|
||||
@@ -54,11 +54,13 @@
|
||||
$db_connection->query($sql_statement);
|
||||
$sql_statement = "INSERT INTO friendList VALUES ('".$_SESSION["loggedInUser"]."', '".$_POST['friend']."', true)";
|
||||
$db_connection->query($sql_statement);
|
||||
echo "Friend request confirmed! You are both friends with each other now.";
|
||||
}
|
||||
else
|
||||
{
|
||||
$sql_statement = "INSERT INTO friendList VALUES ('".$_SESSION["loggedInUser"]."', '".$_POST['friend']."', false)";
|
||||
$db_connection->query($sql_statement);
|
||||
echo "Friend request sent to $_POST[\'friend\']";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
<?php
|
||||
phpinfo();
|
||||
?>
|
||||
@@ -13,25 +13,19 @@
|
||||
<body>
|
||||
<!--#include virtual="header.html" -->
|
||||
<!--#include virtual="topNavBar.html" -->
|
||||
<style>
|
||||
body {
|
||||
background-color: #3B5998;
|
||||
}
|
||||
</style>
|
||||
|
||||
<?php
|
||||
echo "<br>";
|
||||
try{
|
||||
$query = "INSERT INTO messages (sender, recipient, message, date, haveread) VALUES ('".$_SESSION["loggedInUser"]."', '".$_POST["name"]."', '".$_POST["message"]."', NOW(), 'N')";
|
||||
$db_connection->query($query);
|
||||
|
||||
print("Message Has been sent");
|
||||
}
|
||||
catch(Exception $e){
|
||||
echo "Exception: ".$e->getMessage().PHP_EOL;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
$db_connection = null;
|
||||
?>
|
||||
|
||||
@@ -19,6 +19,8 @@ foreach($db_connection->query($query) as $row){
|
||||
}
|
||||
echo '</pre>';
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
$db_connection = null;
|
||||
?>
|
||||
|
||||
@@ -31,4 +31,6 @@
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?php
|
||||
$db_connection = null;
|
||||
?>
|
||||
|
||||
@@ -19,9 +19,8 @@
|
||||
<br><br>
|
||||
<input type="submit" class="button">
|
||||
</form>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<?php
|
||||
$db_connection = null;
|
||||
?>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<a href="/messagesSent.php">Sent Messages</a>
|
||||
<a href="/search.php">Search</a>
|
||||
<a href="/sendMessage.php">Message Someone</a>
|
||||
<a href="/findFriend.php">Find a New Friend</a>
|
||||
<a href="/findFriend.php">Add a Friend</a>
|
||||
<a href="/pendingFriend.php">Check Pending Friends</a>
|
||||
<!--Maybe show the user's name here?-->
|
||||
<a href="/logout.php" style="float:right">Logout</a>
|
||||
|
||||
@@ -23,6 +23,8 @@
|
||||
}
|
||||
echo '</pre>';
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
<?php
|
||||
$db_connection = null;
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user