Search code examples
phpmeta

meta redirect with php inside


I have a php file. In it I want an error redirect like this:

<?php

$ponka = somerandomsite.com;

if (1=1)
    {echo '<META HTTP-EQUIV="Refresh" Content="0; URL=http://$ponka/error.php">'}
?>

How can I achieve it?


Solution

  • You php contains lots of errors, here's a working sample

    <?php
    $site = $_GET['site'] // will get the variable $site form a url like script.php?site=somerandomsite.com
    $ponka = "somerandomsite.com";
    
    if ($site == $ponka){
        echo "<META HTTP-EQUIV='Refresh' Content='0; URL=http://$ponka/error.php'>";
    }
    ?>
    

    Also, remeber that php as a function called header

    <?php
    $site = $_GET['site'] // will get the variable $site form a url like script.php?site=somerandomsite.com
    $ponka = "somerandomsite.com";
    if ($site == $ponka){
       header("Location: http://$ponka/error.php");
    }
    ?>