extract($_GET);
extract($_POST);
require_once '../apps/pants/hankpants.php';
$loc = '//'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
if (preg_match('/www\./i',$loc)) {
header("Location: http://baltophoto.org/public.php");
exit;
}
$password = $_COOKIE['FBPscupper'];
if ($password == "7777" || $password == "7226" )
{
header("Location: http://baltophoto.org/upload.php");
exit;
}
$user="public";
/*
if (!$password)
{
$password = $_COOKIE['FBPscupper'];
}
if ($password == "7777" )
{
setcookie("FBPscupper",$password, time()+76000000,"/"); // 3 weeks
}
else
{
$currenturl = "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME'];
$kickback = "Location: login.php?actionurl=".$currenturl;
header($kickback);
exit;
}
*/
//////////////////////////////////////////////////
/// UPLOAD PROCESS
/////////////////////////////////////////////////
$description = str_replace(".jpg","",$description);
$tags = str_replace(".jpg","",$tags);
$tags = str_replace(".JPG","",$tags);
$description = str_replace(".JPG","",$description);
if (($_FILES['userfile']['name'])){
setcookie("description",$description, time()+96000000,"/");
setcookie("tags",$tags, time()+96000000,"/");
setcookie("photographername",$photographername, time()+96000000,"/");
setcookie("photographerurl",$photographerurl, time()+96000000,"/");
setcookie("photographeremail",$photographeremail, time()+96000000,"/");
setcookie("caption",$caption, time()+96000000,"/");
if (strlen($description)>500){
exit('you are using too many characters, use the back button to try again');
}
if (strlen($tags)>500){
exit('you are using too many characters, use the back button to try again');
}
if (strlen($photographername)>500){
exit('you are using too many characters, use the back button to try again');
}
if (strlen($photographerurl)>200){
exit('you are using too many characters, use the back button to try again');
}
if (strlen($caption)>700){
exit('you are using too many characters, use the back button to try again');
}
// shorten the media description
if (strlen($description)>100){
$description = substr($description,0,90);
}
$id = idclean($description);
$s = getrandom(6);
$id = $id.'-BPX'.$s;
if ($dfile) { @unlink($dfile); }
$prefs = file('prefs.php');
$filesizepref = $prefs[8];
$filesizeprefKB = $filesizepref / 1024;
$filesizeprefKB = round($filesizeprefKB, 1);
$file_size = $_FILES['userfile']['size'];
$filek = $file_size / 1024;
$filek = round($filek, 1);
//exit($_FILES['userfile'][size]." is the name");
if ($filek>4615){
exit ('FILESIZE WARNING - Your file size = '.$filek.' K
File size limit = 4615 k use the back button to select a new file.
If you need to reduce your image size, you can use a free service like pixlr');
}
if ($filek<20){
exit ('FILESIZE WARNING - Your file size = '.$filek.' K
file is too small.
');
}
if (basename($_FILES['userfile']['name'])==''){
exit ('You seem to have forgotten to attach a file.');
}
$filek = round($filek, 1);
$filek_r = $filek.' kb';
$photosize = $filek_r;
$timestamp = date('Y-m-d--').date('H-i-s');
$v9 = $timestamp;
$nameoffile = basename($_FILES['userfile']['name']);
$nameoffile = safepants($nameoffile);
$nameoffile = idclean($nameoffile);
$nameoffile = strtolower($nameoffile);
if (!preg_match('/(\.jpg|\.jpeg|\.jpe)/ism',$nameoffile)){
echo 'File does not seem to be of the correct type, use the back button and try another file.
If you need to reduce your image size, you can use a free service like pixlr';
exit;
}
$extension = substr($nameoffile, strrpos($nameoffile,'.'), strlen($nameoffile));
$rawname = str_replace($extension,'',$nameoffile);
$nameoffile = $id.$extension;
$newname = $nameoffile;
$uploaddir = './';
$uploadfile = $uploaddir . $newname;
$target_path = './publicuploads54/' . $newname;
$photo = $newname;
//chmod($target_path, 0640);
$domain = 'baltophoto.org';
$filepath = $_SERVER['SCRIPT_NAME'];
$lastslash = strrpos($filepath,"/");
$path = substr($filepath, 0, $lastslash);
$dirurl = "http://".$domain . $path."/";
if(basename($_FILES['userfile']['name'])!="") { // this draws the photo in if they uploaded one
$displayphoto = $dirurl.$photo;
$v8 = $dirurl.'uploads/'.$newname;
$photourl = $dirurl.'uploads/'.$newname;
$displaycode = '';
$formfill = '