Jump to content

Parse error: syntax error, unexpected T_IF


ladygreen

Recommended Posts

Hi.. Im new here, but read your forum alot!  I am having a PHP issue and getting an error.  Here is the script:

 

function check_referer($referers)

{

global $errors;

if (count($referers)) {

if (getenv('HTTP_REFERER')) {

$temp = explode('/', getenv('HTTP_REFERER'));

$found = false;

while (list(,$stored_referer) = each($referers)) {

preg_match if (preg_match('^' . $stored_referer . '$', $temp[2])) $found = true;

}

 

The RED line is the issue.  Driving me crazy! 

Link to comment
Share on other sites

I have had the same script running on a website for several years.  All of a sudden one day.... I started getting errors on it. They are below:

 

Deprecated: Function eregi() is deprecated in /home/content/r/e/l/relfingrp/html/scripts/formmail.php on line 94

 

Deprecated: Function eregi() is deprecated in /home/content/r/e/l/relfingrp/html/scripts/formmail.php on line 94

 

Deprecated: Function eregi() is deprecated in /home/content/r/e/l/relfingrp/html/scripts/formmail.php on line 94

 

Deprecated: Function eregi() is deprecated in /home/content/r/e/l/relfingrp/html/scripts/formmail.php on line 130

 

Deprecated: Function eregi() is deprecated in /home/content/r/e/l/relfingrp/html/scripts/formmail.php on line 130

 

Deprecated: Function eregi() is deprecated in /home/content/r/e/l/relfingrp/html/scripts/formmail.php on line 130

 

Deprecated: Function eregi() is deprecated in /home/content/r/e/l/relfingrp/html/scripts/formmail.php on line 130

 

Warning: Cannot modify header information - headers already sent by (output started at /home/content/r/e/l/relfingrp/html/scripts/formmail.php:94) in /home/content/r/e/l/relfingrp/html/scripts/formmail.php on line 500

 

 

I asked a friend for help, and he put in the preg_match code.... then the only error I got was the one I started this post with.  This error is causing the forms not to work :( They do not send the form to the email.

Link to comment
Share on other sites

Good grief, I gave the answer in the first reply.  Maybe it needs a repeat, and/or clarification.

preg_match   /*<=====  if that is really in your script, you need to remove it...*/        if (preg_match('^' . $stored_referer . '$', $temp[2]))               $found = true;

 

Read the comment, look at where it is pointing.  If that "preg_match" really resides as the first line of your IF clause, then remove it, it is invalid syntax as it is a function call without arguments.

Link to comment
Share on other sites

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.