-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1934dce
commit d69792f
Showing
3 changed files
with
113 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
|