<?php
    include ("connect.php");
    $_SESSION['username']="kai";
    $username=$_SESSION['username'];
    echo "Welcome,".$username."!<p>";
    $query= mysql_query("Select * from avatar where name = 'username'");

    if(mysql_num_rows($query)==0)
        die("User not found");
    else
    {
        $row = mysql_fetch_assoc($query);
        $location = $row['imagelocation'];
        echo "<img src='$location' width='200' height ='200'>.</p>";
    }
?>
<p/> Upload New Avatar
<form method="post" enctype='multipart/form-data' action='view.php'>
    File: <input type='file' name='myfile'>
    <input type='submit' name = 'submit' value='UPLOAD'>
</form>