Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Help Needed With Silly Error
wappy
post Sep 27 2006, 02:16 AM
Post #1


Premium Member
********

Group: Members
Posts: 164
Joined: 2-July 06
From: England
Member No.: 25,974



Hi i have made a stupid error on one of my pages and having trouble finding it. It says unexpected ')' on line 114 can anyone please help me find it? Here is the page:
CODE

<?
/**
*
* @package TibiaME Clan/Download Site
* @version 1.00 2006/09/27 00:04:37 wappy
* @copyright (c)2004-2006 wappyCULT
* @home http://hack.s-60.org
* @license You can use/modify this script but distributing it without permisinn, or removing the "Script By: wappy" link will invalidate your license and give wappy (wappyCULT) FULL RIGHTS to request removal of the script from your server
* @licensed to Jack The Ripper
* @wapsite http://tibia.s-60.org
* @thanks to Jon Roig and Sadhu
*
*/
Include ('data/function_dskspace.php');
header("Content-type: text/vnd.wap.wml");
echo "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""." \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
// sadhu's genius 1 line error fix starts
$page = $_GET["page"];
// sadhu's genius 1 line error fix ends
//items per page
$conf["items_per_page"] = 10;
//in this put the above amount plus the number of folders in root i have two folders in my root, data and cgi-bin so i put 12
if ($page=="0"){$conf["items_per_page"] = 12;}
if (!isset($page)) {$page = 0;}
$user = explode ('/', $HTTP_USER_AGENT);

if(!($dp = opendir("./"))) die ("Cannot open ./");
$file_array = array();
while ($file = readdir ($dp))
{
if(substr($file,0,1) != '.' and $file != "index.php")
  {
  $file_array[] =  $file;
  }
}
$file_count = count ($file_array);
sort ($file_array);
?>
<wml>
<card id="card1" title="TIBIA CLAN">
<p align ="center" mode="nowrap">
<img src="tibiame_small_logo.jpg" alt="TIBIA CLAN"/></p><p align ="left" mode="nowrap">
  <?
