Jump to content

Search Referring URL for phrase, If...Else


skatecrazzy

Recommended Posts

 

OK, so I'm new to PHP.  If anyone can help me it would be GREATLY appreciated! 

 

I already set up a password protected area on my site using php.  However, a web conferencing service I use cannot access password protected pages and I need it to.  I am trying to run a string search and an If...Else statement  (If referring HTTP includes "phrase" do nothing, Else require login.)

 

Here's the code I have so far...what am I missing that the web conferencing program uses the "Else" not the "If"?

Wont this work to search the referring url for "searchparameter"? 

 

<?php

$referer = $_SERVER['HTTP_REFERER'];

$pattern = '/^searchparameter/';

if (preg_match($pattern, $referer))

{

;

}

else

{

include("password_protection_file...");

}

?>

 

 

Thank you so much for any help you may be able to provide!

 

-skatecrazzy

 

Link to comment
https://forums.phpfreaks.com/topic/156912-search-referring-url-for-phrase-ifelse/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.