error for linkman although admin.php work

Problems installing LinkMan?
len
Posts: 7
Joined: Tue Nov 20, 2007 4:50 pm

Post by len »

DC wrote:Hi can you try this replace all the code in your approve.php file with this.
It is a very slightly modified version, of the orig i use in my mod version ...
But I am curious if it works for you.

If this works then maybe Klem can figure out why?
as theres nothing that I know of that would cause that prob in this file.

Code: Select all


<?php
/*******************************************************************************
*  Title: LinkMan reciprocal link manager
*  Version: 1.7a @ April 18, 2009
*  Author: Klemen Stirn
*  Website: http://www.phpjunkyard.com
********************************************************************************
*  COPYRIGHT NOTICE
*  Copyright 2004-2009 Klemen Stirn. All Rights Reserved.
*
*  This script may be used and modified free of charge by anyone
*  AS LONG AS COPYRIGHT NOTICES AND ALL THE COMMENTS REMAIN INTACT.
*  By using this code you agree to indemnify Klemen Stirn from any
*  liability that might arise from it's use.
*
*  Selling the code for this program, in part or full, without prior
*  written consent is expressly forbidden. Using this code, in part or full,
*  to create competing scripts or products is expressly forbidden.
*
*  Obtain permission before redistributing this software over the Internet
*  or in any other medium. In all cases copyright and header must remain
*  intact. This Copyright is in full effect in any country that has
*  International Trade Agreements with the United States of America or
*  with the European Union.
*
*  Removing any of the copyright notices without purchasing a license
*  is illegal! To remove PHPJunkyard copyright notice you must purchase a
*  license for this script. For more information on how to obtain a license
*  please visit the site below:
*  http://www.phpjunkyard.com/copyright-removal.php
*******************************************************************************/

define('IN_SCRIPT',1);
require('settings.php');

$approve = intval($_GET['approve']);

$hash = pj_input($_GET['id'],'Missing ID hash. Please make sure you copy the full approval/rejection URL!');
$hash = preg_replace('/[^a-z0-9]/','',$hash);
$file = 'apptmp/'.$hash.'.txt';

/* Check if the file hash is correct */
if (!file_exists($file)){
problem('Wrong link ID hash. Possible problems:<br><br>• The link has already been approved or rejected<br>• You didn\'t copy the full approval/rejection URL');
}

/* Reject the link */
if (!$approve){
unlink($file);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" type="text/css" href="style.css">
<title>Link Rejected!</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" valign="middle"><br><BR>
      <table width="400" height="150" cellpadding="5" cellspacing="0">
        <tr>
          <td height="25" align="center" class="head">Link Rejected!</td>
        </tr>
        <tr>
          <td align="left" class="dol"><br>            <br>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="14%"><img src="images/imp.gif" border="0"></td>
                  <td width="86%">The selected link has been rejected from the link exchange.</td>
                </tr>
            </table>            
           <br><br>
          </td>
        </tr>
      </table>
      <br></td>
  </tr>
</table>
</body>
</html>
<?php
	exit();
}


/* Approve link */
$replacement = trim(@file_get_contents('apptmp/'.$hash.'.txt'));
if (empty($replacement)){
problem('This link doesn\'t exist or has already been approved or rejected!');
}

$replacement .= "\n";//Fixed

if ($settings['add_to'] == 0){
	$lines = file($settings['linkfile']);
	/* Make sure new link is added after any featured ones */
	$i = 0;
	foreach ($lines as $thisline){
		list($name2,$email2,$title2,$url2,$recurl2,$description2,$featured2,$pr2)=explode($settings['delimiter'],$thisline);
		$featured2 = $featured2 ? 1 : 0;
		if ($featured2 == 0){
			$lines[$i] = $replacement . $thisline;
			break;
		}
		$i++;
	}

	$replacement = implode('',$lines);
	$fp = fopen($settings['linkfile'],'w') or problem('Couldn\'t open links file for writing! Please CHMOD all txt files to 666 (rw-rw-rw)!');
	flock($fp, LOCK_EX);
	fputs($fp,$replacement);
	flock($fp, LOCK_UN);
	fclose($fp);
}else{
	$fp = fopen($settings['linkfile'],'a') or problem('Couldn\'t open links file for appending! Please CHMOD all txt files to 666 (rw-rw-rw)!');
	flock($fp, LOCK_EX);
	fputs($fp,$replacement);
	flock($fp, LOCK_UN);
	fclose($fp);
}

