File size: 857B
<?php include "head.php"; if($_FILES["pic"]["name"]==""){ echo '<center>Error, select a picture to upload.</center>'; include 'foot.php'; exit(); } $user=$_SESSION["userName"]; if(isset($_FILES['pic']['name']))
{$pic=$_FILES["pic"]["name"]; $old=file_get_contents("gallery.data"); $f=fopen("gallery.data","w+");
fwrite($f,"<center><a href=\"prof.php?user=$user\"><b>".$_SESSION["userName"]."</b></a><br/><img src=\"pics/$pic\" width=\"50%\" height=\"50%\"/></center>");
fwrite($f,"\r\n"); fwrite($f,$old);
$name=$_FILES['pic']['name']; move_uploaded_file($_FILES["pic"]["tmp_name"],"pics/$name"); echo "<center>Photo uploaded!
<br/>You can use this as an avatar or a background image,for the url remove http:// and put <br/><input type=\"text\" value=\"pics/$pic\"/>
<br/><a href=\"index.php?page=1\">Continue...</a></center>";
}
include "foot.php"; ?>