if ($file_count=="0"){echo "<small>Sorry there are $file_count files in this folder!</small>";}  
  if ($file_count > 0)   {   $first_record = $page * $conf["items_per_page"];   $last_record = $first_record + $conf["items_per_page"];  
   while (list($fileIndexValue, $file_name) = each ($file_array))
    {

    if (($fileIndexValue >= $first_record) AND ($fileIndexValue < $last_record))
     {
//icon code
$icon = "data/unknown.gif";
$rev = strrev ($file_name);
$exp = explode (".", $rev);
$true = strrev ($exp[0]);
$trueext = strtolower ($true);
if ($trueext=="zip" OR $trueext=="rar" OR $trueext=="gz"){$icon = "data/zip.gif";}
if ($trueext=="amr"){$icon = "data/amr.gif";}
if ($trueext=="midi"){$icon = "data/midi.gif";}
if ($trueext=="mid"){$icon = "data/mid.gif";}
if ($trueext=="gif"){$icon = "data/gif.gif";}
if ($trueext=="jpeg"){$icon = "data/jpeg.gif";}
if ($trueext=="jpg"){$icon = "data/jpg.gif";}
if ($trueext=="jad"){$icon = "data/jad.gif";}
if ($trueext=="jar"){$icon = "data/jar.gif";}
if ($trueext=="sis"){$icon = "data/sis.gif";}
if ($trueext=="bmp"){$icon = "data/bmp.gif";}
if ($trueext=="wbmp"){$icon = "data/wbmp.gif";}
if ($trueext=="txt"){$icon = "data/txt.gif";}
if ($trueext=="avi"){$icon = "data/avi.gif";}
if ($trueext=="thm"){$icon = "data/thm.gif";}
if ($trueext=="nth"){$icon = "data/nth.gif";}
if ($trueext=="png"){$icon = "data/png.gif";}
if ($trueext=="mmf"){$icon = "data/mp4.gif";}
if ($trueext=="wav"){$icon = "data/wav.gif";}
if (is_dir($file_name)){$show="no";}else{$show="yes";}
if ($show=="yes"){
//show file links
$kb="kb";
//get rid of ext
$linkname = str_replace ($trueext, "", $file_name);

$number=($fileIndexValue+1);
$size = round(filesize($file_name)/1024,1);     echo "<small><a href=\"$file_name\"><img src=\"$icon\" alt=\"$number\"/>$linkname ($size$kb)</a></small><br/>";}
     $total = $total + filesize($file_name);
     }

    }
?>
</p><p align ="center" mode="nowrap">
<?
$pages =(int) ceil($file_count / $conf["items_per_page"]);
$pages = ($pages -1);
if ($pages>0){ echo "<br/>";}  
   if (($file_count > 0) AND ($page != 0))
    {
    // previous button
    $prev_page = $page -1;
    echo "<small><a href=\"".$_SERVER["PHP_SELF"]."?page=$prev_page\">«Prev</a></small>";
    }
  
   if (($file_count > 0) AND ($last_record < $file_count))
    {
    // next button
    $next_page = $page + 1;
if ($page=="0"){$break="";}else{$break="|";}    echo "$break<small><a href=\"".$_SERVER["PHP_SELF"]."?page=$next_page&amp;sid=$sid\">Next»</a></small>";
    }
if ($page>$pages){echo "<br/><small><br/>This page does not exist!</small>";}

//page display on site
$pagedisplay = $page;
if ($pagedisplay=="0"){$pagedisplay="Home";}
if ($pagedisplay==$pages){$pagedisplay="Last";}

//space code
$space = dskspace ('./');
$space = round ($space/1024000,1);
$total = round ($total/1024000,1);
$mb = "mb";

if($pages>2){echo "<small><br/><br/>Page ($pagedisplay|$total$mb)<br/><br/>Jump (0-$pages):</small><br/>";}
if($pages>2)print "<input emptyok=\"true\" name=\"jump\" format=\"*N\" size=\"3\" value=\"\" /><small><a href=\"".$_SERVER["PHP_SELF"]."?page=$(jump)\">[Go]</a></small>";
if ($page<$pages){echo "<br/><small><a href=\"".$_SERVER["PHP_SELF"]."?page=$pages\">Last Page</a></small>";}
if ($page=="0" AND $file_count>10){echo "<br/>";}
if ($page>0){echo "<br/><small><a href=\"".$_SERVER["PHP_SELF"]."?page=0\">Home</a><br/></small>";}      

echo "<small><br/>$file_count </small>";

echo "<small>Files ($space$mb)<br/></small>";

echo "<br/><small>Script By: <a href=\"http://hack.s-60.org\">wappy</a><br/><u>tibia.</u><a href=\"http://hack.s-60.org\">hack.s-60.org</a></small>";


   }

  closedir($dp);

  echo "<small><br/>©2006 Jack The Ripper</small>";

?>

</p>
</card> </wml>

mad.gif
Go to the top of the page
 
+Quote Post
jlhaslip
post Sep 27 2006, 02:26 AM
Post #2


A computer once beat me at chess, but it was no match for me at kick boxing.
Group Icon

Group: [MODERATOR]
Posts: 3,882
Joined: 24-July 05
From: In Trouble Again... still?
Member No.: 9,787
Spam Patrol



which is line 114 and is it a php error?
Go to the top of the page
 
+Quote Post
wappy
post Sep 27 2006, 02:38 AM
Post #3


Premium Member
********

Group: Members
Posts: 164
Joined: 2-July 06
From: England
Member No.: 25,974



yes its a php syntax error. I don't know what is line 140 this is one of the reasons im asking for help. It says unexpected ')' on line 114.

This post has been edited by wappy: Sep 27 2006, 02:41 AM
Go to the top of the page
 
+Quote Post
Saint_Michael
post Sep 27 2006, 07:25 AM
Post #4


$p4m 0n j00 $h4m3 m3 0nc3 $p4m 0n m3 $h4m3 m3 7\/\/1c3
*********************

Group: [HOSTED]
Posts: 6,309
Joined: 21-September 04
From: 9r33|\| 399$ 4|\|D 5P4/\/\
Member No.: 1,218
T17 GFX Crew



CODE

