<? require_once("../conn.php"); require_once("access.php"); include_once("LeftStyles.php"); if(isset($_POST[s1])) { if(!empty($_POST[username])) { $q1 = "update yellow_admin set AdminID = '$_POST[username]', AdminPass = '$_POST[np1]' where AdminID = '$_SESSION[AdminID]' "; $_SESSION[AdminID] = $_POST[username]; } else { $q1 = "update yellow_admin set AdminPass = '$_POST[np1]' where AdminID = '$_SESSION[AdminID]' "; } mysql_query($q1) or die(mysql_error()); echo "<br><center>Your login info was changed successfully!</center><br>"; } ?> <script> function CheckPass() { if(document.f1.username.value=="") { window.alert('Enter your new username, please!'); document.f1.username.value="<?=$_SESSION[AdminID]?>"; document.f1.username.focus(); return false; } if(document.f1.np1.value=="") { window.alert('Enter your new password, please!'); document.f1.np1.focus(); return false; } if(document.f1.np2.value=="") { window.alert('Confirm your new password, please!'); document.f1.np2.focus(); return false; } if(document.f1.np1.value != document.f1.np2.value) { window.alert('There is a problem with your new password!\n\nEnter and Confirm your new password again!'); document.f1.np1.value=""; document.f1.np2.value=""; document.f1.np1.focus(); return false; } } </script> <link rel="stylesheet" href="style.css" type="text/css"> <table align=center width=400> </table> <table width="90%" cellspacing="0" cellpadding="10" align="center" class="form"> <tr> <td> <div align="right"><font face="Arial, Helvetica, sans-serif" size="4"><b><font color="#FFFFFF">CLASSIFIEDS v2.0</font></b></font></div> </td> </tr> </table> <br> <br> <form method=post name=f1 onsubmit="return CheckPass();"> <table align=center width=285> <tr align="left"> <td colspan=2><font color=black face=verdana size=2><b><img src="images/admin/admin_info.jpg" width="21" height="21" align="absmiddle"> CHANGE PASSWORD </b></font></td> </tr> <tr> <td class="form_request">Username:</td> <td class="form_answer"> <input type=text name=username value="<?=$_SESSION[AdminID]?>"> </td> </tr> <tr> <td class="form_request">New password:</td> <td class="form_answer"> <input type=password name=np1> </td> </tr> <tr> <td class="form_request">Confirm password:</td> <td class="form_answer"> <input type=password name=np2> </td> </tr> <tr> <td> </td> <td> <input type=submit name=s1 value=Save class=sub> </td> </tr> </table> </form>