Jump to content

Search script


ozzysalden

Recommended Posts

Dear people,

 

A while ago I installed a script. It all worked just fine untill my host upgraded the servers. Since that moment I have an error message when I try to do a search.

This is the error:

 

Warning: include(usr/local/lib/php/index.php) [function.include]: failed to open stream: No such file or directory in /var/www/g28894/planthunteronline.com/HTML/directory/links.php on line 13

 

Warning: include() [function.include]: Failed opening 'usr/local/lib/php/index.php' for inclusion (include_path='.:/usr/local/lib/php') in /var/www/g28894/planthunteronline.com/HTML/directory/links.php on line 13

 

Below I have added the script that causes of the problem.

Please keep in mind that I am not a php programmer and I don't understand anything about it. I am just looking for a part of code that can solve the problem.

 

Thanks a lot already!

 

Ozzy

 

 

<?php

include("paramlink.inc.php");

if (($action) OR ($cat) OR ($search))
{
$cat = $cat;
$action = $action;
$search = $search;
}
else
{
include ("usr/local/lib/php/index.php");
exit;
}





function showaddlink() {
require( './paramlink.inc.php');
?>
<font class='standard'><b><? echo $sitename ?> : How to add a links</b></font><br><br>
<font class='text10'>
<ul type="square">
<li>Find the appropriate category in the Directory.<br>
<li>Suggest your site from the category you think most appropriate. Do this by clicking on the "Add Link" link.<br>
<li>We update our database on average every  day so you can expect to be added in this time.
<br><br><br><br>
<b><? echo $sitename ?></b><br>
Links Manager
</font>
</ul>
</td></tr></table></td></tr></table></center>
<? include "footer.inc.php"; ?>
<?
}


function showvote() {
require( './paramlink.inc.php');
?>
<center><table width='<? echo "$tablewidth"; ?>' border='<? echo "$tableborder"; ?>' cellpadding=10 cellspacing=0 bordercolor='#000000'><tr>
<td class='standard'>
<font class='standard'><b><? echo $sitename ?> : You Are Rated</b></font><br><br>
<font class='text10'>
<ul type="square">
<li>Sorry, our record shows you've already rated this link recently.. <br>
<li>Please contact the site administrator if you have any questions.<br>
<br><br><br>
<b><? echo $sitename ?></b><br>
Links Manager
</font>
</ul>
</td></tr></table></td></tr></table></center>
<? include "footer.inc.php"; ?>
<?
}


function showrate() {
require( './paramlink.inc.php');
?>
<center><table width='<? echo "$tablewidth"; ?>' border='<? echo "$tableborder"; ?>' cellpadding=10 cellspacing=0 bordercolor='#000000'><tr>
<td class='standard'>
<font class='standard'><b><? echo $sitename ?> : Error Rating Link</b></font><br><br>
<font class='text10'>
<ul type="square">
<li>Please select a rate <br>
<br><br><br>
<b><? echo $sitename ?></b><br>
Links Manager
</font>
</ul>
</td></tr></table></td></tr></table></center>
<? include "footer.inc.php"; ?>
<?
}


function showthankyou() {
require( './paramlink.inc.php');
?>
<center><table width='<? echo "$tablewidth"; ?>' border='<? echo "$tableborder"; ?>' cellpadding=10 cellspacing=0 bordercolor='#000000'><tr>
<td class='standard'>
<font class='standard'><b><? echo $sitename ?> : Thank You</b></font><br><br>
<font class='text10'>
<ul type="square">
<li>Thank You for Rating <? echo $link_id ?><br>
<li>You have rated <? echo $link_id ?> as <? echo $rating ?>. <br>
<li>Your rating will be included in our database shortly.<br>
</font>
</ul>
</td></tr></table></td></tr></table></center>
<? include "footer.inc.php"; ?>
<?
}



if ($cat)
{
$sitenames = "$sitename - $lcat_name";
include('header.inc.php');
}
?>

<?
//Number of records to show per page
$limit = $nolinks;

//Set the default offset = 0
$offset = ($offset) ? $offset : 0;

//Encoded query string that needs to be passed to each page
$query = "&cat=".urlencode($cat);

$mysql_mylink = mysql_connect($mysql_host, $mysql_user, $mysql_pass)
or die ("Cannot make the connection");
mysql_select_db($mysql_db, $mysql_mylink)
or die ("Cannot connect to the database");

$rime1 = mysql_query("SELECT COUNT(*) from links WHERE link_val LIKE 'yes' AND cat_id LIKE '$cat'") or die(mysql_error());
$totalnum = mysql_result($rime1, 0, 0);

