File: //proc/self/cwd/admin/change_password.php
<?php
session_start();
include '../connect.php';
//if($_SESSION['username'] == '') { header('location:index.php'); }
$oldpassword = mysql_fetch_array(mysql_query("select password from login where login_id = 1"));
if(isset($_POST['change_password']))
{
if($_POST['old_password'] == '' ) { $msg = "Enter Current password"; }
else if($_POST['new_password'] == '' ) { $msg = "Enter New password"; }
else if($_POST['old_password'] == $oldpassword['password'] )
{
$change = mysql_query("update login set password = '".$_POST['new_password']."' where login_id = 1");
header ('location:logout.php');
}
else
{
$msg = "You have entered wrong current password. ";
}
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Suraj Automobiles</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="keywords" content="Your keywords">
<meta name="author" content="Your name">
<link rel="stylesheet" type="text/css" media="screen" href="../styles.css">
<!--<link href='http://fonts.googleapis.com/css?family=Ruthie' rel='stylesheet' type='text/css'>-->
<script src="../js/jquery-1.7.2.min.js"></script>
<script src="../js/menu.js"></script>
<script src="//tinymce.cachefly.net/4.0/tinymce.min.js"></script>
<script>
tinymce.init({selector:'textarea'});
</script>
</head>
<body>
<!--==============================header=================================-->
<div class="content_my">
<div class="grid_12">
<div align="center">
<h1 class="extra-wrap"><a href="#"><img src="../images/suraj-auto.png"></a></h1>
</div>
<div class="clear"></div>
<nav>
<ul class="sf-menu">
<li style="width:150px;" ><a href="welcome.php">Home</a></li>
<li style="width:200px;"><a href="#">Manage Images</a>
<ul>
<li><a href="add_images.php">Add Images</a></li>
<li><a href="view_images.php">View Images</a></li>
<li><a href="page_wise.php">View Page Wise</a></li>
</ul>
</li>
<li style="width:200px;"><a href="page_contents.php">Edit Page Contents</a></li>
<li style="width:180px;" class="current"><a href="change_password.php">Change Password</a></li>
<li><a href="logout.php">Logout</a></li>
</ul>
<div class="clear"></div>
</nav>
<!--==============================footer=================================-->
<footer class="wrapper top-8">
<div class="content_my">
<div class="grid_12 border-2"></div>
<div class="clear"></div>
<div class="grid_6" style="height:400px; font-size:14px;">
<h3>Change Password: </h3><br/>
<div style="color:#0C0;"><b><?php echo $msg; ?></b></div>
<form method="post">
<div style="padding-bottom:20px;"> <label>Current password:</label>
<input type="text" name="old_password" class="textbox" ></div>
<div style="padding-bottom:20px;" > <label>New Password:</label>
<input type="text" name="new_password" class="textbox" ></div>
<br/><br/> <div style="padding-bottom:20px;"> <input type="submit" name="change_password" value="Change Password" style="background:#000; color:#FFF; padding:5px;"> <input type="submit" name="cancel" value="Cancel" style="background:#000; color:#FFF; padding:5px;" ></div>
</form>
</div>
<div class="grid_12 border-2"></div>
<div class="clear"></div>
<div class="grid_6"><p class="top-1">Suraj Automobiles © 2013 : <a class="color-2" href="#">Privacy Policy</a><br />
<!-- Do not remove -->Design by <a class="color-2" href="http://www.visualcreations.in">Visual Creations</a><!-- end --></p>
</div>
</div>
</footer>
</div>
</div>
</body>
</html>