KConstantin
KConstantin

Reputation: 31

php redirect with appended GET

Trying to redirect while sending along these variables with the redirect. not sure where I messed up the syntax.it's in a php file alone so no closing bracket

<?php
header("Location:http://trax.shabimedia.com/click.php?c=1&key=qykpiqe6qquv1tejw82aqpb9&    c1=".$_GET['c1']."&c2=".$_GET['c2']."&c3=".$_GET['c3']."&c4=".$_GET['c4']."&c5=".$_GET['c5'].);

Upvotes: 0

Views: 98

Answers (3)

Green Black
Green Black

Reputation: 5084

Try to encode your url, and remove the last dot. The last dots tells PHP that there will be more things to parse, like a string or variable (and there is no more, so you get an error). Urlencode makes sure your url will be correct. And make sure you have an exit after a header redirect, to make sure the code that comes after the redirect wil not be executed.

    <?php
    if( is_array( $_GET) ){
     foreach( $_GET as $id => $val){
      $_GET[$id] = urlencode( $val );
     }

      header("Location:http://trax.shabimedia.com/click.php?c=1&key=qykpiqe6qquv1tejw82aqpb9&c1=".
      $_GET['c1']."&c2=".$_GET['c2'].
      "&c3=".$_GET['c3'].
      "&c4=".$_GET['c4'].
      "&c5=".$_GET['c5']);
      exit;
    }

Upvotes: 1

Niet the Dark Absol
Niet the Dark Absol

Reputation: 324600

As mentioned in several comments, you have an extra . just before the final ) at the end of your line of code. Remove it.

Upvotes: 0

Pedro del Sol
Pedro del Sol

Reputation: 2841

you've included an extra dot at the end of your string.

<?php
header("Location:http://trax.shabimedia.com/click.php?c=1&key=qykpiqe6qquv1tejw82aqpb9&c1=".$_GET['c1']."&c2=".$_GET['c2']."&c3=".$_GET['c3']."&c4=".$_GET['c4']."&c5=".$_GET['c5']);

Upvotes: 0

Related Questions