Updating search and sendMessage. Also correcting the landing page to redirect to redirect to the new pages

This commit is contained in:
Bryan
2019-11-24 23:07:11 -05:00
parent 8e7b68966c
commit d5f977e7d1
3 changed files with 127 additions and 0 deletions

21
var/www/landingPage.html Normal file
View File

@@ -0,0 +1,21 @@
<!DOCTYPE html>
<html>
<body>
<style>
body {
background-color: #3B5998;
}
</style>
<h2><font color="white">Friendbook</h2>
<button type="button" onclick="window.location.href = 'friends.html'">See Friends</button>
<button type="button" onclick="window.location.href = 'messages.html'">See Messages</button>
<button type="button" onclick="window.location.href = 'contacts.html'">See Contacts</button>
<button type="button" onclick="window.location.href = 'search.php'">Search</button>
<button type="button" onclick="window.location.href = 'sendMessage.php'">Message Someone</button>
<button type="button" onclick="window.location.href = 'findFriend.html'">Find a New Friend</button>
<button type="button" onclick="window.location.href = 'pendingFriend.html'">Check Pending Friends</button>
</body>
</html>

50
var/www/search.php Normal file
View File

@@ -0,0 +1,50 @@
<!DOCTYPE html>
<html>
<body>
<style>
body {
background-color: #3B5998;
}
</style>
<h2><font color="white">Who would you like to search for</h2>
<?php
$name = $message = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (empty($_POST["name"])) {
$name = "";
} else {
$comment = test_input($_POST["name"]);
}
if (empty($_POST["Message"])) {
$message = "";
} else {
$message = test_input($_POST["message"]);
}
}
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
Which Search:
<input type="radio" name="type" <?php if (isset($type) && $gender=="name") echo "checked";?> value="type">Name
<input type="radio" name="type" <?php if (isset($type) && $gender=="username") echo "checked";?> value="type">Username
<br><br>
Search Key: <br><input type="text" name="name" value="<?php echo $name;?>">
<br><br>
<input type="submit" name="submit" value="Submit">
</form>
</body>
</html>

56
var/www/sendMessage.php Normal file
View File

@@ -0,0 +1,56 @@
<!DOCTYPE html>
<html>
<body>
<style>
body {
background-color: #3B5998;
}
</style>
<h2><font color="white">Send a message</h2>
<?php
$name = $message = "";
if ($_SERVER["REQUEST_METHOD"] == "POST") {
if (empty($_POST["name"])) {
$name = "";
} else {
$comment = test_input($_POST["name"]);
}
if (empty($_POST["Message"])) {
$message = "";
} else {
$message = test_input($_POST["message"]);
}
}
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>
<form method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
Who are you sending it to?: <br><input type="text" name="name" value="<?php echo $name;?>">
<br><br>
Message: <br><textarea name="message" rows="5" cols="40"><?php echo $message;?></textarea>
<br><br>
<input type="submit" name="submit" value="Submit">
</form>
<?php
echo $name;
echo "<br>";
echo $message;
echo "<br>";
?>
</body>
</html>