<?php session_start();  //Developed by ITechScripts
require 'include/announcements.php'; // ITECHBIDS Configuration File
require 'include/itechbids.php'; // Server compatibility Patch
$locheckuser=$_SESSION[username];
$locheckpass=$_SESSION[checkpass];
if((strlen($locheckuser)==0) || (strlen($locheckpass)==0))
{
echo '<meta http-equiv="refresh" content="0; url=index.php">';
exit();
} 
$lochecksql="select * from member_details where user_name='$locheckuser' and password='$locheckpass' and verified='yes' and approved='yes' and payment_status='yes'";
$locheckre=mysql_query($lochecksql);
if(mysql_num_rows($locheckre)==0)
{
echo '<meta http-equiv="refresh" content="0; url=index.php">';
exit();
} 
$step=$_POST[step];
$member=$_GET[member];
$user_sql="select * from member_details where user_id=$_SESSION[userid]";
$user_result=mysql_query($user_sql);
$row=mysql_fetch_array($user_result);
$first=$row[first_name];
$last=$row[last_name];
$address=$row[address];
$city=$row[city];
$state=$row[state];
$country=$row[country];
$code=$row[pin_code];
$primaryno=$row[home_phone];
$secondaryno=$row[work_phone];
$email=$row[email];
$html_profile=$row[html_profile];
$reemail=$row[email];
if($step==1)
{
 $html_profile=$_REQUEST['html_profile'];
$first=$_POST[txtfirst];
$last=$_POST[txtlast];
$member=$_POST[member];
$address=$_POST[txtaddress];
$city=$_POST[txtcity];
$primary=$_POST[txtprimary];
$secondary=$_POST[txtsecondary];
$email=$_POST[txtemail];
$reemail=$_POST[txtreemail];
$terms=$_POST[chkterms];
$validEmailExpr= "^[0-9a-z~!#$%&_-]([.]?[0-9a-z~!#$%&_-])*"."@[0-9a-z~!#$%&_-]([.]?[0-9a-z~!#$%&_-])*$";
$email_enable_status=$_POST[email_status];
  if(empty($first))
  {
  $err_first="Please enter this information";
  $err_flag=1;
  }
  if(empty($last))
  {
  $err_last="Please enter this information";
  $err_flag=1;
  }
  if(empty($address))
  {
  $err_add="Please enter this information";
  $err_flag=1;
  }
    if(empty($city))
	{
	  $err_city="Please enter this information";
	  $err_flag=1;
	}
    if(empty($primary))
   {
     $err_primary="Please enter this information";
	 $err_flag=1;
   }
   
	if(empty($email))
   {
    $err_email="Please enter this information";
    $err_flag=1;
	}
  else
   {
    if(!eregi($validEmailExpr,$email))
	{
	 $err_email="Your Email address id invalid ";
	 $err_flag=1;
	}
	}
   if(empty($reemail))
   {
  $err_reemail="Please enter this information";
    $err_flag=1;
	}
  else
  {
    if(!eregi($validEmailExpr,$reemail))
	{
	 $err_reemail="Your Email address id invalid ";
	 $err_flag=1;
	}
	}
   
   if(empty($err_email) && empty($err_reemail))
	{
	if($email!=$reemail)
	{
	   $err_email="Your email entries must match. Please check both.";
	   $err_remail="Your email entries must match. Please check both.";
	   $err_flag=1;
	}
	}
  if($err_flag!=1)
  {
   $html_profile=$_REQUEST['html_profile'];
   $date_of_registration=date('Y-m-d');
   $ip=$_SERVER['REMOTE_ADDR'];
   $temp_account=1; 
   $sql="update member_details set first_name='$first',last_name='$last',";
   $sql.="html_profile='$uploaddir' , address='$address', ";
   $sql.="city='$city',state='$state',country='$country',pin_code='$code',home_phone='$primary',";
   $sql.=" work_phone='$secondary',email='$reemail',html_profile ='$html_profile' where user_id=".$_SESSION['userid'];
   $res=mysql_query($sql);
   if($res)
   $status=1;
  } 
} //step==1
?>

<? require'themes/myprofile.tpl'?>
<? require 'templates/'.$tfold.'/footer.php'?>

  </body>
</html>
