Archive for May, 2010

PHP multiple equal case switch syntax

Tuesday, May 4th, 2010

switch($holder)
{
case “”:
case “http://www.cuealex.com/digitalcatalog”:
case “http://www.iealex.com/digitalcatalog/”:
echo “<script>alert(‘http referer: none’);</script>”;
if(isset($_SESSION[‘enews_refer_value’]))
{
echo “<script>alert(‘but enews_refer_value WAS set, so it stays’);</script>”;
$enews_refer_value = $_SESSION[‘enews_refer_value’];
}
else { $enews_refer_value = “”; }
break;
default:
echo “<script>alert(‘set enews_refer_value session to http_referer’);</script>”;
$_SESSION[‘enews_refer_value’] = $_SERVER[‘HTTP_REFERER’];
$enews_refer_value = $_SESSION[‘enews_refer_value’];
break;
}