Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
emilymendelson authored Jul 6, 2020
1 parent 1934dce commit d69792f
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 0 deletions.
54 changes: 54 additions & 0 deletions Move & Restore/profile.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php
require "header.php";
include_once 'includes/dbh.inc.php';

{
$user = $_GET['user'];
$get_user = $conn->query("SELECT * FROM users WHERE idUsers = '$user'");
if ($get_user->num_rows == 1)
{
$profile_data = $get_user->fetch_assoc();
}
}
?>
<head>
<style>
<?php include 'stylesheet.css'; ?>
header {
background-image: url(../images/ankles.jpg);
}
</style>

<a href="index.php"><h3>Home</a> | <?php echo $profile_data['uidUsers'] ?>'s Profile </h3><p>
<figcaption class="profile"><a href="edit-profile.php?user=<?php echo $profile_data['uidUsers'] ?>">Edit Profile</a></figcaption>
<h2>Personal Information <?php
$visitor = $_SESSION['userId'];
if ($user == $visitor){
?>
<title><?php echo $profile_data['uidUsers'] ?>'s Profile</title>
</head>
<main>
</h2>

<figure style='float:left'>
<img class="profile" src="images/profiledefault.jpg" alt="profile default picture">
</figure>
<div style='float:left'>

<table>
<tr>
<td class="head">Username:<p></td><td class="info"><?php echo $profile_data['uidUsers'] ?><p></td>
</tr>
<tr>
<td class="head"> Email:</td><td class="info"><?php echo $profile_data['emailUsers'] ?></td>
</tr>

<?php
} else {
echo "<h5>An error occurred. Please login to this account before viewing personal information.</h5>";
}
?>
</table>
</div>
</main>
</html>
38 changes: 38 additions & 0 deletions Move & Restore/searchprofiles.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php
require "header.php";
include_once 'includes/dbh.inc.php';
?>
<title> <?php echo $username ?>s Profile </title>
<main>
<?php
//Check if the form has been submitted



if (isset($_GET['username'])){
$username = $_GET['username'];
$userquery = mysqli_query($conn, "SELECT * FROM users WHERE uidUsers='$username'")
or die ("The query could not be completed. Please try again later.");
if (mysqli_num_rows($userquery)!= 1){
die ("That username could not be found.");
}
while ($row = mysqli_fetch_array($userquery, MYSQLI_ASSOC)) {
$email = $row['emailUsers'];
$dBusername = $row['idUsers'];
}



?>

<h2><?php echo $username; ?>'s Profile</h2><br>
<table>
<tr><td>Username: </td><td><?php echo $username; ?></td></tr>
<tr><td>E-mail: </td><td><?php echo $email; ?></td></tr>
</table>

<?php
} else die ("You need to specify a username.");
?>

</main>
21 changes: 21 additions & 0 deletions Move & Restore/update-profile-action.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
require "header.php";
include_once 'includes/dbh.inc.php';


$user = $_GET['user'];
$visitor = $_SESSION['userUid'];

if ($user == $visitor){
if (isset($_POST['update_profile'])) {
$emailUsers = $_POST['email'];
$sql = "UPDATE users SET emailUsers='$emailUsers' WHERE uidUsers='$visitor'";
}
if (mysqli_query($conn, $sql)) {
echo "Record updated successfully";
header("Location: index.php?update=success");
exit();
}} else {
echo "Error updating record. Please Try Again." . mysqli_error($conn);
}

0 comments on commit d69792f

Please sign in to comment.