Reply to Re: rewrite this a little better

Your name:

Reply:


Posted by windandwaves on 12/04/06 18:03

Geoff Berrow wrote:
> Message-ID: <QhYch.24$qf4.0@newsfe02.lga> from Steve contained the
> following:
>
> >that's all you get until you state what it is you're actually wanting the
> >function to do. i'm not going to read your function to try and find out. i
> >have much better things to do with my time...of which you should be
> >considerate since you're not paying for an answer.
>
> That was my reaction too.


Hi Gurus

Sorry about that. Basically, I wrote the function because part of my
site should be on a secure server and part of it on a normal server.

In order to achieve this, I identified two pages that should instigate
a switch between the secure and the non-secure sites. Note that both
sites have exactly the same stuff on them.

$normalurl = the standard site url
$normalswitchpage = the page that, when people open it, should
instigate the switch back to the normal site (e.g. index.php)
$secureurl = the secure server url
$secureswitchpage = the page that should instigate the switch to the
secure server (e.g. cart.php)
I also pass the $_GET variables to add those the file and I use an
extra function to find out the current file.

Hope it makes more sense now.

Thank you

function secureswitch($normalurl, $normalswitchpage, $secureurl,
$secureswitchpage, $_GET) {
$currentfile = file_currentfilename("?");
$redirectfile = $currentfile.'?';
foreach($_GET as $key=>$value) {
$redirectfile .= "&$key=$value";
}
$currentserver = 'http://'.$_SERVER['HTTP_HOST']."/";
$isnormalswitchpage = strpos($currentfile, $normalswitchpage);
$issecureswitchpage = strpos($currentfile, $secureswitchpage);
if($isnormalswitchpage !== false && $currentserver != $normalurl) {
//switch to normal
$goto = $normalurl.$redirectfile;
header("location: $goto");
}
else {
$testurl = str_replace("https", "http", $secureurl);
if($issecureswitchpage !== false && $currentserver != $testurl) {
//switch to secure
$goto = $secureurl.dd_secure_extension.$redirectfile;
header("location: $goto");
}
}



}

[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

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