$rime2 = mysql_query("SELECT * from category WHERE lcat_id='$cat'") 
or die(mysql_error());
while($row = mysql_fetch_array($rime2)) {
extract($row);
$id = $row["lcat_id"];
$name = $row["lcat_name"];
$sub_cat = $row["sub_cat"];

$navigator = $name . "" ;

$rime5= mysql_query("SELECT * FROM category WHERE lcat_id='$sub_cat'");
$lista = mysql_num_rows($rime5);
$rowa = mysql_fetch_array($rime5);
$ida = $rowa["lcat_id"];
$namea = $rowa["lcat_name"];
$sub_cat = $rowa["sub_cat"];
$linnk1 = "<a href=\"$PHP_SELF?cat=$ida\">$namea</a> >";
$navigator = $linnk1 . "  " .$navigator;



while ($sub_cat > 0) {
$rime3= mysql_query("SELECT * FROM category WHERE lcat_id='$sub_cat'");
$lista = mysql_num_rows($rime3);
$rowa = mysql_fetch_array($rime3);
$ida = $rowa["lcat_id"];
$namea = $rowa["lcat_name"];
$sub_cat = $rowa["sub_cat"];

$linnk = "<a href=\"$PHP_SELF?cat=$ida\">$namea</a> >";
}


$navigator = $linnk .  " "  . $navigator;
?>
<center>
<table width='<? echo "$tablewidth"; ?>' border='<? echo "$tableborder"; ?>' cellpadding=10 cellspacing=0 bordercolor='#000000'><tr>
<td class='standard'>
<?
echo "<a href='links.php'>Home</a> > $navigator <hr size=1  noshade>";

$resulta = mysql_query("SELECT * FROM category WHERE sub_cat='$lcat_id'");
$lista = mysql_num_rows($resulta);
if ($lista != 'NULL') {

echo "<table width='100%' border='0'>";
echo "<tr>";

$na=1;
while ($ia < $lista) {
$rowa = mysql_fetch_array($resulta);
$ida = $rowa["lcat_id"];
$namea = $rowa["lcat_name"];
$sub_cat = $rowa["sub_cat"];
if ($na==4) {
  echo "<td width=\"20%\" valign=\"top\" class='midd'>";
  echo "<a href=\"$PHP_SELF?cat=$ida\">$namea</a>";

  echo "</td>";
  echo "</tr><tr>";
  $ia++;
  $na=1;
  }
else {
echo "<td width=\"20%\" valign=\"top\" class='midd'>";
echo "<a href=\"$PHP_SELF?cat=$ida\">$namea</a>";

echo "</td>";
$na++;
$ia++;

}
}

echo "</tr></table>";
}
echo "<hr size=1  noshade><font class='small'><b>$totalnum</b> links will be displayed in category $lcat_name</font><br><br>";
}


$rime = mysql_query("SELECT * from links WHERE link_val like 'yes' AND cat_id LIKE '$cat' ORDER BY hits DESC, link_pop DESC, rate DESC LIMIT $offset, $limit") or die(mysql_error());
while($row = mysql_fetch_array($rime)) {
extract($row);

	if ($rate > 0)
	{
		$arate = sprintf ("%.2f", ($rating / $rate));
	}
	else
	{
		$arate = '0';
	}


echo " <font class=text10><b><a href='http://$siteurl/links.php?action=rated&link_id=$link_id' target='_blank'>$link_name</b></a></font><br>";
echo " <font class=text9>$link_desc</font><br>";
}

freddyShowNav($totalnum, $query, $offset, $limit);

function freddyShowNav($totalnum, $query, $offset, $limit) {
global $PHP_SELF;
if ($totalnum > $limit) {
// calculate number of pages needing links 
$pages = intval($totalnum/$limit); 

// $pages now contains int of pages needed unless there is a remainder from division 
if ($totalnum%$limit) $pages++;

if (($offset + $limit) > $totalnum) {
$lastnum = $totalnum;
} 
else {
$lastnum = ($offset + $limit);
} 
?>
<table cellpadding="4"><tr><td class="standard">Page </td>
<?
for ($i=1; $i <= $pages; $i++) { // loop thru 
$newoffset=$limit*($i-1);
if ($newoffset != $offset) {
?>
<td class="standard"><a href="links.php?<?=$query?>&offset=<?=$newoffset?>"><b><?=$i?></b></a></td>
<?
} 
else {
?>
<td class="standard"><?=$i?></td>
<?
}
}
?>
</tr></table>

<?
echo "</td></tr></table>";
}
return;
}
echo ""
?>






<?
{

function ShowNav($totalnum, $query, $offset, $limit, $query1) {
global $PHP_SELF;
if ($totalnum > $limit) {
// calculate number of pages needing links 
$pages = intval($totalnum/$limit); 

// $pages now contains int of pages needed unless there is a remainder from division 
if ($totalnum%$limit) $pages++;

if (($offset + $limit) > $totalnum) {
$lastnum = $totalnum;
} 
else {
$lastnum = ($offset + $limit);
} 

?>
<table cellpadding="2"><tr><td class="standard">Page </td>
<?
for ($i=1; $i <= $pages; $i++) { // loop thru 
$newoffset=$limit*($i-1);
if ($newoffset != $offset) {
?>
<td class="text10"><a href="links.php?search=<?=$query?>&andor=<?=$query1?>&offset=<?=$newoffset?>"><?=$i?></a></td>
<?
} 
else {
?>
<td class="text10"><b><?=$i?></b></td>
<?
}
}
?>
</tr></table>
<?
}
return;
}
echo ""
?>
<?
}




