Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
UConnJobSearch/editMyAccount.php
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
151 lines (135 sloc)
5.19 KB
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
<!-- Authored by Iu-Wei Sze and Ashley Dumaine and Robert Paganetti --> | |
<?php | |
session_start(); | |
if($_POST) | |
{ | |
$connect = mysqli_connect("localhost", "root", '', "databasesproject") or die(mysql_error()); | |
$oldPass = $_POST["old"]; | |
$newPass = $_POST["new"]; | |
$newPassConf = $_POST["confirmedNew"]; | |
if(empty($oldPass) || empty($newPass) || empty($newPassConf)) | |
{ | |
echo '<script type="text/javascript">alert("Please fill in all fields!");</script>'; | |
} | |
else if(strcmp($newPass, $newPassConf) != 0) | |
{ | |
echo '<script type="text/javascript">alert("New passwords do not match!");</script>'; | |
} | |
else | |
{ | |
$UName = $_SESSION['myusername']; | |
$sql = "UPDATE user SET UPasswd = '". $newPass ."' WHERE UName = '". $UName ."' AND UPasswd = '". $oldPass ."'"; | |
$result = mysqli_query($connect, $sql) or trigger_error($connect->error."[ $sql]"); | |
if(mysqli_affected_rows($connect)){ | |
echo "<br><div role='alert' class='alert alert-success'>Password update successful!</div>"; | |
} | |
else{ | |
echo '<script type="text/javascript">alert("Password update failed!");</script>'; | |
} | |
} | |
} | |
?> | |
<!DOCTYPE html> | |
<html> | |
<style> | |
form { width: 1200px; } | |
input { float: right; width: 250px; } | |
body { font: 16px Helvetica, Sans-Serif; line-height: 24px; background: url(images/noise.jpg); } | |
</style> | |
<head> | |
<title>Edit My Account</title> | |
<link href="http://s3.amazonaws.com/codecademy-content/courses/ltp/css/shift.css" rel="stylesheet"> | |
<link rel="stylesheet" href="http://s3.amazonaws.com/codecademy-content/courses/ltp/css/bootstrap.css"> | |
<link rel="stylesheet" href="editMyAccount_formatting.css"> | |
</head> | |
<body> | |
<div class="nav"> | |
<div class="container"> | |
<ul class="pull-left"> | |
<!-- <li><a href=<img><></li> --> | |
<li><a href="http://localhost/UConnJobSearch/index.php">UConnJobSearch</a></li> | |
<li>|</li> | |
<li><a href="http://localhost/UConnJobSearch/about.php">About</a></li> | |
</ul> | |
<ul class="pull-right"> | |
<?php if ($_SESSION): ?> | |
<?php if ($_SESSION['type'] == "Admin"): ?> | |
<li><a href="http://localhost/UConnJobSearch/admin_dashboard.php">Dashboard</a></li> | |
<li>|</li> | |
<li><a href="http://localhost/UConnJobSearch/admin.php">My Account</a></li> | |
<li>|</li> | |
<li><a href="http://localhost/UConnJobSearch/logout.php">Log Out</a></li> | |
<li>|</li> | |
<li><a href="http://localhost/UConnJobSearch/faq.php">Help</a></li> | |
<?php elseif ($_SESSION['type'] == "Poster"): ?> | |
<li><a href="http://localhost/UConnJobSearch/posterDashboard.php">Dashboard</a></li> | |
<li>|</li> | |
<li><a href="http://localhost/UConnJobSearch/poster.php">My Account</a></li> | |
<li>|</li> | |
<li><a href="http://localhost/UConnJobSearch/logout.php">Log Out</a></li> | |
<li>|</li> | |
<li><a href="http://localhost/UConnJobSearch/faq.php">Help</a></li> | |
<?php elseif ($_SESSION['type'] == "Seeker"): ?> | |
<li><a href="http://localhost/UConnJobSearch/dashboard.php">Dashboard</a></li> | |
<li>|</li> | |
<li><a href="http://localhost/UConnJobSearch/seeker.php">My Account</a></li> | |
<li>|</li> | |
<li><a href="http://localhost/UConnJobSearch/logout.php">Log Out</a></li> | |
<li>|</li> | |
<li><a href="http://localhost/UConnJobSearch/faq.php">Help</a></li> | |
<?php endif; ?> <!-- not logged in --> | |
<?php else: ?> | |
<li><a href="http://localhost/UConnJobSearch/register.php">Register</a></li> | |
<li>|</li> | |
<li><a href="http://localhost/UConnJobSearch/login.php">Log In</a></li> | |
<li>|</li> | |
<li><a href="http://localhost/UConnJobSearch/faq.php">Help</a></li> | |
<?php endif; ?> | |
</ul> | |
</div> | |
</div> | |
<div class="jumbotron"> | |
<div class="container"> | |
<form action="editMyAccount.php" method="post"> | |
<div class="row"> | |
<div class="col-md-6"> | |
<h1>Edit My Account</h1> | |
<hr style="height: 1px; color: #008000; width: 100% " /> | |
<h4 style="color: #fff">Change Password</h4><br> | |
<p style="color: #fff; font-size: 15px"> | |
Old Password: <input type="text" id="old" name="old"></input><br><br> | |
New Password: <input type="text" id="new" name="new"></input><br><br> | |
Confirm Password: <input type="text" id="confirmedNew" name="confirmedNew"></input><br><br> | |
</p> | |
</div> | |
<div class="col-md-6"> | |
<br><br> | |
</div> | |
</div> | |
<input type = "submit" name = "changepassbutton" value = "Change Password"> | |
</form> | |
</div> | |
</div> | |
<div class="learn-more"> | |
<div class="container"> | |
<div class="row"> | |
</div> | |
</div> | |
</div> | |
<div class="credits"> | |
<footer> <!-- site wide footer --> | |
<nav> | |
<p><a href="http://localhost/UConnJobSearch/credits.php">Credits</a> | |
<a>|</a> | |
<a href="">Terms of Service</a> | |
<a>|</a> | |
<a herf="">Blog Index</a> | |
</p> | |
</nav> | |
<p>Copyright © 2015 UConn</p> | |
</footer> | |
</div> | |
</body> | |
<head> | |
</head> | |
</html> |