Merge branch 'master' of https://git.williammiceli.systems/williammiceli-educational/CS4430-Project
This commit is contained in:
@@ -3,18 +3,18 @@ server {
|
||||
listen [::]:80;
|
||||
|
||||
root /var/www/;
|
||||
index index.html
|
||||
landingPage landingPage.html
|
||||
server_name _;
|
||||
|
||||
access_log /var/log/nginx/access.log;
|
||||
error_log /var/log/nginx/error.log;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html =404;
|
||||
try_files $uri $uri/ /landingPage.html =404;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
include snippets/fastcgi-php.conf;
|
||||
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
13
var/www/messageSender.php
Normal file
13
var/www/messageSender.php
Normal file
@@ -0,0 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<body>
|
||||
<style>
|
||||
body {
|
||||
background-color: #3B5998;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,8 +1,30 @@
|
||||
<html>
|
||||
<body>
|
||||
|
||||
First Name is <?php echo $_POST["fname"]; ?><br>
|
||||
Last Name is <?php echo $_POST["lname"]; ?>
|
||||
|
||||
<?php
|
||||
|
||||
$fname = $_POST["fname"];
|
||||
$lname = $_POST["lname"];
|
||||
|
||||
$servername = "localhost";
|
||||
$username = "web";
|
||||
$password = "Password456";
|
||||
|
||||
// Create connection
|
||||
$conn = new mysqli($servername, $username, $password);
|
||||
|
||||
// Check connection
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
echo "Connected successfully";
|
||||
|
||||
$query = "Select * from contacts where fname = " + $fname + " and lnam = " + $lname;
|
||||
|
||||
print $query;
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -9,35 +9,6 @@ body {
|
||||
|
||||
<h2><font color="white">Search by</h2>
|
||||
|
||||
<?php
|
||||
$name = $fname = $lname = "";
|
||||
$nameErr = $fnameErr = $lnameErr = "";
|
||||
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
if (empty($_POST["name"])) {
|
||||
$nameErr = "Name is required";
|
||||
}
|
||||
else {
|
||||
$name = test_input($_POST["name"]);
|
||||
if (!preg_match("/^[a-zA-Z ]*$/",$name)) {
|
||||
$nameErr = "Only letters and white space allowed";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function test_input($data) {
|
||||
$data = trim($data);
|
||||
$data = stripslashes($data);
|
||||
$data = htmlspecialchars($data);
|
||||
return $data;
|
||||
}
|
||||
?>
|
||||
|
||||
<form method="post" action="usernameSearch.php">
|
||||
Username: <br><input type="text" name="username"><br>
|
||||
<input type="submit">
|
||||
|
||||
@@ -1,7 +1,31 @@
|
||||
<html>
|
||||
<body>
|
||||
<style>
|
||||
body {
|
||||
background-color: #3B5998;
|
||||
}
|
||||
</style>
|
||||
|
||||
Username is <?php echo $_POST["username"]; ?>
|
||||
<?php
|
||||
$username = $_POST["username"];
|
||||
|
||||
$servername = "localhost";
|
||||
$username = "web";
|
||||
$password = "Password456";
|
||||
|
||||
// Create connection
|
||||
$conn = new mysqli($servername, $username, $password);
|
||||
|
||||
// Check connection
|
||||
if ($conn->connect_error) {
|
||||
die("Connection failed: " . $conn->connect_error);
|
||||
}
|
||||
echo "Connected successfully";
|
||||
|
||||
$query = "Select * from contacts where username = " + $username;
|
||||
|
||||
print $query;
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user