if ($action=="addlink")
{
$sitenames = "$sitename - Add Link";
include('header.inc.php');
?>
<form action="links.php?action=linkadd" method ="POST">
<center><table width='<? echo "$tablewidth"; ?>' border='<? echo "$tableborder"; ?>' cellpadding=10 cellspacing=0 bordercolor='#000000'><tr>
<td><table>
<?
if (!ereg("^[0-9]+$", $lcat_id))
{
showaddlink();
	exit;
}
$rime9 = mysql_query("SELECT * from category WHERE lcat_id='$lcat_id'") 
or die(mysql_error());
$num_cat = mysql_numrows($rime9);
If (!$num_cat)
{
showaddlink();
	exit;
}

echo "<td class=text10></td><td class=standard><b>Please fill in the following fields to add your Web site to<br> $sitename</b><br><br></td></tr>";

$mysql_mylink = mysql_connect($mysql_host, $mysql_user, $mysql_pass)
or die ("Cannot make the connection");
mysql_select_db($mysql_db, $mysql_mylink)
or die ("Cannot connect to the database");

$rime2 = mysql_query("SELECT * from category WHERE lcat_id='$lcat_id'") 
or die(mysql_error());
while($row = mysql_fetch_array($rime2)) {
extract($row);
$id = $row["lcat_id"];
$name = $row["lcat_name"];
$sub_cat = $row["sub_cat"];
$navigator = $name;

$rime5= mysql_query("SELECT * FROM category WHERE lcat_id='$sub_cat'");
$lista = mysql_num_rows($rime5);
$rowa = mysql_fetch_array($rime5);
$ida = $rowa["lcat_id"];
$namea = $rowa["lcat_name"];
$sub_cat = $rowa["sub_cat"];
$navigator = $namea." ".$navigator;

$rime6= mysql_query("SELECT * FROM category WHERE lcat_id='$sub_cat'");
$lista = mysql_num_rows($rime6);
$rowa = mysql_fetch_array($rime6);
$ida = $rowa["lcat_id"];
$nameaa = $rowa["lcat_name"];
$sub_cat = $rowa["sub_cat"];

$navigator = $nameaa." ".$navigator;
}

?>
<tr><td class=text10>Category :</td><td class=text10><input type = "hidden" name = "lcat_id" value='<? echo "$lcat_id"; ?>'><b><?=$navigator;?></b></td></tr>
<tr><td class=text10>Link Name : </td><td class=text10><input type = "text" name = "link_name" size=30 maxlength=80></td></tr>
<tr><td class=text10>Link URL : </td><td class=text10><input type = "text" name = "link_url" size=30 maxlength=100></td></tr>
<tr><td class=text10>Description : </td><td class=text10><textarea name="link_desc" cols=40 rows=4 maxlength=250></textarea></td></tr>
<tr><td class=text10>Keywords : </td><td class=text10><textarea name="link_keyword" cols=40 rows=2 maxlength=100></textarea></td></tr>
<tr><td class=text10>Email address : </td><td class=text10><input type = "text" name = "link_email" size=30 maxlength=50></td></tr>
<tr><td class=text10></td><td class=text10>
<input type = "hidden" name = "link_val" value="no">
<input type = "hidden" name = "link_pop" value="">
<input type = "hidden" name = "link_broken" value="no">
<input type = "hidden" name = "link_sendemail" value="">
<input type = "hidden" name = "hits" value="5">
<input type = "hidden" name = "rate" value="1">
<input type = "hidden" name = "rating" value="9">
</td></tr><tr><td class=text10></td><td class=text10>
<input type = "submit" value = "add link"></td></tr></table></form></td></tr></table></center>
<? include "footer.inc.php"; ?>
<?
exit;
}





if ($action=="linkadd")
{
$sitenames = "$sitename - Link $link_name is Add";
include('header.inc.php');
?>
<center><table width='<? echo "$tablewidth"; ?>' border='<? echo "$tableborder"; ?>' cellpadding=10 cellspacing=0 bordercolor='#000000'><tr>
<td class='standard'>
<table width='100%'><tr><td class=text10>
<?
$mysql_mylink = mysql_connect($mysql_host, $mysql_user, $mysql_pass)
or die ("Cannot make the connection");
mysql_select_db($mysql_db, $mysql_mylink)
or die ("Cannot connect to the database");

$linnk=$link_url;

$rime3 = mysql_query("SELECT * from links WHERE link_url LIKE '$linnk'") 
or die(mysql_error());
$num_url = mysql_numrows($rime3);
if ($num_url > 0){

echo "<font class=standard><b>$sitename : Add a Link : Your Link is add  in $sitename</b><br><br>";
echo "<font class=midd>Link <a href='$link_url'>$link_url</a> is added earlier.<br>You don't need update link.<br><br>";

$rime2 = mysql_query("SELECT * from links WHERE link_url LIKE '$link_url'") 
or die(mysql_error());

while($row = mysql_fetch_array($rime2)) {
extract($row);

echo " <li><font class=midd><b><a href='$link_url' target='_blanck'>$link_name</a></b><br>";
echo "$link_desc</font></li><br>";
echo " <font class=text8><font color='$colorpop'>$link_pop</font> [Added: $date]  </font><br><br>";
}

}
else
{

$rime = mysql_query("SELECT lcat_name from category") 
or die(mysql_error());


if (($lcat_id) &&($link_name) && ($link_url) && ($link_desc) && ($link_keyword) && ($link_email))
{
$rime1 = "INSERT into links VALUES ('NULL','$lcat_id','$link_name','$link_url','$link_desc','$link_keyword','$link_email','no',NOW(),'','no','','$hits','$rate','$rating')";
$rime=$rime;
$result = mysql_query($rime1);

echo "<font class=standard><b>$sitename : Add a Link : Thank You </b><br><br>";
echo "Your link <b>$link_name</b> is now awaiting validation by our webmaster.<br><br>";
echo "<font class=text8><a href='$PHP_SELF?action=addlink'>Please going back add next link</a></font>";
}
else
{
echo "<font class=standard><b>$sitename</a> : Add a Link</b><br><br>";
echo "<font class=midd><b>You did not enter any data.</b></font><br><br>";
echo "<font class=text8><a href='$PHP_SELF?action=addlink'>Please going back add a link</a></font>";
}
}
?>
</td></tr></table></td></tr></table></center>
<? include "footer.inc.php"; ?>
<?
exit;
}




