Jump to content

Recommended Posts

Hello,

I am a newbie to php and am trying to use a simple php linking script. I am getting this error and I know it is a formatting problem but I have no idea what character (s) might be causing it. I have included the error and the full page code below; The url of my page is host4cash.net/resources.php. Any help appreciated, Coreyna

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/host4cas/public_html/resources.php on line 17


[code]<?php
/*<--- BEGIN MY LINK HELPER CODE --->

Making modifications to this code can cause your links page to stop working. Please only make
modifications where modifications are allowed.  Being that this is a free service, we do not have
the resources to help you debug any changes you may have made.  If you do run into problems with
this code, log into your account and download the original again.

*/

$OnCat = @$_GET["cid"];

if ($OnCat == "") {$OnCat = "0";} //Set to Main Directory Page

if (!is_numeric($OnCat)) {
  Response.$Status="301 Moved Permanently";
  Response.AddHeader "Location", "/";
}


//You may name your links page anything you want.  But for your links page to work correctly
//you must provide us with the name of your links page (without the '.php' extension).
$PageName = "resources"; // change this value to match your [PageName].php links page

//You may modify the following variable to change how many columns your directory displays.
//By default this value is set to show 2 columns, but you may show as few as 1 column or
//as many as 4. Valid values (1,2,3,4)
$DirectoryCols = 2; // change this value to adjust how many columns your main directory page displays

//You may modify the following variable to display your links on a single page instead of
//directory style. This is a convenient way to display your links if you have fewer than 40.
$ShowAsSinglePage = 0; // change this value to 1 if you want a single page, or 0 for directory

$RequestPage = "http://www.mylinkhelper.com/bin/dynfetch.asp?id=7BC5F411-C799-4DD8-9D17-B398A473B76A&pagename=".$PageName."&cid=".$OnCat."&dircols=".$DirectoryCols."&single=".$ShowAsSinglePage;
Set $serverXMLHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP");
$serverXMLHTTP.$Open "GET", $RequestPage, False;
$serverXMLHTTP.$Send;
$htmlCode = $serverXMLHTTP.$ResponseText;
$GetLinks = $htmlCode;

if (instr(1,$GetLinks, "<!--ERROR") != 0) {
  Response.$Status="301 Moved Permanently";
  Response.AddHeader "Location", "/";
}

//Get The Page Title
$lLoc = instr(1,$GetLinks, "|");
if ($lLoc != 0) {
  $sTitle = left($GetLinks, $lLoc - 1);
  $GetLinks = right($GetLinks, strlen($GetLinks) - $lLoc);
}

if ($OnCat == "0") {
  //This value is the title for your main directory page and can be modified
  $sTitle = "Sell it yourself";
}
//<--- END MY LINK HELPER CODE --->
?>

<title><?=$sTitle?></title>
<?=$GetLinks?>[/code]
[code]
<?php
/*<--- BEGIN MY LINK HELPER CODE --->

Making modifications to this code can cause your links page to stop working. Please only make
modifications where modifications are allowed.  Being that this is a free service, we do not have
the resources to help you debug any changes you may have made.  If you do run into problems with
this code, log into your account and download the original again.

*/

$OnCat = $_GET["cid"];

if ($OnCat == "") {$OnCat = "0";} //Set to Main Directory Page

if (!is_numeric($OnCat)) {
  Response.$Status="301 Moved Permanently";
  Response.AddHeader "Location", "/";
}


//You may name your links page anything you want.  But for your links page to work correctly
//you must provide us with the name of your links page (without the '.php' extension).
$PageName = "resources"; // change this value to match your [PageName].php links page

//You may modify the following variable to change how many columns your directory displays.
//By default this value is set to show 2 columns, but you may show as few as 1 column or
//as many as 4. Valid values (1,2,3,4)
$DirectoryCols = 2; // change this value to adjust how many columns your main directory page displays

//You may modify the following variable to display your links on a single page instead of
//directory style. This is a convenient way to display your links if you have fewer than 40.
$ShowAsSinglePage = 0; // change this value to 1 if you want a single page, or 0 for directory

$RequestPage = "http://www.mylinkhelper.com/bin/dynfetch.asp?id=7BC5F411-C799-4DD8-9D17-B398A473B76A&pagename=".$PageName."&cid=".$OnCat."&dircols=".$DirectoryCols."&single=".$ShowAsSinglePage;
Set $serverXMLHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP");
$serverXMLHTTP.$Open "GET", $RequestPage, False;
$serverXMLHTTP.$Send;
$htmlCode = $serverXMLHTTP.$ResponseText;
$GetLinks = $htmlCode;

if (instr(1,$GetLinks, "<!--ERROR") != 0) {
  Response.$Status="301 Moved Permanently";
  Response.AddHeader "Location", "/";
}