unlink($file);
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" type="text/css" href="style.css">
<title>Link Approved!</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" valign="middle"><br><BR>
      <table width="400" height="150" cellpadding="5" cellspacing="0">
        <tr>
          <td height="25" align="center" class="head">Link Approved!</td>
        </tr>
        <tr>
          <td align="left" class="dol"><br>            <br>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="14%"><img src="images/suc.gif" border="0"></td>
                  <td width="86%">The selected link has been approved and included in the link
                  exchange.</td>
                </tr>
            </table>            
           <br><br>
          </td>
        </tr>
      </table>
      <br></td>
  </tr>
</table>
</body>
</html>
<?php
exit();

/*** FUNCTIONS ***/

function problem($problem) {
echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<link rel="STYLESHEET" type="text/css" href="style.css">
<title>ERROR!</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" valign="middle"><br><BR>
      <table width="400" height="150" cellpadding="5" cellspacing="0">
        <tr>
          <td height="25" align="center" class="head">Error Detected!</td>
        </tr>
        <tr>
          <td align="left" class="dol"><br>            <br>
            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                <tr>
                  <td width="14%"><img src="images/err.gif" border="0"></td>
                  <td width="86%">'.$problem.'</td>
                </tr>
            </table>            
            <br><br>
          </td>
        </tr>
      </table>
      <br></td>
  </tr>
</table>
</body>
</html>';

exit();
}
?>

DC


Hi
I've added the code I now get the below

Missing ID hash. Please make sure you copy the full approval/rejection URL!

http://www.auctionsjust4weddings.co.uk/ ... pprove.php


Many thanks for any help!
Best Regards
Len
Best Regards
Len
DC
Posts: 138
Joined: Sun Dec 09, 2007 9:28 am

Post by DC »

Thats ok because your visiting the page directly with nothing to approve.
so the script sees no ID to check so no prob.

Try and approve somthing and it should work fine.
Also the missing image you see is just because your using my mod version and I have an image that shows a check so that is not a prob just incase you were wondering. So my quick test worked.

I just wanted to see if you got rid of ???????????????? and that the page loaded correctly which it does.

So the problem is in the code you have.

Now maybe Klem can tell us why :-)

DC
To Code Or Not To Code That Is The Question?

Was my post of any help to you? if so please do [url=http://www.clickcraft.net/slice_donations.php][b]Buy Me A Slice[/b][/url] ...
len
Posts: 7
Joined: Tue Nov 20, 2007 4:50 pm

Post by len »

DC wrote:Thats ok because your visiting the page directly with nothing to approve.
so the script sees no ID to check so no prob.

Try and aprove somthing and it should work fine.

I just wanted to see if you got rid of ????????????????
which my code did so the problem is in the code you have.

No maybe clem can tell us why :-)

DC
Hi
I've added a / to the end of the below.

http://www.auctionsjust4weddings.co.uk/ ... prove.php/


it now shows the approve text ok
have you got the two image icons
that should display?

I think were all done many thanks for all your help
it's much appreciated!
Best Regards
Len
DC
Posts: 138
Joined: Sun Dec 09, 2007 9:28 am

Post by DC »

You can use any icons you like I gave you my mod just to see if it would work the orig script has no icons.

So best bet if you want it to show just get some icons and re-name em to match ...

DC
To Code Or Not To Code That Is The Question?

Was my post of any help to you? if so please do [url=http://www.clickcraft.net/slice_donations.php][b]Buy Me A Slice[/b][/url] ...
len
Posts: 7
Joined: Tue Nov 20, 2007 4:50 pm

Post by len »

DC wrote:You can use any icons you like I gave you my mod just to see if it would work the orig script has no icons.

So best bet if you want it to show just get some icons and re-name em to match ...

DC

Hi
OK, thanks again for all your help!
Best Regards
Len
Post Reply