if ($action=="new")
{
$sitenames = "$sitename - New Links";
include('header.inc.php');
?>
<center><table width='<? echo "$tablewidth"; ?>' border='<? echo "$tableborder"; ?>' cellpadding=10 cellspacing=0 bordercolor='#000000'><tr>
<td class='standard'>
<table width=100% border=0 cellpadding=10 cellspacing=0 bordercolor=#000000><tr>
<td class="standard">
<?
$mysql_mylink = mysql_connect($mysql_host, $mysql_user, $mysql_pass)
or die ("Cannot make the connection");
mysql_select_db($mysql_db, $mysql_mylink)
or die ("Cannot connect to the database");

if ($start) {
settype($start, 'integer');
} else { 
$start = 0;
}

$climit = $nolinksnew + 0;

if (!$newdays)
{
$newdays=$daysnew;
}
else
{
$newdays=$newdays;
}

$rime1 = mysql_query("SELECT COUNT(*) from links WHERE (to_days(NOW()) - to_days(links.date)) <= $newdays AND link_val = 'yes'") or die(mysql_error());
$totalnum = mysql_result($rime1, 0, 0);

$rime=mysql_query("SELECT *,(rating/rate) AS arate FROM links WHERE (to_days(NOW()) - to_days(links.date)) <= $newdays AND link_val = 'yes' ORDER BY date DESC LIMIT $start, $climit");

echo "<font class=standard><b><a href='links.php'>$sitename</a> : New Links</b><br><br>";
echo "Displaying links added in the last $newdays days. <b>$totalnum</b> links will be displayed.<br><br>";

while($row = mysql_fetch_array($rime)) {
extract($row);


echo "<font class=text10><b><a href='http://$siteurl/links.php?action=rated&link_id=$link_id' target='_blank'>$link_name</b></a></font><br>";
echo " <font class=text9>$link_desc</font><br>";
echo " <font class=text7>| hits $hits | vote $rate rating $arate | <font color='$colorpop'>$link_pop</font> [Added: $date]  <a href='http://$siteurl/links.php?action=deadlink&link_id=$link_id'>DEAD LINK</a> |  <a href='http://$siteurl/links.php?action=vote&link_id=$link_id'>RATE IT</a> |</font><br><br>";	
}

if (mysql_num_rows($rime) == $climit) {
$next_url = $start + $nolinksnew;
$next = '<a href="links.php?action=new&newdays='.$newdays.'&id='.$link_id.'&start='.$next_url.'"><b>Next </b></a>-'.$nolinksnew.'';

} else {
$to = $start + mysql_num_rows($rime); 
}

$back_url = $start - $nolinksnew;
$prev = ($start) ? '  <a href="links.php?action=new&newdays='.$newdays.'&id='.$link_id.'&start='.$back_url.'"><b>Previous</b></a>-'.$nolinksnew.'' : '';
echo "<font class='midd'>$next $prev";

echo "<form action=links.php method=get><input type=hidden name=action value=new>Show links added in the last <input type=text name=newdays value='20' size=3> days. <input type=submit value=Go></form>";
?>
</td></tr></table></td></tr></table></center>
<? include "footer.inc.php"; ?>
<?
exit;
}




