| Current Path : /home/bolconlineco/public_html/aaaaaa/demo/tutor/ |
| Current File : /home/bolconlineco/public_html/aaaaaa/demo/tutor/changepassword.php |
<?php
ob_start();
session_start();
?>
<?php include('header.php'); ?>
<?php
if(!isset($_SESSION['tutor']) || $_SESSION['tutorrole'] != 3)
{
header("location:../index.php");
exit();
}
?>
<script language="javascript" src="../coordinator/includes/jquery.js"></script>
<div id="content">
<?php
if(isset($_GET['rollno']))
{
$rollno=sql_strip($_GET['rollno']);
}
?>
<?php
if(isset($_GET['error']))
{?>
<div class="errors" style="margin-top:0px;"> Your new new password and confirm password must be match</div>
<?php
}else if(isset($_GET['ex']))
{
?>
<div class="errors" style="margin-top:0px;">Enter your old password</div>
<?php
}else if(isset($_GET['ok']))
{
?>
<div class="errors" style="margin-top:0px;"> Password change Successfully</div>;
<?php
}
?>
<div id="frm" style="width:600px;">
<h3>Password Management</h3>
<form action="" method="post" >
<ul class="col" >
<li>
<label for="oldpassword">Old Password</label>
<input type="password" name="oldpassword" />
</li>
<li>
<label for="newpassword">New Password</label>
<input type="password" name="newpassword" />
</li>
<li>
<label for="confirmpassword">Confirm Password</label>
<input type="password" name="confirmpassword" />
</li>
<li>
<div id="btn">
<input class="add2" type="submit" name="update-pass" value="Update " />
</div>
</li>
</ul>
</form>
</div>
<div id="data">
</div>
</div> <!-- end content -->
</div><!-- end wrapper -->
<?php
if(isset($_POST['update-pass']))
{
$old = md5(sql_strip($_POST['oldpassword']));
$new = md5(sql_strip($_POST['newpassword']));
$newconfirm = md5(sql_strip($_POST['confirmpassword']));
if($new != $newconfirm)
{
header("location:changepassword.php?error");
exit();
}
else
{
$sql="select adminId from admin where userPass = '$old'";
$result=mysql_query($sql) or die(mysql_error());
if(mysql_num_rows($result) == 1)
{
$sql="update admin set userPass='$new' where userPass='$old'";
$result=mysql_query($sql) or die(mysql_error());
header("location:changepassword.php?ok");
exit();
}
else
{
header("location:changepassword.php?ex");
exit();
}
}
}
?>
<?php include('../includes/footer.php');?>