Created
December 20, 2010 15:38
-
-
Save aonic/748524 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
//$url['url'] is the URL as saved in urls table, it has * in it | |
$temp = preg_quote($url['url'], '/'); | |
$temp = str_replace('\\*','(.*?)',$temp); //Replacing * with (.*?) | |
$urlToMatch = "/^{$temp}$/"; //Adding /^ and $/ to make preg_match work, ^ and $ are important | |
//Part taken from old code | |
$page_requesting = remove_last_slash(remove_index_etc(strip_www($page_requesting))); | |
$basic_page = remove_last_slash(remove_index_etc(strip_www(remove_query_params($page_requesting)))); | |
//RegEx matching code | |
//$experimentIDs is an array with list of running experiments, its all part of loops and all.. here just simple version | |
if($url['url_has_query_param'] == 1) { | |
//URL has query Params | |
if(preg_match($urlToMatch , $page_requesting)) { | |
$experimentIDs[] = $url['experiment_id']; | |
} | |
} | |
elseif($url['url_has_query_param'] == 0) { | |
//URL has no query Params | |
if(preg_match($urlToMatch , $basic_page)) { | |
$experimentIDs[] = $url['experiment_id']; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment