0

PHP CODE:

<?php
$referrer = $_SERVER['HTTP_REFERER'];
if (strpos($referrer, "bonaca.net46.net") === FALSE
    || !($_POST['pass'] == 1405 || $_POST['pass'] == 999)
{
    header('Location: index.php');
};
?>

What I need:

If user comes from another page than bonaca... OR he typed wrong pass (correct pass are 1405 or 999) he should be redirected.

What I got:

Parse error: syntax error, unexpected '{' in... on line 5

0

5 Answers 5

1

You are missing a paranthesis for your if statement .. here

1405 || $_POST['pass'] == 999))
                              ^ //<---- Add like this

and don't need a semicolon here

  header('Location: index.php');
}; //<---- Remove that
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks to all. Solved
1

One of your conditions is outside the if statement, try:

if ((strpos($referrer, "bonaca.net46.net") === FALSE
    || !($_POST['pass'] == 1405 || $_POST['pass'] == 999))

Comments

1

You miss if condition ).Try this code .

$referrer = $_SERVER['HTTP_REFERER'];
if (strpos($referrer, "bonaca.net46.net") === FALSE
    || !($_POST['pass'] == 1405 || $_POST['pass'] == 999))
{
    header('Location: index.php');
}

Comments

1
Use this code

<?php
  $referrer = $_SERVER['HTTP_REFERER'];
      if (strpos($referrer, "bonaca.net46.net") === FALSE
          || !($_POST['pass'] == 1405 || $_POST['pass'] == 999)){
        header('Location: index.php');
     }

?>

Comments

1
<?php

   $referrer = $_SERVER['HTTP_REFERER'];
    if (strpos($referrer, "bonaca.net46.net") === FALSE
        || !($_POST['pass'] == 1405 || $_POST['pass'] == 999))
    {
        header('Location: index.php');
    }
?>

try with this.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.