if ($action=="popular")
{
$sitenames = "$sitename - Popular Links";
include('header.inc.php');
?>
<center><table width='<? echo "$tablewidth"; ?>' border='<? echo "$tableborder"; ?>' cellpadding=10 cellspacing=0 bordercolor='#000000'><tr>
<td class='standard'>
<table width=100% border=0 cellpadding=10 cellspacing=0 bordercolor=#000000><tr>
<td class="standard">
<?
$mysql_mylink = mysql_connect($mysql_host, $mysql_user, $mysql_pass)
or die ("Cannot make the connection");
mysql_select_db($mysql_db, $mysql_mylink)
or die ("Cannot connect to the database");

if ($start) {
settype($start, 'integer');
} else { 
$start = 0;
}

$climit = $nolinkspop + 0;

$rime=mysql_query("SELECT *,(rating/rate) AS arate FROM links WHERE link_pop = 'pop' AND link_val = 'yes' ORDER BY hits DESC, arate DESC LIMIT $start, $climit");

echo "<font class=standard><b><a href='links.php'>$sitename</a> : Popular Links</b><br><br>";
echo "Displaying popular links. A maximum of 100 links will be displayed.<br><br>";

while($row = mysql_fetch_array($rime)) {
extract($row);

echo " <font class=text10><b><a href='http://$siteurl/links.php?action=rated&link_id=$link_id' target='_blank'>$link_name</b></a></font><br>";
echo " <font class=text9>$link_desc</font><br>";
echo " <font class=text7>| hits $hits | vote $rate rating $arate | <font color='$colorpop'>$link_pop</font> | [Added: $date]  <a href='http://$siteurl/links.php?action=deadlink&link_id=$link_id'>DEAD LINK</a> |  <a href='http://$siteurl/links.php?action=vote&link_id=$link_id'>RATE IT</a> |</font><br><br>";	
}

if (mysql_num_rows($rime) == $climit) {
$next_url = $start + $nolinkspop;
$next = '<a href="links.php?action=popular&id='.$link_id.'&start='.$next_url.'">Next </a>-'.$nolinkspop.'';

} else {
$to = $start + mysql_num_rows($rime); 
}

$back_url = $start - $nolinkspop;
$prev = ($start) ? '<a href="links.php?action=popular&id='.$link_id.'&start='.$back_url.'">Previous</a>-'.$nolinkspop.'' : '';
echo "<font class='midd'>$prev  $next";
?>
</td></tr></table></td></tr></table></center>
<? include "footer.inc.php"; ?>
<?
exit;
}





if ($action=="top")
{
$sitenames = "$sitename - Top rated";
include('header.inc.php');
?>
<center><table width='<? echo "$tablewidth"; ?>' border='<? echo "$tableborder"; ?>' cellpadding=10 cellspacing=0 bordercolor='#000000'><tr>
<td class='standard'>
<table width=100% border=0 cellpadding=10 cellspacing=0 bordercolor=#000000><tr>
<td class="standard">
<?
$mysql_mylink = mysql_connect($mysql_host, $mysql_user, $mysql_pass)
or die ("Cannot make the connection");
mysql_select_db($mysql_db, $mysql_mylink)
or die ("Cannot connect to the database");


$rime=mysql_query("SELECT *,(rating/rate) AS arate FROM links WHERE link_val = 'yes' AND rate>$noratetop ORDER BY arate DESC, hits DESC LIMIT $nolinkstop");

echo "<font class=standard><b><a href='links.php'>$sitename</a> : Top rated</b><br><br>";
echo "Displaying top rated links. A maximum of $nolinkstop links will be displayed.<br><br>";
echo "<ol type='1'>";
while($row = mysql_fetch_array($rime)) {
extract($row);

echo " <li><font class=text10><b><a href='http://$siteurl/links.php?action=rated&link_id=$link_id' target='_blank'>$link_name</b></a></font><br>";
echo " <font class=text9>$link_desc</font><br>";
echo " <font class=text7>| hits $hits | vote $rate rating $arate | <font color='$colorpop'>$link_pop</font> [Added: $date]  <a href='http://$siteurl/links.php?action=deadlink&link_id=$link_id'>DEAD LINK</a> | <a href='http://$siteurl/links.php?action=vote&link_id=$link_id'>RATE IT</a> |</font><br><br>";
}

?>
</td></tr></table></td></tr></table></center>
<? include "footer.inc.php"; ?>
<?
echo "</ol>";
exit;
}








if ($action=="searchform")
{
$sitenames = "Search Form";
include('header.inc.php');
?>
<center><table width='<? echo "$tablewidth"; ?>' border='<? echo "$tableborder"; ?>' cellpadding=10 cellspacing=0 bordercolor='#000000'><tr>
<td class='standard'>
<table><tr><td>
<?
echo "<font class=standard><b>$sitename : Search Links</b><br><br>";
?>
<form action=links.php method=get>  Search : <input type=text name=search>   <select NAME=andor>
<option>and
<option>or
</select>   <input type=submit value=search>  </form></td></tr></table>
</td></tr></table></center>
<? include "footer.inc.php"; ?>
<?
exit;
}





if ($action=="rated")
{
$sitenames = "$sitename Rate It";
?>
<?
$mysql_mylink = mysql_connect($mysql_host, $mysql_user, $mysql_pass)
or die ("Cannot make the connection");
mysql_select_db($mysql_db, $mysql_mylink)
or die ("Cannot connect to the database");

$result= mysql_query("SELECT link_id, hits, link_url FROM links WHERE link_id = '$link_id'")
or die(mysql_error());

if (!ereg("^[0-9]+$", $link_id))
{
	include("index.php");
	exit;
}

while ($row = mysql_fetch_array($result))
{
	$hits = $row["hits"];
	$link_id = $row["link_id"];
	$link_url = $row["link_url"];
}
$hits++;
$result2 = @mysql_query("UPDATE links SET hits = '$hits' WHERE link_id = '$link_id'");

echo "<META HTTP-EQUIV='Refresh' Content=0;URL='$link_url'>";

exit;
?>
</td></tr></table>
</center>
<?
}