if ($pagedisplay==$pages){$pagedisplay="Last";}


thats your line 114 try this to see if it works.

CODE

if {$pagedisplay==$pages}{$pagedisplay="Last";}
Go to the top of the page
 
+Quote Post
jlhaslip
post Sep 27 2006, 08:13 AM
Post #5


A computer once beat me at chess, but it was no match for me at kick boxing.
Group Icon

Group: [MODERATOR]
Posts: 3,882
Joined: 24-July 05
From: In Trouble Again... still?
Member No.: 9,787
Spam Patrol



QUOTE
$pages =(int) ceil($file_count / $conf["items_per_page"]);


This line may be the source of the problem.

The intval function is defined on the php.org site. There is no int() in php that I can find.
It appears that you are trying to use (int) instead of the correct function and the parser may be getting confused about matching the braces/brackets/what_ever_they_are_called.

try using:
CODE

$pages = intval( ceil($file_count / $conf["items_per_page"]);


*edit*
Dang, that php manual is big.
Type casting is what you were doing. I see that now.
Anyway, I'll try again...

(might want to try my suggestion anyway, in case it works???
It should perform the same task as the type casting.)
QUOTE(php manual)
To explicitly convert a value to integer, use either the (int) or the (integer) cast. However, in most cases you do not need to use the cast, since a value will be automatically converted if an operator, function or control structure requires an integer argument. You can also convert a value to integer with the function intval().
Go to the top of the page
 
+Quote Post
wappy
post Sep 27 2006, 09:06 AM
Post #6


Premium Member
********

Group: Members
Posts: 164
Joined: 2-July 06
From: England
Member No.: 25,974



mmm no.. Look i literally just made a simple typo.. Like i pressed delete on something or missed a ; or a " or something?? All that stuff said above is very confusing. It works fine and is just a typo i done it while i was tired and changing layout. Sigh.. Lol
___
don't know if this will help anyone find the error but here is an older version of the page that im using older working version and here is the working page. Ignore the square symbols they are enters, this might help show what is NOT the error for elimination:
CODE

<?
/**
*
* @package tibia clan site
* @version 1.00 2006/09/12 21:53:27 JACK THE RIPPER
* @copyright (c)2006 JACK THE RIPPER
* @license FREE
* @wapsite http://hack.s-60.org
*
*/

/**
*/
Include ('data/function_dskspace.php');
header("Content-type: text/vnd.wap.wml");
echo "<?xml version=\"1.0\"?>";
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""." \"http://www.wapforum.org/DTD/wml_1.1.xml\">";
$page = $_GET["page"];
$conf["items_per_page"] = 10;
if (!isset($page)) {$page = 0;}
$user = explode ('/', $HTTP_USER_AGENT);

if(!($dp = opendir("./"))) die ("Cannot open ./");
$file_array = array();
while ($file = readdir ($dp))
    {
    if(substr($file,0,1) != '.' and $file != "index.php")
        {
        $file_array[] =  $file;
        }
    }
$file_count = count ($file_array);
sort ($file_array);
?>
<wml>
<card id="card1" title="TIBIA CLAN">
    <p align ="center" mode="nowrap">
<img src="tibiame_small_logo.jpg" alt="TIBIA CLAN"/><br/>---</p><p align ="left" mode="nowrap">
        <?
if ($file_count=="0"){echo "<small>Sorry there are $file_count files in this folder!</small>";}        
        if ($file_count > 0)
            {
            $first_record = $page * $conf["items_per_page"];
            $last_record = $first_record + $conf["items_per_page"];
            
            while (list($fileIndexValue, $file_name) = each ($file_array))
                {
                


                if (($fileIndexValue >= $first_record) AND ($fileIndexValue < $last_record))
                    {
//icon code
$icon = "data/unknown.gif";
$rev = strrev ($file_name);
$exp = explode (".", $rev);
$true = strrev ($exp[0]);
$trueext = strtolower ($true);
if ($trueext=="zip" OR $trueext=="rar" OR $trueext=="gz"){$icon = "data/zip.gif";}
if ($trueext=="amr"){$icon = "data/amr.gif";}
if ($trueext=="midi"){$icon = "data/midi.gif";}
if ($trueext=="mid"){$icon = "data/mid.gif";}
if ($trueext=="gif"){$icon = "data/gif.gif";}
if ($trueext=="jpeg"){$icon = "data/jpeg.gif";}
if ($trueext=="jpg"){$icon = "data/jpg.gif";}
if ($trueext=="jad"){$icon = "data/jad.gif";}
if ($trueext=="jar"){$icon = "data/jar.gif";}
if ($trueext=="sis"){$icon = "data/sis.gif";}
if ($trueext=="bmp"){$icon = "data/bmp.gif";}
if ($trueext=="wbmp"){$icon = "data/wbmp.gif";}
if ($trueext=="txt"){$icon = "data/txt.gif";}
if ($trueext=="avi"){$icon = "data/avi.gif";}
if ($trueext=="thm"){$icon = "data/thm.gif";}
if ($trueext=="nth"){$icon = "data/nth.gif";}
if ($trueext=="png"){$icon = "data/png.gif";}
if ($trueext=="mmf"){$icon = "data/mp4.gif";}
if ($trueext=="wav"){$icon = "data/wav.gif";}
if (is_dir($file_name)){$show="no";}else{$show="yes";}
if ($show=="yes"){
//show file links
$kb="kb";    
$number=($fileIndexValue+1);
$size = round(filesize($file_name)/1024,1);                    echo "<small><a href=\"$file_name\"><img src=\"$icon\" alt=\"$number\"/>$file_name ($size$kb)</a></small><br/>";}
                    $total = $total + filesize($file_name);
                    }

                }
?>
</p><p align ="center" mode="nowrap">
<?

$pages =(int) ceil($file_count / $conf["items_per_page"]);
$pages = ($pages -1);
if ($pages>0){ echo "<small>---</small><br/>";}            
            if (($file_count > 0) AND ($page != 0))
                {
                // previous button
                $prev_page = $page -1;
                echo "<small><a href=\"".$_SERVER["PHP_SELF"]."?page=$prev_page\">«Prev</a></small>";
                }
            
            
            if (($file_count > 0) AND ($last_record < $file_count))
                {
                // next button
                $next_page = $page + 1;
                echo "|<small><a href=\"".$_SERVER["PHP_SELF"]."?page=$next_page&amp;sid=$sid\">Next»</a></small>";
                }


if ($page>$pages){echo "<br/><small>---<br/>This page does not exist!</small>";}
if($pages>1){echo "<small><br/>---<br/>Jump (0-$pages/$page):</small><br/>";}
if($pages>1)echo "<input emptyok=\"true\" name=\"jump\" format=\"*N\" size=\"3\" value=\"\" /><small><a href=\"".$_SERVER["PHP_SELF"]."?page=$(jump)&amp;sid=$sid\">[Go]</a></small>";
if ($page<$pages){echo "<br/><small><a href=\"".$_SERVER["PHP_SELF"]."?page=$pages&amp;sid=$sid\">Last page</a></small>";}
if ($page=="0" AND $file_count>10){echo "<br/>";}
if ($page>0){echo "<br/><small><a href=\"".$_SERVER["PHP_SELF"]."?page=0&amp;sid=$sid\">First page</a></small>";}                            

echo "<small><br/>$file_count </small>";

$space = dskspace ('./');
$space = round ($space/1024000,1);
$mb = "mb";
echo "<small>files</small>";

//find true path of this site
$docname = "" . $_SERVER [ 'SERVER_NAME' ] . $_SERVER [ 'PHP_SELF' ];
$path = dirname($docname);        
$path = str_replace ("www.", "", $path);

echo "<br/><small>$path</small>";

            }

        closedir($dp);

        echo "<small><br/>©2006 JACK THE RIPPER</small>";

        ?>
        
    </p>
</card>
</wml>



This post has been edited by wappy: Sep 27 2006, 09:50 AM
Go to the top of the page
 
+Quote Post
electron
post Sep 29 2006, 01:49 PM
Post #7


Premium Member
********

Group: Members
Posts: 162
Joined: 10-May 06
Member No.: 23,375



Well (int) is not a function.
If you place this before anything PHP