Jump to content

Recommended Posts

I have the following function, which I'm struggling to convert:

 

 

/******************************************************/
function start() {
global $dpath, $rb_head, $rb_foot, $siteurl;
/******************************************************/

include("$dpath$rb_head");

$ip = getenv ("REMOTE_ADDR");
$urllink = getenv("HTTP_REFERER");

if (!ereg("$siteurl", "$urllink")) {
$urllink2 = "$siteurl";
//echo "<br /><b>Page being Referred</b>: <a href=$urllink2>$urllink2</a>\n";
}
else {
$urllink2 = "$urllink";
//echo "<br /><b>Page being Referred</b>: <a href=$urllink2>$urllink2</a>\n";
}

include("rb_form.php");
crkdo();
include("$dpath$rb_foot");

}

 

Any help would be appreciated.

 

Duncan

Edited by Zane

Without knowing the exact values of $siteurl and $urllink, I'd say that you probably should be using stripos instead.

 

If you actually need regular expressions then (1) use preg_match and (2) you have to fix $siteurl so it's a PCRE expression.

Thank you so much for your help. Using stripos was what I needed. This is the amended code:

 

 

if (stripos($siteurl, "$urllink")) {

$urllink2 = "$siteurl";

//echo "<br /><b>Page being Referred</b>: <a href=$urllink2>$urllink2</a>\n";

}

 

Thanks,

Duncan

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.