<?php
include("db.php");


if(!isset($_SESSION["user"]["uid"]))
{
redirect(URL_ROOT."index.php");
}

if(isset($_POST['submit']))
{
$up_array=array(
					'name'=>$_POST['name'],
					'dob'=>$_POST['dob'],
					'address'=>$_POST['address'],
					'mobile'=>$_POST['mobile'],
					'email'=>$_POST['email'],
					'gender'=>$_POST['gender']
				);
$update_profile=$db->updateAry("student",$up_array,"where idno=".$_SESSION["user"]["uid"]);
	if($update_profile)
	{
		echo "successfully updated";exit;	
	}else{
		echo $db->getErMsg();exit;	
	}

}
else{
$id="";
if(isset($_SESSION["user"]["uid"]))$id=$_SESSION["user"]["uid"];

//$mydeatilCurrent=$objuser->userdetail($id);

//echo "My Details<pre>";print_r($objindex->profile($_SESSION['user']['uid']));exit;

$smarty->assign("profile",$objindex->profile($_SESSION['user']['uid']));
$smarty->assign("myDetail", $mydeatilCurrent);
$smarty->assign("meta_title", $LinksDetails["general_meta_title"]);
$smarty->assign("meta_tag", $LinksDetails["general_meta_tags"]);
$smarty->assign("meta_description", $LinksDetails["general_meta_desc"]);

$smarty->assign("profile",$objindex->profile($_SESSION['user']['uid']));

//echo "<pre>";print_r($objindex->profile($_SESSION['user']['uid']));exit;
$smarty->display('profile.html');


	
}