//Get The Page Title
$lLoc = instr(1,$GetLinks, "|");
if ($lLoc != 0) {
  $sTitle = left($GetLinks, $lLoc - 1);
  $GetLinks = right($GetLinks, strlen($GetLinks) - $lLoc);
}

if ($OnCat == "0") {
  //This value is the title for your main directory page and can be modified
  $sTitle = "Sell it yourself";
}
//<--- END MY LINK HELPER CODE --->
?>

<title><?=$sTitle?></title>
<?=$GetLinks?>
[/code]
Hi Guys, I appreciate the responses. I made the change recommended by Bibby. No luck but I did get a different error message, which might help.

The error is;  'Parse error: syntax error, unexpected T_STRING in /home/propnow/public_html/resources.php on line 8'

I have included the fresh code below; (Also I removed all the comments to unclutter the code)

Again, any help much appreciated. I'm trying to nut it out but not really getting anywhere. Cheers, Coreyna

[code]


<?php


$OnCat = @$_GET["cid"];

if ($OnCat == "") {$OnCat = "0";

if (Not is_numeric($OnCat)) {
  Response.$Status="301 Moved Permanently";
  Response.AddHeader "Location", "/"; ?
}


$PageName = "resources";

$DirectoryCols = 2;

$ShowAsSinglePage = 0;

$RequestPage = "http://www.mylinkhelper.com/bin/dynfetch.asp?id=7BC5F411-C799-4DD8-9D17-B398A473B76A&pagename=".$PageName."&cid=".$OnCat."&dircols=".$DirectoryCols."&single=".$ShowAsSinglePage;
Set $serverXMLHTTP = Server.CreateObject("Msxml2.ServerXMLHTTP");
$serverXMLHTTP.$Open "GET", $RequestPage, False;
$serverXMLHTTP.$Send;
$htmlCode = $serverXMLHTTP.$ResponseText;
$GetLinks = $htmlCode;

if (instr(1,$GetLinks, "<!--ERROR") != 0) {
  Response.$Status="301 Moved Permanently";
  Response.AddHeader "Location", "/";
}

$lLoc = instr(1,$GetLinks, "|");
if ($lLoc != 0) {
  $sTitle = left($GetLinks, $lLoc - 1);
  $GetLinks = right($GetLinks, strlen($GetLinks) - $lLoc);
}

if ($OnCat == "0") {

  $sTitle = "Sell it yourself";
}

?>
<title><?=$sTitle?></title>
<?=$GetLinks?>


[/code]
Hi again Guys, thanks for the responses. The code is working fine now after making some adjustments, in particular removing the "Response.$status" bit. Again thanks for your help, I've posted the working code below.

[code]


<?php
/*<--- BEGIN MY LINK HELPER CODE --->

Making modifications to this code can cause your links page to stop working. Please only make
modifications where modifications are allowed.  Being that this is a free service, we do not have
the resources to help you debug any changes you may have made.  If you do run into problems with
this code, log into your account and download the original again.

*/
$OnCat = @$_GET["cid"];

if ($OnCat == "") {$OnCat = "0";} //Set to Main Directory Page

//You may name your links page anything you want.  But for your links page to work correctly
//you must provide us with the name of your links page (without the '.php' extension).
$PageName = "resources"; // change this value to match your [PageName].php links page

//You may modify the following variable to change how many columns your directory displays.
//By default this value is set to show 2 columns, but you may show as few as 1 column or
//as many as 4. Valid values (1,2,3,4)
$DirectoryCols = 2; // change this value to adjust how many columns your main directory page displays

//You may modify the following variable to display your links on a single page instead of
//directory style. This is a convenient way to display your links if you have fewer than 40.
$ShowAsSinglePage = 0; // change this value to 1 if you want a single page, or 0 for directory

$file = file("http://www.mylinkhelper.com/bin/phpdynfetch.asp?id=7BC5F411-C799-4DD8-9D17-B398A473B76A&pagename=".$PageName."&cid=".$OnCat."&dircols=".$DirectoryCols."&single=".$ShowAsSinglePage);

if ($OnCat == "0") {
  //This value is the title for your main directory page and can be modified
  $sTitle = "My Link Helper";
  $GetLinks = $file[0];
} else {
$iPos = strpos($file[0], "|");
$sTitle = substr($file[0],0,$iPos);
$GetLinks = substr($file[0],$iPos + 1,strlen($file[0]));
}
//<--- END MY LINK HELPER CODE --->
?>
<!--
Place the following code into the location of your webpage template that you want your
directory to be displayed, it will assume the link syles and sizes you have defined
in your stylesheet.

Also, don't forget to use the "sTitle" variable to customize the page!

Please delete this comment when you implement your links directory.
-->
<title><?=$sTitle;?></title>
<?=$GetLinks;?>

[/code]
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.