View Single Post
Old 09-24-2007, 03:46 PM   #8 (permalink)
luk3
The Visitor
 
Join Date: Sep 2007
Posts: 4
Thanks: 0
luk3 is on a distinguished road
Default

*EDIT* i think this is where the image upload is

Quote:

function is_uploaded_fil($filename) { // function for PHP versions < 4.0.3

if (!$tmp_file = get_cfg_var('upload_tmp_dir')) {
$tmp_file = dirname(tempnam('', ''));
}
$tmp_file .= '/' . basename($filename);
return (ereg_replace('/+', '/', $tmp_file) == $filename);
}


$username = strtolower($username);
if(!$username) { $message .= NOUSERNAME."<br>";}
if(!$password) { $message .= NOPASS."<br>"; }
if(!$email == "" && (!strstr($email,"@") || !strstr($email,"."))) $message .= ENTEREMAIL."<BR>";

if ($submitpic != "no" ) {if((strlen($url) <= 8) && !$userpic) $message .= NOURL."<br>"; }

// if(!$age) $message .= "Your age was not entered.<br>";
if(!$category) $message .= NOCAT."<br>";
if ($submitpic != "no") {if(!$describe) $message .= NODESCRIP."<br>";}
if(!$self) $self=5;
if (userexists($username)) $message .= USEREXISTS."<br>";
if (sitexists($url) && !$userpic && $submitpic != "no") $message .= IMGEXISTS."<br>";
if (isset($aself)) $message .= "<br><ID#>";
$resize = "no";
if (!isset($submitpic)) $submitpic ="yes";

if ($submitpic == "yes" && !$message ) {

if (strlen($url) <= 8 && $allowupload != 0 ) { // begin file upload routine
$source = $HTTP_POST_FILES['userpic']['tmp_name'];
$dest = '';
if (($source != 'none') && ($source != '' )) {
$newfile = uniqid('img').'';
$dest = $uploadpath.$newfile;
if (ereg( "[4-9]\.[0-9]\.[3-9].*", phpversion() ) || ereg( "[4-9]\.[1-9]\.[0-9].*", phpversion() )) {
if ( $dest != '' ) {
if ( move_uploaded_file( $source, $dest ) ) {$url = $uploadurl.$newfile;}
else $message .= FILENOTSTORED."<BR>";
if (isset($chmod)) chmod ($dest, 0755); // some servers will require this line
}
}else {
if ( $dest != '' ) {
if (is_uploaded_fil($source)) { copy($source, $dest); $url = $uploadurl.$newfile;}
if (isset($chmod)) chmod ($dest, 0755); // some servers will require this line
}
}

}
else $message = FILETOOBIG;

$imagesize = @getimagesize($dest);
switch ( $imagesize[2] ) {
case 1:
rename($dest, $dest.".gif");
$url.= ".gif";
break;
case 2:
rename($dest, $dest.".jpg");
$url.= ".jpg";
$dest .= ".jpg";
addlogo();
$jpg = 1;
break;
case 3:
rename($dest, $dest.".png");
$url.= ".png";
break;
default:
$message = INVALIDIMG;
@unlink($dest);
break;
}


if ( $imagesize[0] > $imgsize) $resize = "yes";
if ( $source_size > ($uploadsize * 1024) ) $message .= FILETOOBIG;
if ( filesize($dest) > ($uploadsize * 1024) ) { unlink($dest); $message .= FILETOOBIG; }

} // end file upload routine
}

Last edited by luk3 : 09-24-2007 at 04:34 PM.
luk3 is offline  
Reply With Quote