View file wap/upload.php

File size: 5.32Kb
<?php
include("inc/func.inc.php");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-cache, must-revalidate");
header("Pragma: no-cache");
echo "<?xml version=\"1.0\"?>\n";
echo "<!DOCTYPE html PUBLIC \"-//WAPFORUM//DTD XHTML Mobile 1.0//EN\" \"http://www.wapforum.org/DTD/xhtml-mobile10.dtd\">\n";
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<?php
  if(!db()){
  echo "<head>";
  echo "<title>RemiXchaT.CoM - World Wide Chat Community And Downloads !</title>";
  include("inc/css.inc.php");
  echo "</head>";
  echo "<body>";
  echo getdberror();
  echo "</body>";
  echo "</html>";
  exit();
  }

  $show = $_GET["show"];
  $hits = $_GET["hits"];
  $page = $_GET["page"];
  $who = $_GET["who"];
  $uid = getuid_hits($hits);
  $uip = getip();
  $ubr = $_SERVER['HTTP_USER_AGENT'];
  cleardata();
  addvisitor();

  if(isipbanned($uip,$ubr)){
  if(!isshield(getuid_hits($hits))){
  echo "<head>";
  echo "<title>RemiXchaT.CoM - World Wide Chat Community And Downloads !</title>";
  include("inc/css.inc.php");
  echo "</head>";
  echo "<body>";
  echo getipbanned($uip, $ubr);
  echo "</body>";
  echo "</html>";
  exit();
  }
  }

  if(($show != "") && ($show != "terms")){
  $uid = getuid_hits($hits);
  if((islogged($hits)==false)||($uid==0)){
  echo "<head>";
  echo "<title>RemiXchaT.CoM - World Wide Chat Community And Downloads !</title>";
  include("inc/css.inc.php");
  echo "</head>";
  echo "<body>";
  echo getsesexplog();
  echo "</body>";
  echo "</html>";
  exit();
  }
  }

  if((isbanned($uid))&&($uid != '0')){
  echo "<head>";
  echo "<title>RemiXchaT.CoM - World Wide Chat Community And Downloads !</title>";
  include("inc/css.inc.php");
  echo "</head>";
  echo "<body>";
  echo getbanned($uid);
  echo "</body>";
  echo "</html>";
  exit();
  }


   $info = $_POST["info"];
   $type = $_POST["type"];


if($show=="uploader")
{

addonline(getuid_hits($hits),"Upload Picture","");
                echo "<head>";
  echo "<title>RemiXchaT.CoM - World Wide Chat Community And Downloads !</title>";
  include("inc/css.inc.php");
 echo "</head>";
 echo "<body>";
 echo "<div class=\"box_cen\" align=\"center\">";
$uid = getuid_hits($hits);
echo "<b>Upload Images</b></div>";
 echo "<div class=\"box_sub\" align=\"center\">";
echo "Max Image Size Is 1MB</div>";
 echo "<div class=\"box_cen\" align=\"center\">";
 echo "<div class=\"box_sub\" align=\"center\">";
 $file = $_FILES['filetoupload']['tmp_name'];
 $file_name = $_FILES['filetoupload']['name'];
 $file_size = $_FILES['filetoupload']['size'];

//get file name
if ($upload="upload"&&$file_name){

if (!eregi("\.(jpeg|jpg|gif|png)$",$file_name)){
print "<b>Unsuported Image File!!!</b>";
}else{
$file_name = preg_replace(
             '/[^a-zA-Z0-9\.\$\%\'\`\-\@\{\}\~\!\#\(\)\&\_\^]/'
             ,'',str_replace(array(' ','%20','.php'),array('_','_',''),$file_name));
if(strlen($file_name)>53){ print "<b>Image Name To Long!!!</b>";
}else{
 $size = round($file_size/1024,1);
if (round($size)>1024) {
print "<b>Image Over Limit!!!</b>";
}else{
if (empty($file_name)) {
print "<b>No Input Image Specified!!!</b>";
}else{

if(file_exists("ugallery/$file_name"))
	{
			echo "Image Like That Name Already Exists";
                  echo "</div><a href=\"usergallery.php?show=main&amp;hits=$hits\">Gallery</a></div>";
 echo footerweb($hits);
                  print "</body></html>";
			exit();
			}

  $userinfo = mysql_fetch_array(mysql_query("SELECT name, sex FROM mx_users WHERE id='".$uid."'"));

$imageurl = "ugallery/$file_name";

 $super = round($file_size/1024,1);
 $fsize = round($super);
copy("$file", "ugallery/$file_name") or
die("Couldn't copy file.");

 $res = mysql_query("INSERT INTO mx_usergallery SET uid='".$uid."', imageurl='".$imageurl."', sex='".$userinfo[1]."', udate='".time()."', info='".$info."', type='".$type."', filesize='".$fsize." KB'");    

if ($res) {
          echo "$file_name Has Been Added To Your Gallery";

         } else {

              echo "Please Try Again";
           }
}
}
}
}
}

echo "<hr>";

?>

<?php
echo "<form action=\"upload.php?show=uploader&amp;hits=$hits\" method=\"post\" ENCTYPE=\"multipart/form-data\">
<p align=\"center\">";
    echo "Save To Album<br/><select name=\"type\" value=\"$type\">";

    echo "<option value=\"0\">My Photo</option>";
    echo "<option value=\"1\">My Family</option>";
    echo "<option value=\"2\">My Friend</option>";
    echo "<option value=\"3\">My Favourite</option>";
    echo "<option value=\"4\">My Others</option>";
    echo "</select><br/>
Image Infos<br/><input type=\"info\" name=\"info\" size=\"12\" value=\"N o N e !\"/><br/>
Select Image <br/><input type=\"file\" name=\"filetoupload\" size=\"13\"/><br/>
<input type=\"submit\" value=\"Upload\"/></form></div></div>";
 echo "<div class=\"box_sub\" align=\"center\">";
 echo "Allow Files: .jpg, .gif, .png</div>";
 echo "<div class=\"box_cen\" align=\"center\">";
 echo "<div class=\"box_sub\" align=\"center\">";
 echo "<a href=\"usergallery.php?show=viewgaluser&amp;who=$uid&amp;hits=$hits\">My Album</a><br/>";
 echo "<a href=\"usergallery.php?show=main&amp;hits=$hits\">Main Gallery</a></div></div>";
 echo footerweb($hits);
}
echo "</body>
</html>";
?>