Reply to redirect.php maligns redirection URL every time

Your name:

Reply:


Posted by comp.lang.php on 10/26/06 17:33

[PHP]
require_once("/users/ppowell/web/php_global_vars.php");

if ($_GET['id']) {

// INITIALIZE VARS
$fileID = @fopen("$userPath/xml/redirect.xml", 'r');
$stuff = @fread($fileID, @filesize("$userPath/xml/redirect.xml"));
@fclose($fileID);

// XML PARSE
$parser = xml_parser_create();
@xml_parse_into_struct($parser, $stuff, $redirectArray, $tags);
@xml_parser_free($parser);


/*------------------------------------------------------------------------------------------
This will assume that the entire 3-dim XML-parsed array will have
as its outer key the
same ID value found in the 'id' attribute in the innermost array.
This means you cannot
ever delete any row from redirect.xml unless you renumber!

-------------------------------------------------------------------------------------------*/

$url = $redirectArray[$id]['attributes']['URL'];
if (trim($redirectArray[$id]['attributes']['QUERY_STRING']) !== '?')
$url .= '?';
$url .= preg_replace('/=/i', '=',
$redirectArray[$id]['attributes']['QUERY_STRING']);
$url = preg_replace('/\/$/', '', $url); // REMOVE TRAILING / TO
ACCOMMODATE QUERY STRING AND/OR ANCHOR

if (preg_match('/^http/i', $url)) {
echo "<script type=\"text/javascript\">\n<!--\n location.href=\"" .
str_replace('"', '&quot;', $url) . "\";\n //-->\n</script>\n" .
"<noscript><meta http-equiv=\"Refresh\" content=\"0:URL=" .
str_replace('"', '&quot;', $url) . "\"></noscript>\n";
}

}

[/PHP]

If the URL happens to be this:

http://the-nordic-one.livejournal.com#alchemymemory10242006

Instead it winds up looking like this every single time:

http://the-nordic-one.livejournal.com/#alchemymemory10242006?

I know for a fact that redirect.xml has the correct information:

<pre>
<?xml version="1.0" encoding="utf-8" ?><redirections><redirection
id="1"
url="http://valsignalandet.com/http://valsignalandet.com/cgi-bin/cgiwrap/ppowell/te
xt.cgi"
query_string="path=studies&amp;name=madonnacrucifixion.txt"></redirection><redirection
id="2" url="http://the-nordic-one.livejournal.com#alchemymemo
ry10242006" query_string="?"></redirection></redirections>
</pre>

But the URL is maligned every single time upon redirection. Is there a
way to prevent this from happening?

Thanx
Phil

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация