View file chat spall script/web/upload.htm

File size: 4.4Kb
<?php
include("config.php");
include("core.php");
include("xhtmlfunctions1.php");
include("themecs.php");
include("class.upload.php");

header("Content-type: text/html; charset=ISO-8859-1");
echo "<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>";
echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
?>

<?php
$bcon = connectdb();
if (!$bcon)
{
    echo xhtmlheadnotheme("$sitetitle (DB Error!)");
    echo "<p align=\"center\">";
    echo "<img src=\"images/exit.gif\" alt=\"*\"/><br/>";
    echo "</p>";
    echo xhtmlfoot();
    exit();
}

$sid = $_GET["sid"];
$uid = getuid_sid($sid);
$descript = $_POST["descript"];

if(islogged($sid)==false)
    {
      echo xhtmlheadnotheme("$sitetitle (not logged in!)");
      echo "<p align=\"center\">";
      echo "You are not logged in<br/>";
      echo "Or Your session has been expired<br/><br/>";
      echo "</p>";
      echo "<p align=\"center\">";
      echo "</p>";
      echo xhtmlfoot();
      exit();
    } 

if(isbanned($uid))
    {
      echo xhtmlheadnotheme("$sitetitle (BANNED!)");
      echo "<p align=\"center\">";
      echo "<img src=\"images/notok.gif\" alt=\"x\"/><br/>";
      echo "You are <b>Banned</b><br/>";
      $banto = mysql_fetch_array(mysql_query("SELECT timeto FROM ibwf_metpenaltiespl WHERE uid='".$uid."' AND penalty='1'"));
	  $banres = mysql_fetch_array(mysql_query("SELECT lastpnreas FROM ibwf_users WHERE id='".$uid."'"));	  
      $remain = $banto[0]- time() ;
      $rmsg = gettimemsg($remain);
      echo "Time to finish your penalty: $rmsg<br/><br/>";
	  echo "Ban Reason: $banres[0]";
      echo "</p>";
      echo xhtmlfoot();
      exit();
    }

error_reporting(E_ALL); 

$userinfo = mysql_fetch_array(mysql_query("SELECT name, sex FROM ibwf_users WHERE id='".$uid."'"));
$membername = $userinfo[0];


////////////////////////////////////////UPLOADING AND HANDLING THE IMAGE
if ($_POST['action'] == 'image')
{
      addonline(getuid_sid($sid),"Uploading Photo - xHTML:v3","");
      echo xhtmlheadnotheme("Uploading Photo");

      echo "<p align=\"center\">";

    // ---------- IMAGE UPLOAD ----------
    
    // we create an instance of the class, giving as argument the PHP object 
    // corresponding to the file field from the form
    // All the uploads are accessible from the PHP object $_FILES
    $handle = new Upload($_FILES['f1']);

    // then we check if the file has been uploaded properly
    // in its *temporary* location in the server (often, it is /tmp)
    if ($handle->uploaded) {
        
        // yes, the file is on the server
        // below are some example settings which can be used if the uploaded file is an image.
        $handle->image_resize            = true;
        $handle->image_ratio_y           = true;
        $handle->image_x                 = 200;

        // now, we start the upload 'process'. That is, to copy the uploaded file
        // from its temporary location to the wanted location
        // It could be something like $handle->Process('/home/www/my_uploads/');
        $handle->Process('../usergallery');
        
        // we check if everything went OK
        if ($handle->processed) {
            // everything was fine !

            echo '  File uploaded with success<br/>';
            echo '  <img src="'. $imgpath . '/' . $handle->file_dst_name . '" /><br/>';
            $info = getimagesize($handle->file_dst_pathname);
            $imageurl = "$imgpath/$handle->file_dst_name";
            $reg = mysql_query("INSERT INTO ibwf_usergallery SET uid='".$uid."', imageurl='".$imageurl."', sex='".$userinfo[1]."', time='".time()."', descript='".$descript."'");

        } else {
            // one error occured

            echo '  File not uploaded to the wanted location<br/>';
            echo '  Error: ' . $handle->error . '<br/>';

        }

        // we delete the temporary files
        $handle-> Clean();

    } else {
        // if we're here, the upload file failed for some reasons
        // i.e. the server didn't receive the file

        echo '  File not uploaded on the server<br/>';
        echo '  Error: ' . $handle->error . '';
    }

    echo "</p>";     
  
  echo "<p><small>";
  echo "<a href=\"index.php?action=main&amp;sid=$sid\">Home</a>";
  echo " &#62; ";
  echo "<a href=\"gallery.php?action=main&amp;sid=$sid\">Gallery</a>";
  echo " &#62; ";
  echo "Uploading Photo";
  echo "</small></p>";  
  
  echo xhtmlfoot();
}
?>