dontbeblocked Posted April 16, 2007 Share Posted April 16, 2007 I have a proxy I've been working on and I just got it uploaded and now I'm getting this error. I hope someone can help! The error says: Parse error: syntax error, unexpected T_STRING in /home/p33n0r/public_html/piss/index.php on line 45 Line 40-50: break; case 'external': switch ($data['error']) { case 1: $message = 'The URL you have tried is black listed'; break; case 2: $message = 'You spelled the URL wrong'; break; } Thanks in advance! Quote Link to comment Share on other sites More sharing options...
bsprogs Posted April 16, 2007 Share Posted April 16, 2007 From the code you have posted, I'm not quite sure. I can't really see a problem. If I remember correctly, that error is caused by incorrect use in single or double quotes. You may need to post more of the code for us to help. If you use a double quote, do you still get the error? break; case 'external': switch ($data['error']) { case 1: $message = "The URL you have tried is black listed"; break; case 2: $message = "You spelled the URL wrong"; break; } Quote Link to comment Share on other sites More sharing options...
btherl Posted April 16, 2007 Share Posted April 16, 2007 The code looks fine to me too. Can you post the entire code up to line 50? I suspect the error is earlier, but is only detected later. Quote Link to comment Share on other sites More sharing options...
dontbeblocked Posted April 16, 2007 Author Share Posted April 16, 2007 Yah thanks for the quick responses here is line 1-74 which is where the ?> is that ends the php so the problem must be in here somewhere: <?php if (basename(__FILE__) == basename($_SERVER['PHP_SELF'])) { exit(0); } echo '<?xml version="1.0" encoding="utf-8"?>'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US"> <head> <title>Google Search</title> <body bgcolor="#000000"> <!-- .style1 {color: #000000} --> </style> </head> <body onload="document.getElementById('address_box').focus()"> <div id="container"> <h1 align="center" class="style1" id="title"><font color="#FFFFFF" size="+4"><u>p33n0r</u></font></h1> <?php break; case 'error': echo '<div id="error"><p>'; switch ($data['group']) { case 'url': echo '<b>URL Error (' . $data['error'] . ')</b>: '; switch ($data['type']) { case 'internal': $message = 'Failed to connect to the specified host. ' . 'Possible problems are that the server was not found, the connection timed out, or the connection refused by the host. ' . 'YOU TYPED THE URL RONG!!'; break; case 'external': switch ($data['error']) { case 1: $message = 'that site is blacklisted'; break; case 2: $message = 'check the url i think u spelled it rong'; break; } break; } break; case 'resource': echo '<b>Resource Error:</b> '; switch ($data['type']) { case 'file_size': $message = 'THE file YOUR DOWNLOADING IS TO FREAKING MASSIVE!!!!!<br />' . 'Maxiumum permissible file size is <b>' . number_format($GLOBALS['_config']['max_file_size']/1048576, 2) . ' MB</b><br />' . 'Requested file size is <b>' . number_format($GLOBALS['_content_length']/1048576, 2) . ' MB</b>'; break; case 'hotlinking': $action = 'http://www.google.com/'; echo $action; break; } break; } echo 'somethin went rong.. try again.... <br />' . $message . '</p></div>'; break; } ?> Quote Link to comment Share on other sites More sharing options...
btherl Posted April 16, 2007 Share Posted April 16, 2007 It looks to me like that code was snipped out of a larger program. The code before that first "break;" is also required for it to function properly. That is, there should be another switch statement, but it seems to be missing. Quote Link to comment Share on other sites More sharing options...
dontbeblocked Posted April 16, 2007 Author Share Posted April 16, 2007 I did tear apart the hotlinking thing and the hotlinking now doesn't work but that is like 15 lines ahead of line 45... so... the rest i just editted the messages which shouldn't make any difference Quote Link to comment Share on other sites More sharing options...
btherl Posted April 16, 2007 Share Posted April 16, 2007 Unfortunatly it does make a difference. If any of the code before line 45 is invalid, then it can create an error that is "found" by PHP at line 45. The reason is that php is able to stumble along by pure luck until it hits something it can't understand. So, you need to fix all code before line 45 before debugging an error ON line 45. The following code is syntactically correct (though it may not do what you want it to do). All I have done is fix the syntax of the switch() by adding a dummy case at the start. <?php if (basename(__FILE__) == basename($_SERVER['PHP_SELF'])) { exit(0); } echo '<?xml version="1.0" encoding="utf-8"?>'; ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US"> <head> <title>Google Search</title> <body bgcolor="#000000"> <!-- .style1 {color: #000000} --> </style> </head> <body onload="document.getElementById('address_box').focus()"> <div id="container"> <h1 align="center" class="style1" id="title"><font color="#FFFFFF" size="+4"><u>p33n0r</u></font></h1> <?php switch($result) { case 'zxcvbnm': break; case 'error': echo '<div id="error"><p>'; switch ($data['group']) { case 'url': echo '<b>URL Error (' . $data['error'] . ')</b>: '; switch ($data['type']) { case 'internal': $message = 'Failed to connect to the specified host. ' . 'Possible problems are that the server was not found, the connection timed out, or the connection refused by the host. ' . 'YOU TYPED THE URL RONG!!'; break; case 'external': switch ($data['error']) { case 1: $message = 'that site is blacklisted'; break; case 2: $message = 'check the url i think u spelled it rong'; break; } break; } break; case 'resource': echo '<b>Resource Error:</b> '; switch ($data['type']) { case 'file_size': $message = 'THE file YOUR DOWNLOADING IS TO FREAKING MASSIVE!!!!!<br />' . 'Maxiumum permissible file size is <b>' . number_format($GLOBALS['_config']['max_file_size']/1048576, 2) . ' MB</b><br />' . 'Requested file size is <b>' . number_format($GLOBALS['_content_length']/1048576, 2) . ' MB</b>'; break; case 'hotlinking': $action = 'http://www.google.com/'; echo $action; break; } break; } echo 'somethin went rong.. try again.... <br />' . $message . '</p></div>'; break; } ?> Quote Link to comment Share on other sites More sharing options...
dontbeblocked Posted April 16, 2007 Author Share Posted April 16, 2007 YES!!!!!!!!!!!! YES YES YES!!!! *bows down to btherl and kisses his feet* omfg how can i ever repay u (that was for dramatic effects.. pretend i nvr said that..) but seriously dude.. u r awesome.. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.