Jump to content
xisto Community
Sign in to follow this  
wappy

Help Needed With Silly Error

Recommended Posts

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:

<?/** ** @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://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 12if ($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&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>
:)

Share this post


Link to post
Share on other sites

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.

Edited by wappy (see edit history)

Share this post


Link to post
Share on other sites
if ($pagedisplay==$pages){$pagedisplay="Last";}

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

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

Share this post


Link to post
Share on other sites

$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:
$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.)

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().

Share this post


Link to post
Share on other sites

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:

<?/** ** @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&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)&sid=$sid\">[Go]</a></small>";if ($page<$pages){echo "<br/><small><a href=\"".$_SERVER["PHP_SELF"]."?page=$pages&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&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 (";, "", $path);echo "<br/><small>$path</small>";			}		closedir($dp);		echo "<small><br/>©2006 JACK THE RIPPER</small>";		?>			</p></card> </wml> 
Edited by wappy (see edit history)

Share this post


Link to post
Share on other sites

Well (int) is not a function.If you place this before anything PHP will convert it to an integer even though it is a string .But it must be numeric.Non numeric characters will make it value to Zero.It is very useful for forms using GET/POST and fields whose values are to be integers.You can also convert a integer to a string by ptting before the VARIABLE (string).

Share this post


Link to post
Share on other sites

but what has this got to do with the error!? Its not that causing the error i have used it for ages. Grrr forget it.. IT IS NOTHING TO DO WITH INT CAUSING THE ERROR WHY WON'T ANYONE LISTEN. I wish i hadn't posted now sigh..

Share this post


Link to post
Share on other sites

On lines 16 and 17, are you sure you have those quotes used correctly?

 

Try using this way

echo "<?xml version=\'1.0\'?>"; echo "<!DOCTYPE wml PUBLIC \'-//WAPFORUM//DTD WML 1.1//EN\\'http://forums.xisto.com/no_longer_exists/;;

That got rid of most of my errors. But since I don't have those files it requests for I cannot test it further.

 

And line 45 and 93 it should be

<?PHP

When you need to switch from PHP script to HTML script you can use PRINT or ECHO rather than going in and out of PHP.

 

It looks like some of IF conditions are redundant at some point. But it's WAP related so I guess it could be correct.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.