if ($action=="vote")
{
$sitenames = "Vote";
include('header.inc.php');
?>
<center><table width='<? echo "$tablewidth"; ?>' border='<? echo "$tableborder"; ?>' cellpadding=10 cellspacing=0 bordercolor='#000000'><tr><td class='standard'>
<font class='standard'><b><? echo $sitename ?> : Please rate the link </b></font><br><br><table width=100%><tr><td>

</td></tr><tr><td align=center valign=top>
<font class=text9>Please rate the link between five and ten.</font>
</td></tr><tr>
<?
$mysql_mylink = mysql_connect($mysql_host, $mysql_user, $mysql_pass)
or die ("Cannot make the connection");
mysql_select_db($mysql_db, $mysql_mylink)
or die ("Cannot connect to the database");

$result= mysql_query("SELECT * FROM links WHERE link_id = '$link_id'")
or die(mysql_error());

while ($row = mysql_fetch_array($result))
{
	$rate = $row["rate"];
	$link_id = $row["link_id"];
	$link_url = $row["link_url"];
	$link_name = $row["link_name"];
	$rating = $row["rating"];
}
?>
<form action='links.php?action=rate&link_id=<? echo $link_id ?>' method=post name=rate>
<td align=center><a href="<? echo $link_url ?>" target="_blank"><font class=text10><b><? echo $link_name ?></b></font></a> 
<br><br>
<font class=text8>
<input type=hidden name=rate value='<? echo $rate ?>'>
<input type=hidden name=rating value='<? echo $rating ?>'>
<input type=hidden name=link_id value='<? echo $link_id ?>'><select name=score size=1 class=small>
<option>-<option>5<option>6<option>7<option>8<option>9<option>10
</select></font><input type = "submit" value = "rate link"></td></form></tr></table>
</td></tr></table>
</td></tr></table>
</center>
<? include "footer.inc.php"; ?>
<?
exit;
}




if ($action=="rate")
{
$sitenames = "$sitename Rated $link_id";
include('header.inc.php');

?>
<?

$mysql_mylink = mysql_connect($mysql_host, $mysql_user, $mysql_pass)
or die ("Cannot make the connection");
mysql_select_db($mysql_db, $mysql_mylink)
or die ("Cannot connect to the database");

$date1 = date ("Y-m-d");
$client = $REMOTE_HOST;
$link_name = $link_name;

$rime = mysql_query("SELECT date, host, linkID FROM vote WHERE linkID = '$link_id' AND date='$date1' AND host='$client'");

if (mysql_num_rows ($rime) >= 1) 
{ 
	showvote();
	exit;
} 
else

$result = mysql_query("SELECT rate, rating, link_id, link_name, link_url FROM links WHERE link_id = '$link_id' AND link_val='yes'");
if (!$result)
	custom_die("SQL result failed");
$num = mysql_num_rows($result);
if ($num == 0)
{	
	showrate();
	exit;
}


If ($score <5)
{

	showrate();
	exit;
}


while ($row = mysql_fetch_array($result))
{
	$rate = $row["rate"];
	$rating = $row["rating"];
	$link_id = $row["link_id"];
	$link_name = $row["link_name"];
	$link_url = $row["link_url"];
}


$rate++;
$rating = $rating + $score;
$result2 = @mysql_query("UPDATE links SET rate = '$rate', rating = '$rating' WHERE link_id = '$link_id'");

mysql_query ("INSERT INTO vote (date, host, linkID) VALUES (NOW(),'$client','$link_id')"); 

	if ($rate > 0)
	{
		$arate = sprintf ("%.2f", ($rating / $rate));
	}
	else
	{
		$arate = '0';
	}
?>

<center><table width='<? echo "$tablewidth"; ?>' border='<? echo "$tableborder"; ?>' cellpadding=10 cellspacing=0 bordercolor='#000000'><tr>
<td class='standard'>
<font class='standard'><b><? echo $sitename ?> : Thank You</b></font><br><br>
<font class='text10'>
<ul type="square">
<li>Thank You for Rating - <a href='<? echo $link_url ?>' target='_blank'><b><? echo $link_name ?></b></a><br>
<li>You have rated  as <b><? echo $score ?></b>. <br>
<li>Link has been voted <b><? echo $rate ?></b> times, and has average of <b><? echo $arate ?></b>.<br>
<br><br><br>
<b><? echo $sitename ?></b><br>
Links Manager
</font>
</ul>
</td></tr></table></td></tr></table></center>

</td></tr></table>
</center>
<? include "footer.inc.php"; ?>
<?

exit;
}





