<div class="sections">
  <div class="info">We are now ready to proceed with installation. At this step we will attempt to create all required Fields and populate them with data. Should something go wrong, come back to the Previous step and make sure everything is correct.</div>
</div>
<?php
if($_POST){
	//echo "<pre>";print_r($_POST);echo "</pre>".$_POST[user]["admin_uname"];
	if(!isset($_POST["user"]["admin_uname"]) || trim($_POST["user"]["admin_uname"])=="")
	{
		echo "<p class='error'>Admin Name is Required</p>";
	}
	elseif(!isset($_POST["user"]["admin_pswd"]) || trim($_POST["user"]["admin_pswd"])=="")
	{
		echo "<p class='error'>Admin Password is Required</p>";
	}
	elseif(!isset($_POST["setting"]["site_name"]) || trim($_POST["setting"]["site_name"])=="")
	{
		echo "<p class='error'>School Name is Required</p>";
	}
	elseif(!isset($_POST["setting"]["logo"]) || trim($_POST["setting"]["logo"])=="")
	{
		echo "<p class='error'>Logo is Required</p>";
	}
	elseif(!isset($_POST["setting"]["settingPass"]) || trim($_POST["setting"]["settingPass"])=="")
	{
		echo "<p class='error'>Setting Pass is Required</p>";
	}
	else
	{
		$array=array("userid"=>$_POST['user']['admin_uname'],
					 "password"=>$_POST['user']['admin_pswd'],
					 "session"=>$_SESSION["admin"]["session"],
					 "school_id"=>$_SESSION["admin"]["school_id"],
					 "roll"=>1,
					 "status"=>1
		);
		$ins=$db->updateAry("users",$array,"where school_id=".$_SESSION["admin"]["school_id"]);
		foreach($_POST['setting'] as $field=>$value)
		{
			$flgUp=$db->update("update setting set `".$field."`='".$value."' where `school_id`='".$_SESSION["admin"]["school_id"]."'");
		}
		//echo $db->getErMsg()."<br />".$ins;exit;
		redirect("install.php?step=7");
	}
		
}
?>
<center>
<table>
	<tr>
    	<td>Admin userid</td><td><input type="text" name="user[admin_uname]" value="<?php echo $LinksDetails["admin_uname"] ?>" /></td>
    </tr>
    <tr>
        <td>Admin Password</td><td><input type="text" name="user[admin_pswd]" value="<?php echo $LinksDetails["admin_pswd"] ?>" /></td>
    </tr>
    <tr>
        <td>School Name</td><td><input type="text" name="setting[site_name]" value="<?php echo $LinksDetails["site_name"] ?>" /></td>
    </tr>
    <tr>
        <td>School Logo</td><td><input type="text" name="setting[logo]" value="<?php echo $LinksDetails["logo"] ?>" /></td>
    </tr>
    <tr>
        <td>Setting Password</td><td><input type="text" name="setting[settingPass]" value="<?php echo $LinksDetails["settingPass"];?>" /></td>
    </tr>
    
    <tr>
        <td>Account Password</td><td><input type="text" name="setting[account_password]" value="<?php echo $LinksDetails["settingPass"];?>" /></td>
    </tr>
    <tr>
        <td>Faculty Password</td><td><input type="text" name="setting[faculty_password]" value="<?php echo $LinksDetails["settingPass"];?>" /></td>
    </tr>
</table>
</center>
<input type="hidden" name="systemname" value="<?php echo $system ?>" />
<input type="hidden" name="ip" value="<?php echo $ip; ?>" />