parse error, unexpected T_CASE in redirect.php on line 63


#1

Hi,

I installed Links Manager for osC(MS2) v1.01

I thought I had it all working but my snag is:

Parse error: parse error, unexpected T_CASE in /home/totstoys/public_html/redirect.php on line 63.

I get this error when I click on the link within my links pages. I?ve tried a few things with no success and have begun searching the net but have not had any success there either. Any chance someone here can help me?


#2

Ok what is on lines 60 - 65? Generally speaking a parse error is a syntax error.


#3

Thanks for the response Lig, here is the code:

<?php /* $Id: redirect.php,v 1.10 2003/06/05 23:31:31 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); switch ($HTTP_GET_VARS['action']) { case 'banner': $banner_query = tep_db_query("select banners_url from " . TABLE_BANNERS . " where banners_id = '" . (int)$HTTP_GET_VARS['goto'] . "'"); if (tep_db_num_rows($banner_query)) { $banner = tep_db_fetch_array($banner_query); tep_update_banner_click_count($HTTP_GET_VARS['goto']); tep_redirect($banner['banners_url']); } break; case 'url': if (isset($HTTP_GET_VARS['goto']) && tep_not_null($HTTP_GET_VARS['goto'])) { tep_redirect('http://' . $HTTP_GET_VARS['goto']); } break; case 'manufacturer': if (isset($HTTP_GET_VARS['manufacturers_id']) && tep_not_null($HTTP_GET_VARS['manufacturers_id'])) { $manufacturer_query = tep_db_query("select manufacturers_url from " . TABLE_MANUFACTURERS_INFO . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and languages_id = '" . (int)$languages_id . "'"); if (tep_db_num_rows($manufacturer_query)) { // url exists in selected language $manufacturer = tep_db_fetch_array($manufacturer_query); if (tep_not_null($manufacturer['manufacturers_url'])) { tep_db_query("update " . TABLE_MANUFACTURERS_INFO . " set url_clicked = url_clicked+1, date_last_click = now() where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and languages_id = '" . (int)$languages_id . "'"); tep_redirect($manufacturer['manufacturers_url']); } } else { // no url exists for the selected language, lets use the default language then $manufacturer_query = tep_db_query("select mi.languages_id, mi.manufacturers_url from " . TABLE_MANUFACTURERS_INFO . " mi, " . TABLE_LANGUAGES . " l where mi.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and mi.languages_id = l.languages_id and l.code = '" . DEFAULT_LANGUAGE . "'"); if (tep_db_num_rows($manufacturer_query)) { $manufacturer = tep_db_fetch_array($manufacturer_query); if (tep_not_null($manufacturer['manufacturers_url'])) { tep_db_query("update " . TABLE_MANUFACTURERS_INFO . " set url_clicked = url_clicked+1, date_last_click = now() where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and languages_id = '" . (int)$manufacturer['languages_id'] . "'"); tep_redirect($manufacturer['manufacturers_url']); } } } } break; } [b]THIS IS LINE 60[/b] ?> <?php // VJ Links Manager v1.00 begin case "links": require(DIR_WS_FUNCTIONS . 'links.php'); $links_query = tep_db_query("select links_url from " . TABLE_LINKS . " where links_id = '" . (int)$HTTP_GET_VARS['goto'] . "'"); if (tep_db_num_rows($links_query)) { $link = tep_db_fetch_array($links_query); tep_update_links_click_count($HTTP_GET_VARS['goto']); tep_redirect($link['links_url']); } break; // VJ Links Manager v1.00 end ?>

tep_redirect(tep_href_link(FILENAME_DEFAULT));


#4

Please put that in PHP or code tags so the indenting is maintained.


#5

Hope this works, this is my first time with this forum not to mention I just learing this.

[php]

<?php /* $Id: redirect.php,v 1.10 2003/06/05 23:31:31 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); switch ($HTTP_GET_VARS['action']) { case 'banner': $banner_query = tep_db_query("select banners_url from " . TABLE_BANNERS . " where banners_id = '" . (int)$HTTP_GET_VARS['goto'] . "'"); if (tep_db_num_rows($banner_query)) { $banner = tep_db_fetch_array($banner_query); tep_update_banner_click_count($HTTP_GET_VARS['goto']); tep_redirect($banner['banners_url']); } break; case 'url': if (isset($HTTP_GET_VARS['goto']) && tep_not_null($HTTP_GET_VARS['goto'])) { tep_redirect('http://' . $HTTP_GET_VARS['goto']); } break; case 'manufacturer': if (isset($HTTP_GET_VARS['manufacturers_id']) && tep_not_null($HTTP_GET_VARS['manufacturers_id'])) { $manufacturer_query = tep_db_query("select manufacturers_url from " . TABLE_MANUFACTURERS_INFO . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and languages_id = '" . (int)$languages_id . "'"); if (tep_db_num_rows($manufacturer_query)) { // url exists in selected language $manufacturer = tep_db_fetch_array($manufacturer_query); if (tep_not_null($manufacturer['manufacturers_url'])) { tep_db_query("update " . TABLE_MANUFACTURERS_INFO . " set url_clicked = url_clicked+1, date_last_click = now() where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and languages_id = '" . (int)$languages_id . "'"); tep_redirect($manufacturer['manufacturers_url']); } } else { // no url exists for the selected language, lets use the default language then $manufacturer_query = tep_db_query("select mi.languages_id, mi.manufacturers_url from " . TABLE_MANUFACTURERS_INFO . " mi, " . TABLE_LANGUAGES . " l where mi.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and mi.languages_id = l.languages_id and l.code = '" . DEFAULT_LANGUAGE . "'"); if (tep_db_num_rows($manufacturer_query)) { $manufacturer = tep_db_fetch_array($manufacturer_query); if (tep_not_null($manufacturer['manufacturers_url'])) { tep_db_query("update " . TABLE_MANUFACTURERS_INFO . " set url_clicked = url_clicked+1, date_last_click = now() where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and languages_id = '" . (int)$manufacturer['languages_id'] . "'"); tep_redirect($manufacturer['manufacturers_url']); } } } } break; } ?> <?php // VJ Links Manager v1.00 begin case "links": require(DIR_WS_FUNCTIONS . 'links.php'); $links_query = tep_db_query("select links_url from " . TABLE_LINKS . " where links_id = '" . (int)$HTTP_GET_VARS['goto'] . "'"); if (tep_db_num_rows($links_query)) { $link = tep_db_fetch_array($links_query); tep_update_links_click_count($HTTP_GET_VARS['goto']); tep_redirect($link['links_url']); } break; // VJ Links Manager v1.00 end ?>

tep_redirect(tep_href_link(FILENAME_DEFAULT));

[/php][/code]


#6

[php]
}
break;
} <-- remove this close bracket and place it where shown below
?>

<?php // VJ Links Manager v1.00 begin case "links": . . . . . } break; // VJ Links Manager v1.00 end /////////////////////////////////////////////add close braket here ?>

tep_redirect(tep_href_link(FILENAME_DEFAULT));

[/php]


#7

Thanks lig, that did the trickā€¦ :lol:

I desprately need to learn php.

Again, thanks for the help!

Have a Great Evening!