Page 1 of 1

not redirecting

Posted: Fri Aug 31, 2007 9:23 am
by m2babaey
Hi
I use a page for some analysis and then redirect the user to the correct url. but the users are not redirected.
the first url that is called is similar to:
http://127.0.0.1/adcenter/clicks.php?ad ... &listing=8
and the page clicks.php is :

Code: Select all

<?php
include 'global.php';
$adid=clean($_GET['adid']);
$publisher=clean($_GET['publisher']);
$advertiser=clean($_GET['advertiser']);
$listing=clean($_GET['listing']);
$sql="SELECT * FROM adsetting WHERE id='$adid'";
$result=mysql_query($sql)or die (mysql_error());
$row=mysql_fetch_array($result);
$keyword=$row['keyword'];
$price=getcost($keyword,$listing);
$sql2="SELECT * FROM advertiser WHERE id='$advertiser' ";
$result2=mysql_query($sql2) or die (mysql_error());
$row2=mysql_fetch_array($result2);
$advertiserbalance=$row2['balance'];
if ($advertiserbalance<$price) echo "The advertiser does not have enough balance in his/her account";
else{
$advertiserbalance-=$price;
$sql3="SELECT * FROM publisher WHERE id='$publisher' ";
$result3=mysql_query($sql3) or die (mysql_error());
$row3=mysql_fetch_array($result3);
$publisherbalance=$row3['balance'];
$price=$price*3/4 ;
$publisherbalance+=$price;
$sqlu1= "UPDATE advertiser SET balance='$advertiserbalance' WHERE id='$advertiser'";
$resultup1=mysql_query($sqlu1) or die(mysql_error()) ;
if (!$resultup1) echo "There was a problem during the analysis. Please contact us to inform aout the issue";
else{
$sqlu2= "UPDATE publisher SET balance='$publisherbalance' WHERE id='$publisher'";
$resultup2=mysql_query($sqlu2) or die(mysql_error()) ;
$sql4="SELECT * FROM listing WHERE id='$listing' ";
$result4=mysql_query($sql4) or die (mysql_error());
$row4=mysql_fetch_array($result4);
$url=$row4['url'];
header("Location : $url "); 
}
}
?>
when i enter that url in the address bar, the result is not $url. why?

Posted: Fri Aug 31, 2007 9:30 am
by mcog_esteban
Instead of

Code: Select all

header("Location : $url ");

Code: Select all

header("Location: $url");

Posted: Fri Aug 31, 2007 9:31 am
by Begby
What is happening? Are you getting a blank page? You getting any errors?

Posted: Fri Aug 31, 2007 9:38 am
by m2babaey
yes
a blank page

Posted: Fri Aug 31, 2007 9:40 am
by Zoxive

Code: Select all

 ....
echo $url; // Is it outputting a correct url?
//header("Location: $url");

Posted: Fri Aug 31, 2007 9:41 am
by m2babaey
i tested it before.
it echoes the $url so the right if statement is running

Posted: Fri Aug 31, 2007 9:41 am
by mcog_esteban
I've tryed

Code: Select all

header("Location : $url");
and got a HTTP/1.1" 200 -
But with a blank.

Sorry...got mistaken.

Posted: Fri Aug 31, 2007 4:49 pm
by m2babaey
mcog_esteban wrote:I've tryed

Code: Select all

header("Location : $url");
and got a HTTP/1.1" 200 -
But with a blank.

Sorry...got mistaken.
what does it mean?