<?php
  include "../include/dbcon.php";
  include "../include/CADMIN.php";
?>
<?php
  $pid = $_POST["pid"];
  $ppass0 = $_POST["pass0"];
  $ppass1 = $_POST["pass1"];
  
  if($ppass0!=="" && $ppass1!==""){
  
    if( strcmp($ppass0,$ppass1)!==0){
      $_SESSION["errmsg"] = "#ERROR:<br>UPDATE ERROR";
	  header("location: main.php?pg=pwe&id=" . $pid);  
	}else{
      $myadmin = new ADMIN();
      $myadmin->setAdmin("id",$pid);
	  $myadmin->pass = $ppass0;
      $myadmin->updateAdmin();

      $_SESSION["infomsg"] = "#INFO:<br>UPDATE SUCCESS";
	  header("location: main.php?pg=pw");

	}
	  
  }else{
    $_SESSION["errmsg"] = "#ERROR:<br>UPDATE ERROR";
	header("location: main.php?pg=pwe&id=" . $pid);
  }
?>