if ($action=="deadlink")
{
$sitenames = "$sitename Dead Link";
include('header.inc.php');
?>
<center><table width='<? echo "$tablewidth"; ?>' border='<? echo "$tableborder"; ?>' cellpadding=10 cellspacing=0 bordercolor='#000000'><tr>
<td class='standard'>
<font class=standard><br><b><a href='links.php'><?=$sitename;?></a> : Broken Link</b><br>
<br>Thank you for reporting about broken Link.<br>
<form action="links.php?action=deadlinkthankyou" method ="POST">
<?
$mysql_mylink = mysql_connect($mysql_host, $mysql_user, $mysql_pass)
or die ("Cannot make the connection");
mysql_select_db($mysql_db, $mysql_mylink)
or die ("Cannot connect to the database");

$rime = mysql_query("SELECT * from links WHERE link_id=$link_id") 
or die(mysql_error());

while($row = mysql_fetch_array($rime)) {
extract($row);

echo "<li><font class=text10><a href='$link_url' target='_blank'>$link_name</a><br>$link_desc<br></font></li>";
echo "<input type = 'hidden' name = 'link_id' value='$link_id'><input type = 'hidden' name = 'cat_id' value='$cat_id'><input type = 'hidden' name = 'link_name' value='$link_name'>
<input type = 'hidden' name = 'link_url' value='$link_url'><input type = 'hidden' name = 'link_desc' value='$link_desc'><input type = 'hidden' name = 'link_email' value='$link_email'><br><input type = 'submit' value = 'Dead Link'>";
}
?>
</form>
</td></tr></table>
<? include "footer.inc.php"; ?>
<?
exit;
}




if ($action=="deadlinkthankyou")
{
$sitenames = "$sitename Dead Link Thank You";
include('header.inc.php');
?>
<center><table width='<? echo "$tablewidth"; ?>' border='<? echo "$tableborder"; ?>' cellpadding=10 cellspacing=0 bordercolor='#000000'><tr>
<td class='standard'><br><font class=standard><b><a href='links.php'><?=$sitename;?></a> : Thank You</b><br>
<?
$mysql_mylink = mysql_connect($mysql_host, $mysql_user, $mysql_pass)
or die ("Cannot make the connection");
mysql_select_db($mysql_db, $mysql_mylink)
or die ("Cannot connect to the database");

if (($link_id))
{
$sql_query = "SELECT * FROM links WHERE link_id = '$link_id";
$rime ="UPDATE links SET link_broken= 'yes' WHERE link_id=$link_id";
$result = mysql_query($rime);
echo "<br><br>Thank you for letting us know about the broken/dead link you found.<br><br><br>";
}
else
{
echo ("<br><font class=text12 color=red><b>You didnt enter any data.</b></font><br>");
}
?>
</td></tr></table>
</center>
<? include "footer.inc.php"; ?>
<?
exit;
}




if ($search)
{
$sitenames = "$sitename - Search Result for $search";
include('header.inc.php');
?>
<center><table width='<? echo "$tablewidth"; ?>' border='<? echo "$tableborder"; ?>' cellpadding=10 cellspacing=0 bordercolor='#000000'><tr>
<td class='standard'>
<table border=0 cellpadding=10 cellspacing=0 bordercolor=#000000><tr>
<td class="standard">

<p><script type="text/javascript"><!--
google_ad_client = "pub-5086004924530016";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
google_ad_channel = "";
google_color_border = "66FF99";
google_color_bg = "CCFFCC";
google_color_link = "0000FF";
google_color_text = "000000";
google_color_url = "008000";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>


<?
$mysql_mylink = mysql_connect($mysql_host, $mysql_user, $mysql_pass)
or die ("Cannot make the connection");
mysql_select_db($mysql_db, $mysql_mylink)
or die ("Cannot connect to the database");

$limit = $nolinkssearch;
$offset = ($offset) ? $offset : 0;

$searchwords = split ( "[ ,]", $search );   
$search = strtoupper($search);

echo "<b>$sitename : Admin : Search Links</b>";


$first = true;  
foreach ( $searchwords as $word )  
{ 
if ( $first )  
{  
$first = false; 
$like .= " WHERE ";  
}  
elseif ( $andor == "or" )  
$like .= " OR ";  
else  
$like .= " AND ";   
$word = chop ( $word );  

$like .= "link_val = 'yes' AND (link_id LIKE '%$word%' OR link_name LIKE '%$word%' OR  link_desc LIKE '%$word%' OR  link_keyword LIKE '%$word%' OR  link_url LIKE '%$word%' OR  link_pop LIKE '%$word%')";   
}

$words =$word;

     if (strlen($words) < 3) 
{
echo "<br><br>WEB RESULTS for <font color=orange><b>$search</b></font> resulted in the following matches : $totalnum links<br><br>";
?>



<center><table width='100%'><tr><td class=text10><br><form action='links.php?action=search' method=get>  Search Again : <input type=text name=search>   <select NAME=andor><option>and<option>or</select>   <input type=submit value=search></form></td></tr></table>
<font class=text8>* Note : Last word must contain at least 3 characters.</font>
</td></tr></table></td></tr></table></center>
<?

} else {

$rime1 = mysql_query("SELECT COUNT(*) from links $like") or die(mysql_error());
$totalnum = mysql_result($rime1, 0, 0);

echo "<br><br>WEB RESULTS for <font color=orange><b>$search</b></font> resulted in the following matches : $totalnum links<br><br>";

$linnk = $nolinkssearch*25;

if ($totalnum <= $linnk){
$totalnum = $totalnum;
}else{
$totalnum =$linnk;
}

//$rime=mysql_query("SELECT *,(rating/rate) AS arate FROM links WHERE link_val = 'yes' AND rate>$noratetop //ORDER BY arate DESC, hits DESC LIMIT $nolinkstop");

$rime = mysql_query ("SELECT *,(rating/rate) AS arate  FROM links  $like  ORDER BY hits DESC, arate DESC LIMIT $offset, $limit");  
while($row = mysql_fetch_array($rime)) {
extract($row);

echo " <font class=text10><b><a href='http://$siteurl/links.php?action=rated&link_id=$link_id' target='_blank'>$link_name</b></a></font><br>";
echo " <font class=text9>$link_desc</font><br>";
}

$query = $search;
$query1 = $andor;

ShowNav($totalnum, $query, $offset, $limit, $query1);
?>

<p><script type="text/javascript"><!--
google_ad_client = "pub-5086004924530016";
google_ad_width = 728;
google_ad_height = 90;
google_ad_format = "728x90_as";
google_ad_type = "text_image";
google_ad_channel = "";
google_color_border = "66FF99";
google_color_bg = "CCFFCC";
google_color_link = "0000FF";
google_color_text = "000000";
google_color_url = "008000";
//--></script>
<script type="text/javascript"
  src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script></p>

<table width='100%'><tr><td class=text10><br><form action='links.php?action=search' method=get>  Search Again : <input type=text name=search>   <select NAME=andor><option>and<option>or</select>   <input type=submit value=search></form><br></td></tr></table>
<font class=text8>* Note : Last word must contain at least 3 characters.</font>
</td></tr></table></td></tr></table></center>
<?
}
}
?>
</td></tr></table></center>

