Reply to rewrite this a little better

Your name:

Reply:


Posted by windandwaves on 12/04/06 07:05

Can someone rewrite the function below. I am sure this can be done so
much easier! Note that the dd_... are constants.

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");
}
}
}

function file_currentfilename($cutoff = "?") {
$file = explode($cutoff, basename($_SERVER['PHP_SELF']));
return $file[0];
}

[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

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