<?php
session_start();
ob_start();
include_once("dbconnect.php");

$addup="update register set Fname='".$_POST['Fname']."',Lname='".$_POST['Lname']."',Email='".$_POST['Email']."',Phone='".$_POST['Phone']."',Fax='".$_POST['Fax']."',shippingaddress1='".$_POST['PAddress1']."',shippingaddress2='".$_POST['PAddress2']."',shippingphone='".$_POST['PPhone']."',shippingcountry='".$_POST['PCountry']."',shippingstate='".$_POST['PState']."',shippingcity='".$_POST['PCity']."',shippingfax='".$_POST['PFax']."',shippingzip='".$_POST['PZip']."',billingaddress1='".$_POST['Address1']."',billingaddress2 ='".$_POST['Address2']."',billingphone='".$_POST['Phone']."',billingcountry='".$_POST['Country']."',billingstate='".$_POST['State']."',billingcity='".$_POST['City']."',billingfax='".$_POST['Fax']."',billingzip='".$_POST['Zip']."' where user_id='".$_SESSION['userid']."'";
//echo $addup; exit;
$addupdate=mysql_query($addup);

header("location:myaccount.php?suc=yes");

//if($_SESSION['guestid']!="")
//	{
//
//    $addtable="guest";
//	$annaqry="Select * from guest where id_user='".$_SESSION['guestid']."' order by id_user desc";
//	$annares=mysql_query($annaqry);
//	$annarow=mysql_fetch_array($annares);
//	$user= mysql_num_rows($annares);
//	
//
//	
//	if($user >0)
//	{
//
//  $qwqw="update guest set firstname='".$_POST['Fname']."',lastname='".$_POST['Lname']."',
//	address1='".$_POST['Address1']."',address2='".$_POST['Address2']."',phone='".$_POST['Phone']."',country='".$_POST['Country']."',state='".$_POST['State']."',city='".$_POST['City']."',zip='".$_POST['Zip']."',paymentfirstname='".$_POST['PFname']."',paymentlastname='".$_POST['PLname']."',paymentaddress1='".$_POST['PAddress1']."',paymentaddress2='".$_POST['PAddress2']."',paymentphone='".$_POST['PPhone']."',paymentcountry='".$_POST['PCountry']."',paymentstate='".$_POST['PState']."',paymentcity='".$_POST['PCity']."',paymentzip='".$_POST['PZip']."',guestemail='".$_POST['Email']."',paymentmethod='".$_POST['method']."' where Id_user='".$_SESSION['guestid']."'";
//$lax=mysql_query($qwqw);
//
//      $_SESSION['Fname']=$_POST['Fname'];
//	  $_SESSION['Lname']=$_POST['Lname'];
//	  $_SESSION['add1']=$_POST['Address1'];
//	  $_SESSION['city']=$_POST['City'];
//	  $_SESSION['state']=$_POST['State'];
//	  $_SESSION['zip']=$_POST['Zip'];
//	header("Location: checkout.php");
//	}
//	else
//	{ 
//
//    $qwqw="insert into guest(cartid,Id_user,firstname,lastname,address1,address2,phone,country,state,city,zip,paymentfirstname,paymentlastname,paymentaddress1,paymentaddress2,paymentphone,paymentcountry,paymentstate,paymentcity,paymentzip,guestemail,paymentmethod) values('".$cid."','".$_SESSION['guestid']."','".$_POST['Fname']."','".$_POST['Lname']."','".$_POST['Address1']."','".$_POST['Address2']."','".$_POST['Phone']."','".$_POST['Country']."','".$_POST['State']."','".$_POST['City']."','".$_POST['Zip']."','".$_POST['PFname']."','".$_POST['PLname']."','".$_POST['PAddress1']."','".$_POST['PAddress2']."','".$_POST['PPhone']."','".$_POST['PCountry']."','".$_POST['PState']."','".$_POST['PCity']."','".$_POST['PZip']."','".$_POST['Email']."','".$_POST['method']."')";
//	
//	$lax=mysql_query($qwqw);
//	$_SESSION['Fname']=$_POST['Fname'];
//	  $_SESSION['Lname']=$_POST['Lname'];
//	  $_SESSION['add1']=$_POST['Address1'];
//	  $_SESSION['city']=$_POST['City'];
//	  $_SESSION['state']=$_POST['State'];
//	  $_SESSION['zip']=$_POST['Zip'];
//header("Location: checkout.php");
//	}
//	
//	} else {
//
//$addup="update register set Fname='".$_POST['Fname']."',Lname='".$_POST['Lname']."',Email='".$_POST['Email']."',Phone='".$_POST['Phone']."',Fax='".$_POST['Fax']."',shippingaddress1='".$_POST['PAddress1']."',shippingaddress2='".$_POST['PAddress2']."',shippingphone='".$_POST['PPhone']."',shippingcountry='".$_POST['PCountry']."',shippingstate='".$_POST['PState']."',shippingcity='".$_POST['PCity']."',shippingfax='".$_POST['PFax']."',shippingzip='".$_POST['PZip']."',billingaddress1='".$_POST['Address1']."',billingaddress2 ='".$_POST['Address2']."',billingphone='".$_POST['Phone']."',billingcountry='".$_POST['Country']."',billingstate='".$_POST['State']."',billingcity='".$_POST['City']."',billingfax='".$_POST['Fax']."',billingzip='".$_POST['Zip']."' where user_id='".$_SESSION['uid']."'";
////echo $addup; exit;
//$addupdate=mysql_query($addup);
//
//header("location:checkout.php");
//	}
?>