<? include "footer.inc.php"; ?>

 

 

 

 

Link to comment
Share on other sites

Dear Daniel,

 

I did include all code because I am not sure where the problem is.

I guess it is only the first 20 sentences of the code that contains the problem.

The most bizarre of all this is, that the script used to work just fine until the server update.

I have tried your idea, but it still did not work :-(

 

Kind regards,

Ozzy

Link to comment
Share on other sites

Hi cooldude832,

 

I don't see any caps...

 

Here is the paramtercode. Is something with this code? (I replaced the mysql password)

 

Kind regards,

Ozzy

 

<?

$mysql_host = "sql06.backbone.tiscomhosting.nl"; // Your mySQL server host address

$mysql_user = "planthunter"; // Your mySQL username

$mysql_pass = "xxxxxx"; // Your mySQL password

$mysql_db = "planthunteronl-com"; // The name of the database to use .You can change in diferent name

$siteurl = "www.planthunteronline.com/directory"; // URL for your site (exp. altavista.com/links)

$webmaster = "info@planthunteronline.com"; // Your e-mail adrress

$PHP_SELF = "links.php"; //Name of your links script

Link to comment
Share on other sites

Hi cooldude832 and Daniel0,

 

First of all thanks for your help so far.

I did change the settings of the folder allowing the execute option.

It still doens't work.

I remember that the script is written in php 4 where the server is running php 5. Is this difference in version fatal for the script to work properly?

Any help would be appreciated.

 

Kind regards,

Ozzy Salden

Link to comment
Share on other sites

the error is being generated from this:

 

<?php 
include ("usr/local/lib/php/index.php");
?>

 

the ability to include this file may have been hard coded in your server configs

or it was relative to the script.

 

if this file isn't off your root dir (which it doesn't appear to be) then you could try backtracking a bit.

 

<?php 


include ("../../usr/local/lib/php/index.php");

// or since you have an include path already defined: (include_path='.:/usr/local/lib/php')
// this might work also:
include_once 'index.php'; 

// or 
include_once '/usr/local/lib/php/index.php'; 
?>

 

ps Daniel0,  the user did put his code in code tags, this forum doesn't show syntax highlighting if the opening php tag is in short hand. don't hate on the player, hate on the game.  (also you could just copy it into your editor, which is usually a lot more helpful then a small scrolling area.

 

good luck to ya's

Link to comment
Share on other sites

ps Daniel0,  the user did put his code in code tags, this forum doesn't show syntax highlighting if the opening php tag is in short hand. don't hate on the player, hate on the game.  (also you could just copy it into your editor, which is usually a lot more helpful then a small scrolling area.

 

No he didn't... Barand edited it and added the code tags ;)

Link to comment
Share on other sites

mt input would be that because it happened when your host did an upgrade eather A The might have changed you base directory for example

/var/www/g28894/planthunteronline.com/HTML/directory/links.php

might have become

/home/g28894/planthunteronline.com/HTML/directory/links.php

 

that was just an example so don't quote me on it the other things is they may have accidentally remove permissions on that folder OR dropped you as the owner of the folder (my host did it to me) i dont think the problem would be directly related to the script would suggest logeing a tick with host along the lines of

 

"can you please tell me if

/var/www/g28894/planthunteronline.com/HTML/directory/links.php

exists and whether i have read access to that file"

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.