<?php
session_start();
 if(!($_SESSION['log'])){
	  header("Location:index.php");
	  }  
  	 include('includes/php/dbconnection.php');
	  include_once('thumbnail.class.php');
	 

	 
	 
	 
	 
	 
	 
	 
	 
	 
	 if($_REQUEST['changeinfo'])
	{
	$fname=",fname='".$_POST['fname']."'";
	$lname=",lname='".$_POST['lname']."'";
	$admin_username=",admin_username='".$_POST['admin_username']."'";
	
	
	 $query_user="UPDATE `tbl_admin` set user_name='test2'".$fname.$lname.$admin_username." where admin_id='31'";

	
	mysql_query($query_user) or die('Error, insert query failed');
	$id = mysql_insert_id();
	
	$_SESSION['msg']="Admin Info Updated Successfully";	
	header("location:settings.php");
	exit;
	
	}
	 
	 
	 
	 
	$pagequery = "SELECT * FROM tbl_admin where admin_id='31'";
				$pagesql = mysql_query($pagequery)or die(mysql_error());
				$results=mysql_fetch_array($pagesql);
				//$htmlData=$results['txtbody'];

?>
<script language="javascript" type="text/javascript">
function mailcontent()
{
	var type = document.getElementById('type').value;
	window.location = "cmspages.php?type="+type;
}
</script>
	
	
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title><?php echo $page_title;?></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="includes/css/style.css" rel="stylesheet" type="text/css">
<link href="includes/css/main.css" rel="stylesheet" type="text/css">
<script language="JavaScript">
</script>
<link href="includes/php/style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {color: #999999}
.style3 {color: #2788BF; }
-->
</style>
</head>
<body topmargin="0" bottommargin="0">
<table width="80%" height="100%" border="0" align="center" cellpadding="0" cellspacing="0"  class="border-leftt">
  <tr> 
    <td height="10" colspan="2"><?php include('includes/php/top.php'); ?></td>
  </tr>
  <tr> 
    <td width="25%" valign="top" align="center"  bgcolor="#F2F2F4" style="padding-top:10px" class="cat_repeat"><?php include("includes/php/left_new.php");?></td>
    <td width="75%"  valign="top" class="border-right">

  <table width="96%" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td width="100%" colspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td colspan="2" class="heading-nml">&nbsp;Admin Settings </td>
    </tr>
    <tr>
      <td class="err-mesage"><?php echo $_SESSION['msg']; unset($_SESSION['msg']);?></td>
      <td align="right">&nbsp;</td>
    </tr>
    <tr><td colspan="2" align="center" class="err-mesage"><table width="100%" border="0" align="center" cellpadding="1" cellspacing="1" bordercolor="#EDA846" bgcolor="">
          <tr class="">
            <td>
			
			
		
		
			<form name="info" action="<?php $_SERVER['PHP_SELF'];?>" method="post">
			
			<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
				

                <tr class="cpHeading" bgcolor="#618e20">
                  <td height="23" colspan="2" bgcolor="#2788BF"   style="padding-left: 5px; color:#FFFFFF;">Change Info </td>
				  <td width="14%"   style="padding-left: 5px; color:#FFFFFF;" bgcolor="#2788BF">&nbsp;</td>
				  <td width="6%"   style="padding-left: 5px; color:#FFFFFF;" bgcolor="#2788BF">&nbsp;</td>
				  <td width="37%" bgcolor="#2788BF" style="color:#FFFFFF;">&nbsp;</td>
                </tr>
                
				
                
				
				<tr >
                  <td width="18%" height="1" class="welcome-text" style="padding-left: 5px;">&nbsp;</td>
                  <td width="25%" class="welcome-text" style="padding-left: 5px;">&nbsp;</td>
                  <td height="18" colspan="3" class="welcome-text" style="padding-left: 5px;">&nbsp;</td>
                  </tr>
				
				
				   <tr >
                  <td height="41" class="welcome-text" style="padding-left: 10px;">First Name </td>
                  <td height="41" class="welcome-text" style="padding-left: 5px;"><span class="welcome-text" >
                    <input name="fname" id="fname" value="<?php echo $results['fname'];?>" type="text">
                  </span></td>
                  <td height="41" class="welcome-text" style="padding-left: 5px;"><input type="hidden" name="changeinfo" id="changeinfo" value="update"></td>
                  <td height="41" colspan="2" class="welcome-text" style="padding-left: 5px;">&nbsp;</td>
                  </tr>
				   <tr >
                  <td height="35" class="welcome-text" style="padding-left: 10px;">Last Name </td>
                  <td height="35" colspan="4" class="welcome-text" style="padding-left: 5px;">
                    <input name="lname" id="lname" value="<?php echo $results['lname'];?>" type="text"></td>
                  </tr>
				  
				<tr >
                  <td height="37" class="welcome-text" style="padding-left: 5px;"><span class="welcome-text" style="padding-left: 5px;"> User Name </span></td>
                  <td height="37" colspan="4" class="welcome-text" style="padding-left: 5px;">
                    <input name="admin_username" id="admin_username" value="<?php echo $results['admin_username'];?>" type="text">                 </td>
                  </tr>
				
				<tr>
                  <td height="1" colspan="2" align="center" style="padding-left: 5px;"><input type="submit" name="SaveTextData" value="Save" ></td>
                  <td height="1" colspan="6" align="center">&nbsp;</td>
                  </tr>
				<tr>
                  <td height="1">&nbsp;</td>
                  <td height="1">&nbsp;</td>
                  <td height="1">&nbsp;</td>
                  <td height="1">&nbsp;</td>
                  <td height="1" colspan="4">&nbsp;</td>
                  </tr>
				
				<tr>
                  <td height="2" colspan="8" bgcolor="#dfd4d0"></td>
                </tr>
				<tr>
                  <td height="1" colspan="8" class="err-mesage"><?php echo $_SESSION['msgpass']; unset($_SESSION['msgpass']);?>&nbsp;</td>
                </tr>
            </table>
			</form>
			</td>
			</tr>
			
			
			
			<tr>
			<td>
			
			
			<form name="pass" action="change.php" method="post">
			<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
				

                <tr class="cpHeading" bgcolor="#618e20">
                  <td height="23" colspan="2" bgcolor="#2788BF"   style="padding-left: 5px; color:#FFFFFF;">Change Password </td>
				  <td width="14%"   style="padding-left: 5px; color:#FFFFFF;" bgcolor="#2788BF">&nbsp;</td>
				  <td width="6%"   style="padding-left: 5px; color:#FFFFFF;" bgcolor="#2788BF">&nbsp;</td>
				  <td width="37%" bgcolor="#2788BF" style="color:#FFFFFF;">&nbsp;</td>
                </tr>
                
				
                
				
				<tr >
                  <td width="18%" height="1" class="welcome-text" style="padding-left: 5px;">&nbsp;</td>
                  <td width="25%" class="welcome-text" style="padding-left: 5px;">&nbsp;</td>
                  <td height="18" colspan="3" class="welcome-text" style="padding-left: 5px;">&nbsp;</td>
                  </tr>
				
				
				   <tr >
                  <td height="35" class="welcome-text" style="padding-left: 10px;"> Current Password </td>
                  <td height="35" class="welcome-text" style="padding-left: 5px;"><span class="welcome-text" >
                    <input name="currentpass" id="currentpass" value="" type="password">
                  </span></td>
                  <td height="35" colspan="3" class="welcome-text" style="padding-left: 5px;"><?php echo $_SESSION['sesErr']['currentpass'];?></td>
                  </tr>
				   <tr >
                  <td height="35" class="welcome-text" style="padding-left: 10px;">New Password </td>
                  <td height="35" class="welcome-text" style="padding-left: 5px;">
                  <input name="newpass" id="newpass" value="" type="password"></td>
                  <td height="35" colspan="3" class="welcome-text" style="padding-left: 5px;"><?php echo $_SESSION['sesErr']['newpass'];?></td>
                  </tr>
				  
				<tr >
                  <td height="25" class="welcome-text" style="padding-left: 5px;"><span class="welcome-text" style="padding-left: 5px;"> Re-New-Password </span></td>
                  <td height="25" class="welcome-text" style="padding-left: 5px;">
                   <input name="cpass" id="cpass" value="" type="password">                 </td>
                  <td height="25" colspan="3" class="welcome-text" style="padding-left: 5px;"><?php echo $_SESSION['sesErr']['cpass'];?></td>
                  </tr>
				
				<tr>
                  <td height="47" colspan="2" align="center" style="padding-left: 5px;"><input type="submit" name="SaveTextData" value="Save"></td>
                  <td height="47" colspan="6" align="center">&nbsp;</td>
                  </tr>
				<tr>
                  <td height="1"><input type="hidden" name="chngpass" id="chngpass" value="2"></td>
                  <td height="1">&nbsp;</td>
                  <td height="1">&nbsp;</td>
                  <td height="1">&nbsp;</td>
                  <td height="1" colspan="4">&nbsp;</td>
                  </tr>
				
				<tr>
                  <td height="1" colspan="8" bgcolor="#dfd4d0"></td>
                </tr>
            </table>
			</form>
			</td>
          </tr>
      </table>
	  </td>
    <tr>
      <td colspan="2" align="left">
	  <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#EDA846">
          <tr>
            <td height="18" colspan="5" align="center"></td>
          </tr>
      </table></td>
    </tr>
  </table>

    </td>
  </tr>
  <tr> 
    <td height="10" colspan="2"><?php include('includes/php/bottom.php'); ?></td>
  </tr>
</table>
</body>
</html>

<?php
if ( !(in_array($_SESSION['activelink'], $sesErrArr)) )
{
	unset($_SESSION['sesErr']);
}
unset($_SESSION['msg']);
?>