I have an editxml.php file that takes this code:
Code: Select all
<img src="RLW_001.jpg" title="Please click on photograph to purhase" caption="RLW_001.jpg" link="" />Code: Select all
<img src="BST 001.jpg" title="Please click on photograph to purchase" caption="BST 001.jpg" link="javascript:NewWindow=window.open('/Payment_page2.php?name=BST 001.jpg&album=Brighton speed trials 2006','myWindow','width=300,height=660,toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes');NewWindow.focus(); void(0);" />Code: Select all
<img src="ECO_007.jpg" title="Please click on Photograph to purchase" caption="ECO_007.jpg" link="http://www.michaelshuttleworth.com/Payment_page2.php?name=ECO_007.jpg&album=Ecofair_2006" target="_self" />Here is the editxml.php code that needs changing:
Code: Select all
<html>
<head>
<title>PHP Test</title>
</head>
<body>
<?php
$file = "images.xml";
$descriptor = fopen ($file, "r");
$contents = fread($descriptor , filesize($file));
$album = '';
$pos1 = strpos($contents, 'javascript:NewWindow');
if ($pos1 == false) {
$pieces = explode('link=""', $contents);
$op = "";
for ($i = 0; $i < count($pieces); $i++) {
$tnpos = strpos($pieces[$i], 'tnPath="');
if ($tnpos !== false)
{
$titpos = strpos($pieces[$i], 'ssp_director/albums/', $tnpos);
$titpos += 20;
$titend = strpos($pieces[$i], '/', $titpos) - $titpos;
$album = substr($pieces[$i], $titpos, $titend);
//echo $album;
}
$halves = explode('<img src="', $pieces[$i]);
$fileid = substr($halves[1], 0, 7);
if (count($halves) > 1) {
$halves[0] .= '<img src="';
$pos1 = strpos($halves[1], 'unavailable');
if ($pos1 == false) {
$halves[1] .= "link=\"javascript:NewWindow=window.open('/Payment_page.php?name=" . $fileid . ".jpg&album=" . $album . "','myWindow','width=300,height=730,toolbar=no,location=no,status=yes,menubar=no,scrollbars=yes,resizable=yes');NewWindow.focus(); void(0);\"";
} else {
$halves[1] .= 'link=""';
}
}
$op .= $halves[0] . $halves[1];
}
fclose($descriptor);
unlink($file);
//$descriptor = fopen ('images.txt', "w");
$descriptor = fopen ($file, "w");
fwrite($descriptor,$op);
echo 'done! ';
echo count($pieces);
echo ' pieces processed';
fclose($descriptor);
} else {
echo 'This file has been processed already';
}
?>
</body>
</html> If anyone out there can show me what to change i would be so so grateful.
Many thanks
Mike