<?php
//v3.1 www.exoops.info 2006/03
##################################################################################
# Friend Finder for e-xoops  Version 3.02 beta                                 #
#                                                                                #
# Script design  : PhpMeet  :   Copyright 2002 Jeremy Ross-webmaster@phprank.com #
# Created 15/01/02              Last Modified 15/01/02                           #
# Scripts Home              :   http://www.jrscripts.com                         #
#                                                                                #
# Xoops-RC2 French Version  :   jokerman@free.fr                                 #
# Web Home                     :   http://www.webetfric.com                      #
#                                                                                #
# Xoops-RC2 English Version :          Neon@neon.qldgamers.com                   #
# Web Home                  :   http://neon.qldgamers.com                        #
#                                                                                #
#                 Redesigned and new improvemends by                             #
#        eagle81 Manuel Caballero       Manuel@dancepartner.net                  #
#                    http://www.dancepartner.net                                 #
#                             2002-09-12                                         #
##################################################################################
// ORIGINAL FILE INFO
include("../../../mainfile.php");
include(XOOPS_ROOT_PATH."/header.php");
include(XOOPS_ROOT_PATH."/modules/friendfinder/header.php");
include(XOOPS_ROOT_PATH."/modules/friendfinder/cache/config.php");
global $dateformat, $autoactive, $imagesize, $heightunit, $weightunit, $XoopsTheme,$xoopsUser;
$username=$xoopsUser->uname("E");
$xoopsOption['show_rblock'] =1;
        OpenTable();
//************************************************************
$sql = "SELECT * FROM ".$db->prefix("friendfinder")." WHERE user = '$username'";
$result = $db->query($sql);
while ($i = $db->fetchArray($result))
 {
$imgname = $i[imgname];
$imgtime = $i[imgtime];
$id = $i[id];
$img = $i[pic];
}
if ($page == update) {
if ($file1_name == "") {
die("No File!!");
}
    if ($file1_type!="image/pjpeg" && $file1_type!="image/gif"){
    echo ""._FILEFORMAT."";
    include "../admin/foot.php";
    die;
    }
        if ($MAX_FILE_SIZE) {
         echo ""._FILESIZE."";
         include "../admin/foot.php";
         die;
         }
// Delete file in dir
unlink ("../members/uploads/$imgtime/$imgname");
// Delete dir
rmdir ("../members/uploads/".$imgtime."");
// make new dir
$time = time();
mkdir ("../members/uploads/$time", 0777);
// place new file in dir
copy("$file1", "../members/uploads/$time/$file1_name");
// update new recored
$pic = XOOPS_URL."/modules/friendfinder/members/uploads/".$time."/".$file1_name;
$sql2 = "UPDATE ".$db->prefix("friendfinder")." SET imgtime='$time', imgname='$file1_name', pic='$pic' WHERE user = '$username'";
$db->query($sql2);
echo _TEXTUPLOADSUCCESS;
} else {
echo "<center>"._TEXTPICCURRENT."<br><img src='$img' border=0><br><br></center>";
echo "<center><form action=pic.php?page=update&username=$username method=post enctype='multipart/form-data'>
Foto:<input type=file class='file' name=file1><br><INPUT TYPE=hidden name=MAX_FILE_SIZE value=$imagesize></input>";
echo"<input type=submit class='butotn' value=\""._TEXTPICBUTTON."\"></form></center>";
}
include "../admin/foot.php";
//************************************************************
        CloseTable();
include("../../../footer.php");
?>
