<?php // pineapple_user_settings.php  

	require_once "./pineapple.php";		// this file has the menu, header and css code for the site
	require_once "./mysql/helper.php";	// this is general purpose mysql helper code, code work anywhere

	// This line renders the menu and header for the site
	pineapple_html_begin("Pineapple PNP", "Pineapple User Settings");

	if( isset($_SESSION['email']) )
		$email = $_SESSION['email'];

	if(!isset($email)) {
		?>
		<p>Please click <a href="pineapple_login.php">here</a> to login.</p>
		<?php
		goto exit_page;
	}

	$db = db_connect("pontech_pineapplepnp");
  
  $sql = "SELECT date(creation_date) AS creation_date FROM pontech_pineapplepnp.user WHERE email = ?";
  $prepared_array = array($email);
  $sth = $db->prepare($sql);
  $success = $sth->execute($prepared_array);
  $row = $sth->fetch (PDO::FETCH_NUM);
  echo "Enjoying pineapples since " . $row[0] . "!";
  
  print "<h1>New Addresss</h1>";
  $sql = "SELECT address_label, street, city, state, zip, country FROM user_address WHERE email = '' limit 1 ";
  $prepared_array = NULL;
  
  db_edit_row($db, $sql, $prepared_array, "pineapple_address_edit_action.php",
              array()
              );
  goto exit_page;
  
exit_page:
  // This is the end of the HTML body, scripting starts after this.
  pineapple_script_end();
	// This is the end of the HTML file, scripting starts after this.
  pineapple_html_end();

//$username = $result->fetchColumn(3);
?>