<div id="left">			
	<div id="preview"></div>
	<?php
	if(isset($_SESSION["user"])) {
		$user=$_SESSION["user"];
	} else {	
		echo "Not logged in!";
		exit;
	}
if(isset($_POST['settings'])) {
	$website = yasDB_clean($_POST['website']);
	$name = yasDB_clean($_POST['name']);
	$email = yasDB_clean($_POST['email']);
	$location = yasDB_clean($_POST['location']);
	$job = yasDB_clean($_POST['job']);
	$aboutme = yasDB_clean($_POST['aboutme']);
	$aim = yasDB_clean($_POST['aim']);
	$msn = yasDB_clean($_POST['msn']);
	$skype = yasDB_clean($_POST['skype']);
	$yahoo = yasDB_clean($_POST['yahoo']);
	yasDB_update("update user set website = '$website', name = '$name', email = '$email', location='$location', job='$job', aboutme='$aboutme', aim='$aim', msn='$msn', skype='$skype', yahoo='$yahoo' where username = '$user'") or die(mysql_error());
	if(!empty($_POST['password'])) {
		$password = md5(yasDB_clean($_POST['password'])) ;
		yasDB_update("update user set password = '$password' where username = '$user'");
	}
	echo '<META HTTP-EQUIV="Refresh" CONTENT="0; URL=index.php?act=profile">';
} else {
	$query = yasDB_select("select * from `user` where username = '$user'");
	$row = $query->fetch_array(MYSQLI_ASSOC);
	echo '<table class="dataTable" cellspacing="0" cellpadding="0" border="1" width="95%" >
	<tr><th colspan="2" align="center">'.$user.'s Profile: </th></tr>
	  <tr>
		<td><div id="profileBox"><form name="profile" id="profile" method="post" action="index.php?act=profile">
	Name:<br />
	<input type="text" name="name" value="' . $row['name'] . '" size="50" /><p>
	Email:<br />
	<input type="text" name="email" value="' . $row['email'] . '" size="50" /><p>
	Website:(Remember the http://)<br />
	<input type="text" name="website" value="' . $row['website'] . '" size="50" /><p>
	Location:<br />
	<input type="text" name="location" value="' . $row['location'] . '" size="50" /><p>
	Occupation:<br />
	<input type="text" name="job" value="' . $row['job'] . '" size="50" /><p>
	About Me:<br />
	<textarea name="aboutme" rows="5" cols="50">'. $row['aboutme'] . '</textarea><p>
	AIM:<br />
	<input type="text" name="aim" value="' . $row['aim'] . '" size="50" /><p>
	MSN:<br />
	<input type="text" name="msn" value="' . $row['msn'] . '" size="50" /><p>
	Skype:<br />
	<input type="text" name="skype" value="' . $row['skype'] . '" size="50" /><p>
	Yahoo:<br />
	<input type="text" name="yahoo" value="' . $row['yahoo'] . '" size="50" /><p>';
	if ($row['oauth_provider'] == "" || empty($row['oauth_provider'])) {
	echo 'Password:(leave blank if no change)<br />
	<input type="text" name="password" /><p>';
	}
	echo'<input type="submit" name="settings" value="Update" />
	</form></div></td>
	  </tr>
	</table>';
}
?>