Hello.
I hope this is the right place to ask this.
I recently set up a links indexing script on my site called WSN links. (script home page http://www.wsnlinks.com/)
It seemed to be running perfectly until I went "live" with it. Most of my site visitors are not able to view it. This is odd because it loads fine for me, and a couple other people have been able to view it and register to add their links, etc. But for the majority, it loads a blank page.
Here is the script on my (remotely hosted) server:
http://www.greenerpastures.us/link/
I posted about this on the script's home page support forum, and they didn't really offer a solution to my problem. Here is the thread I posted, and their replies.
http://www.webmastersite.net/forums/index.php?showtopic=2866
They said that they thought another index file was loading instead of the script's index.php, but I don't see how it would do that.
Can anyone help me figure out what the problem is please?
I'm not sure what to post (I'm relatively new to php). This is the "raw" index.php:
require 'start.php'; // header stuff
if ($mixtypes) $settings->mixrecip = $mixtypes;
if ($settings->skiptocat > 0 && !$catid && !$todo && !$action) { $action = 'displaycat'; $catid = $settings->skiptocat; }
// reconstruct the current url and put it in a cookie, so we can know where to come back to if we go off somewhere soon... but only save it for 15 minutes
if ($todo == 'subscribe' && $thismember->id > 0)
{
$thiscategory = new category('id', $catid);
if (!$template) $template = new template("redirect.tpl");
if (strstr($thiscategory->subscribers, '|||'. $thismember->id .'|||'))
$template->replace('{MESSAGE}', $language->subscribecat_unsubscribe);
else
$template->replace('{MESSAGE}', $language->subscribecat_subscribe);
if ($aftersubscribecat == '') $aftersubscribecat = $returnto;
$template->replace('{DESTINATION}', $aftersubscribecat);
$thiscategory->subscribe($thismember->id);
}
else if ($todo == 'ordercats')
{
$ordercats = "ORDER BY $catfield $catascdesc";
if ($ordercats != 'ORDER BY ') setcookie('ordercats', "$ordercats", 10000000);
}
else if ($todo == 'orderlinks')
{
$orderlinks = "ORDER BY $orderlinks $ascdesc";
if ($settings->orderlinks2 != '') $orderlinks .= str_replace('ORDER BY ', ',', $settings->orderlinks2);
if ($orderlinks != 'ORDER BY ') setcookie('orderlinks', "$orderlinks", 10000000);
if ($perpage > 0) setcookie('perpage', "$perpage", 10000000);
}
if (!$HTTP_COOKIE_VARS['testcookie'])
{
// test that their browser accepts cookies
makecookie('testcookie', '1', time()+9999999999);
}
include 'timedactions.php';
if ($linkcolumns < 1) $linkcolumns = $settings->linkcols;
$catcolumns = $settings->catcols;
$subcatcolumns = $settings->subcatcols;
if (($ascdesc != '') && (!stristr($orderlinks, 'ORDER'))) { $orderlinks = 'ORDER BY '. $orderlinks .' '. $ascdesc; if ($settings->orderlinks2 != '') $orderlinks .= str_replace('ORDER BY ', ',', $settings->orderlinks2); }
if ($orderlinks == '' || substr_count($orderlinks, 'ORDER') > 1)
{ // let user override value
$orderlinks = $settings->orderlinks;
if ($settings->orderlinks2 != '') $orderlinks .= str_replace('ORDER BY ', ',', $settings->orderlinks2);
}
if ($ordercats == '')
{ // let user override value
$ordercats = $settings->ordercats;
}
if ($perpage == '')
{ // let user override value
$perpage = $settings->perpage;
}
$realorder = $orderlinks;
if ($settings->orderlinks2 != '') $realorder .= str_replace('ORDER BY ', ',', $settings->orderlinks2);
// in case someone is being stupid
if ($linkcolumns < 1) $linkcolumns = 1;
if ($catcolumns < 1) $catcolumns = 1;
if ($subcatcolumns < 1) $subcatcolumns = 1;
if ($checkversion == 'docheck')
{
echo "WSN version check... this is $fullscripttitle version ". $version;
}
if ($action == 'getvotingcode')
{
$thislink = new onelink('id', $id);
if (!$template) $template = new template("$templatesdir/showvotecode.tpl");
$template->replace('{DIRURL}', $settings->dirurl);
$template->text = linkreplacements($template->text, $thislink);
}
if ($catname != '' && $catid == '')
{ // determine id based on name, if unique
$name = urldecode($catname);
$q = $db->select('id', 'categoriestable', "validated=1 AND hide=0 AND name='$name'", '', '');
$catid = $db->rowitem($q);
}
if (($action == 'displaycat') && ($catid > 0))
{
// display all the links in the selected category
if ($page == '') $page = 1;
$thiscategory = new category('id', $catid); // create proper category object
if ($thiscategory->name == '')
{
header("Location: index.php");
die ('');
}
if ($thiscategory->mixtypes != '') $settings->mixrecip = $thiscategory->mixtypes;
if ($thiscategory->orderlinks != $settings->orderlinks && $thiscategory->orderlinks != '')
{
$orderlinks = $thiscategory->orderlinks;
if ($settings->orderlinks2 != '') $orderlinks .= str_replace('ORDER BY ', ',', $settings->orderlinks2);
}
if ($thiscategory->custom != '')
{
$custom = $templatesdir .'/'. $thiscategory->custom;
if (!$template) $template = new template($custom);
}
if (!$template) $template = new template('displaylinks.tpl');
$area = $language->title_divider . $thiscategory->name; // supply area for template
$template->replace('{NAVIGATION}', shownav($thiscategory)); // do navigation
//find total number of validated links for this category, then total recip and total non-recip
$total = $thiscategory->linkshere();
$typetotals = explode(',', $settings->linktypes);
$n = sizeof($typetotals);
for ($x=0; $x<$n; $x++)
{
$var = $typetotals[$x] . 'total';
$$var = $thiscategory->typetotal($typetotals[$x]);
$template->replace('{'. strtoupper($var).'}', $$var);
}
if ($total == 0)
{
$template->replace('{LINKSBODY}', '');
$template->replace('{TOTALINCATEGORY}', '0');
}
$start = ($page * $perpage) - $perpage; // have to adjust for starting the numbering at 1
$end = $start + $perpage - 1;
// Begin ulsearch integration area
if ($settings->ulsearch == 'yes' && $thiscategory->ulsearchquery != '' && $page == 1)
{
if ($thiscategory->ulsearchmax == '') $thiscategory->ulsearchmax = $settings->ulsearchcatmax;
$ulresults = doulsearch($thiscategory->ulsearchquery, $thiscategory->ulsearchmax);
$ultemp = templateextract($template->text, '', '');
$cntr = 0;
for ($p=0; $p<$result_number; $p++)
{
$thelink = singleresult($ulresults, $p);
if ($p == 0) $ulcontent = '
if ($thiscategory->permissions != '')
{
$permissions = '|||'. $thiscategory->permissions .'|||';
if (strstr($permissions, '|||'. $thismember->usergroup .'|||')) $template = new template("noaccess.tpl");
}
// Get rid of extraneous link types in template that aren't in settings, to prevent annoying parse errors
$pattern = "";
$pattern = '/'. $pattern .'/i';
preg_match_all($pattern, $template->text, $badtypes);
$template->replace($badtypes[0][0], '');
for ($i=0; $i
{
if (!stristr($settings->linktypes, $badtypes[1][$i]))
{
$problem = $badtypes[1][$i];
$message = "Warning: You have a link type in your template which is not listed in your settings. It is being ignored.";
$message .= "The link type $problem is used in your template, but you only have ". $settings->linktypes ." in your settings. Either add $problem to your settings page or remove it from the template. ";
sendemail($settings->email, "WSN Links warning: problem with your links directory", $message, "From: ". $settings->email);
$remove = templateextract($template->text, '', $badtypes[0][$i]);
$template->replace($remove, '');
}
}
}
else // no category selected, so display listing of categories
{
$thiscategory = new category('id', '0'); // top level
if (!$template) $template = new template('main.tpl');
';
$columncount = 1;
for ($currentcat=0; $currentcat<$totalcats; $currentcat++)
{
// get info for this category
$area = $language->title_divider . $language->title_main;
$row = $db->row($catdata);
$cat = new category('row', $row); // the category to list next
// display link to this category
if ($columncount == 0)
$template_catsbody .= '
';
else if ($columncount == $catcolumns)
{
$template_catsbody .= '