Jump to content

help....


phpSensei

Recommended Posts

Line 144 is the last line.

Parse error: syntax error, unexpected $end in /home/charles/domains/antiup.net/public_html/upload2.php on line 144

<?php
//Check if any IP address's are banned
include 'ban.php';
include 'php/config.php';
include 'php/opendb.php';
//Flood Protection
if(isset($_POST['upload']))
{
$ip = $_SERVER['REMOTE_ADDR'];
$period = 10;
$delete = mysql_query("DELETE FROM `posters` WHERE `date` < '".(($now = time()) - $period)."'");
$query = mysql_fetch_array(mysql_query("SELECT * FROM posters"));
if($query['ip']==$ip){
echo '<span style="color:#B94A4A; text-decoration:blink; font-weight: bold; font-size: 24px;">Error. Flood Protection Has Not Expired.</span><br /><br />';
echo '<div align="center" class="smalltext">Copyright <a href="http://antistuff.net/">antistuff</a> 2007© All rights reserved.</div>';
exit;
}
else
{

// Variables
$width = 0;
$heigth = 0;
$filePath = "files/";
$filename = $_FILES['userfile']['name'];
$filesize = $_FILES['userfile']['size'];
$fileType = $_FILES['userfile']['type'];
$tmpName = $_FILES['userfile']['temp'];
$ip = $_SERVER['REMOTE_ADDR'];


$Type = Array( 'Bytes', 'KB', 'MB', 'GB', 'TB', 'ZB' );
$times=0;
while( $fileSize > 1024 ) {
		$fileSize = $fileSize / 1024;
		$fileSize = round($fileSize);
		$times++;
	}
//Allows uppercase filetypes.
$fileType = strtolower (strtoupper (strstr($fileName, '.')));

if(($fileType != '.gif')||($fileType != '.jpeg')||($fileType != '.jpg')||($fileType != '.png')||($fileType != '.zip')||($fileType != '.rar')||($fileType != '.doc')||
    ($fileType != '.txt')||($fileType != '.mp3')||($fileType != '.wav')||($fileType != '.avi')||($fileType!= '.mov')||($fileType != '.swf')||($fileType != '.fla')){

echo '<span style="color:#B94A4A; text-decoration:blink; font-weight: bold; font-size: 24px;">Error. Wrong FileType.</span><br /><br />';
echo '<div align="center" class="smalltext">Copyright <a href="http://antistuff.net/">antistuff</a> 2007© All rights reserved.</div>';
exit;


}
elseif($filesize > 5242880){ 

echo '<span style="color:#B94A4A; text-decoration:blink; font-weight: bold; font-size: 24px;">Error. File Too Big.</span><br /><br />';
echo '<div align="center" class="smalltext">Copyright <a href="http://antistuff.net/">antistuff</a> 2007© All rights reserved.</div>';
exit;

}
elseif(file_exists("files/".$filename)){

$r_1 = rand(1,1000);
$r_2 = rand(1000,2000);
$r_3 =  rand (3000,7000);

$filename = $r1 . $r2 . $r3 . $filename ;

}
else
{
$result = move_uploaded_file($tmpName, $filePath);

if (!$result) {

echo '<span style="color:#B94A4A; text-decoration:blink; font-weight: bold; font-size: 24px;">Error. Try Again.</span><br /><br />';
echo '<div align="center" class="smalltext">Copyright <a href="http://antistuff.net/">antistuff</a> 2007© All rights reserved.</div>';
exit;

}

elseif(!get_magic_quotes_gpc())
{
$filename = addslashes($filename);
$filepath = addslashes($filepath);

}
if(($fileType == '.gif')||($fileType == '.jpeg')||($fileType == '.jpg')||($fileType == '.png')||($fileType == '.swf')){

list($width, $height, $type, $attr) = getimagesize("files/".$filename);


}

$date = time();

mysql_query("INSERT INTO posters (ip,date) VALUES ('$ip','$date')") or die(mysql_error());

mysql_query("INSERT INTO upload (name, size, type, ip, path, width, height) VALUES ('$fileName', '$fileSize', '$fileType', '$ip', '$filePath', '$width', '$height')") or die('Error, query failed : ' . mysql_error());

$newfilePath = str_replace(' ','%20',$filePath);
$finddetails = mysql_query("SELECT * FROM upload ORDER BY id DESC LIMIT 1");
$filedetails = mysql_fetch_array($finddetails);
$id2 = $filedetails['id'];
echo '<span style="color:#8FC73D; text-decoration:blink; font-weight: bold; font-size: 24px;">Success</span><br />';
echo "Direct Link: <a href=". $newfilePath .">$fileName</a><br />";


if (($fileType == '.gif')|| ($fileType == '.jpeg') || ($fileType == '.jpg') || ($fileType == '.png') || ($fileType == '.mp3') || ($fileType == '.wav') || ($fileType == '.swf')){
echo "Share Link: <a href=". $websiteview . $id2 .">$fileName</a><br />";
//Size

$Type = Array( 'Bytes', 'KB', 'MB', 'GB', 'TB', 'ZB' );
$times=0;

while( $fileSize > 1024 ){
		$fileSize = $fileSize / 1024;
		$fileSize = round($fileSize);
		$times++;
}

echo 'Size: ';
echo $fileSize.' '.$Type[$times];
echo '<br /><br />';

}
//Images display an image below information.
elseif (($fileType == '.gif')||($fileType == '.jpeg')||($fileType == '.jpg')||($fileType == '.png')){

echo "<img src=". $newfilePath ."><br /><br />";

}
//Swfs display an embedded Swf below information.
elseif ($fileType == '.swf'){ 

echo "<embed src=". $newfilePath ." width=". $width ." height=". $height ."><br /><br />";

}
}
}
?>

Link to comment
Share on other sites

indent your code (tab) always have our code like this


if(){ 
      //tab here
      if(){
            if(){
            }
      }
}
else{
     //tab here
}

 

indent your code and post it back even if someone solved this thread you will always encounter this problem

Link to comment
Share on other sites

EDIT: Beat to it :P

 

Indent your code and it will be much easier to see

 

<?php
//Check if any IP address's are banned
include 'ban.php';
include 'php/config.php';
include 'php/opendb.php';
//Flood Protection
if (isset($_POST['upload'])) {
    $ip = $_SERVER['REMOTE_ADDR'];
    $period = 10;
    $delete = mysql_query("DELETE FROM `posters` WHERE `date` < '".(($now = time()) - $period)."'");
    $query = mysql_fetch_array(mysql_query("SELECT * FROM posters"));
    if ($query['ip']==$ip) {
        echo '<span style="color:#B94A4A; text-decoration:blink; font-weight: bold; font-size: 24px;">Error. Flood Protection Has Not Expired.</span><br /><br />';
        echo '<div align="center" class="smalltext">Copyright <a href="http://antistuff.net/">antistuff</a> 2007© All rights reserved.</div>';
        exit;
    } else {
        
        // Variables
        $width = 0;
        $heigth = 0;
        $filePath = "files/";
        $filename = $_FILES['userfile']['name'];
        $filesize = $_FILES['userfile']['size'];
        $fileType = $_FILES['userfile']['type'];
        $tmpName = $_FILES['userfile']['temp'];
        $ip = $_SERVER['REMOTE_ADDR'];
        
        
        $Type = Array('Bytes', 'KB', 'MB', 'GB', 'TB', 'ZB' );
        $times=0;
        while ($fileSize > 1024 ) {
            $fileSize = $fileSize / 1024;
            $fileSize = round($fileSize);
            $times++;
        }
        //Allows uppercase filetypes.
        $fileType = strtolower(strtoupper(strstr($fileName, '.')));
        
        if (($fileType != '.gif')||($fileType != '.jpeg')||($fileType != '.jpg')||($fileType != '.png')||($fileType != '.zip')||($fileType != '.rar')||($fileType != '.doc')||
        ($fileType != '.txt')||($fileType != '.mp3')||($fileType != '.wav')||($fileType != '.avi')||($fileType!= '.mov')||($fileType != '.swf')||($fileType != '.fla')) {
            
            echo '<span style="color:#B94A4A; text-decoration:blink; font-weight: bold; font-size: 24px;">Error. Wrong FileType.</span><br /><br />';
            echo '<div align="center" class="smalltext">Copyright <a href="http://antistuff.net/">antistuff</a> 2007© All rights reserved.</div>';
            exit;
            
            
        } else if ($filesize > 5242880) {
            
            echo '<span style="color:#B94A4A; text-decoration:blink; font-weight: bold; font-size: 24px;">Error. File Too Big.</span><br /><br />';
            echo '<div align="center" class="smalltext">Copyright <a href="http://antistuff.net/">antistuff</a> 2007© All rights reserved.</div>';
            exit;
            
        } else if (file_exists("files/".$filename)) {
            
            $r_1 = rand(1,1000);
            $r_2 = rand(1000,2000);
            $r_3 =  rand(3000,7000);
            
            $filename = $r1 . $r2 . $r3 . $filename ;
            
        } else {
            $result = move_uploaded_file($tmpName, $filePath);
            
            if (!$result) {
                
                echo '<span style="color:#B94A4A; text-decoration:blink; font-weight: bold; font-size: 24px;">Error. Try Again.</span><br /><br />';
                echo '<div align="center" class="smalltext">Copyright <a href="http://antistuff.net/">antistuff</a> 2007© All rights reserved.</div>';
                exit;
                
            } else if (!get_magic_quotes_gpc()) {
                $filename = addslashes($filename);
                $filepath = addslashes($filepath);
                
            }
            if (($fileType == '.gif')||($fileType == '.jpeg')||($fileType == '.jpg')||($fileType == '.png')||($fileType == '.swf')) {
                
                list($width, $height, $type, $attr) = getimagesize("files/".$filename);
                
                
            }
            
            $date = time();
            
            mysql_query("INSERT INTO posters (ip,date) VALUES ('$ip','$date')") or die(mysql_error());
            
            mysql_query("INSERT INTO upload (name, size, type, ip, path, width, height) VALUES ('$fileName', '$fileSize', '$fileType', '$ip', '$filePath', '$width', '$height')") or die('Error, query failed : ' . mysql_error());
            
            $newfilePath = str_replace(' ','%20',$filePath);
            $finddetails = mysql_query("SELECT * FROM upload ORDER BY id DESC LIMIT 1");
            $filedetails = mysql_fetch_array($finddetails);
            $id2 = $filedetails['id'];
            echo '<span style="color:#8FC73D; text-decoration:blink; font-weight: bold; font-size: 24px;">Success</span><br />';
            echo "Direct Link: <a href=". $newfilePath .">$fileName</a><br />";
            
            
            if (($fileType == '.gif')|| ($fileType == '.jpeg') || ($fileType == '.jpg') || ($fileType == '.png') || ($fileType == '.mp3') || ($fileType == '.wav') || ($fileType == '.swf')) {
                echo "Share Link: <a href=". $websiteview . $id2 .">$fileName</a><br />";
                //Size
                
                $Type = Array('Bytes', 'KB', 'MB', 'GB', 'TB', 'ZB' );
                $times=0;
                
                while ($fileSize > 1024 ) {
                    $fileSize = $fileSize / 1024;
                    $fileSize = round($fileSize);
                    $times++;
                }
                
                echo 'Size: ';
                echo $fileSize.' '.$Type[$times];
                echo '<br /><br />';
                
            }
            //Images display an image below information.
            elseif (($fileType == '.gif')||($fileType == '.jpeg')||($fileType == '.jpg')||($fileType == '.png')) {
                
                echo "<img src=". $newfilePath ."><br /><br />";
                
            }
            //Swfs display an embedded Swf below information.
            elseif ($fileType == '.swf') {
                
                echo "<embed src=". $newfilePath ." width=". $width ." height=". $height ."><br /><br />";
                
            }
        }
    }
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.