Jump to content

unexpected T_STRING - help?


dontbeblocked

Recommended Posts

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!

Link to comment
Share on other sites

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;
}

Link to comment
Share on other sites

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;
}
?>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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;
}
?>

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.