I am working with coupon script in php. In this i have to redirect my url 127.0.0.1/couponsite/go/1 to http://www.ebay.com and what is happening is 127.0.0.1/couponsite/go/1 redirected to 127.0.0.1/couponsite/go/1/www.ebay.com
where 1 is mapped with http://www.ebay.com
similarly 2 is mapped with http://www.someotherweb.com like this.
So i want to know in which part of my script is the error? I need help regarding this. Hope its not related to .htaccess in anyway. i have a file out.php which is handling all redirect. posting the code of out.php below.
<?php
if ( intval ( $qstring[1] ) < 0 )
exit( "No coupon selected." );
if ( $web == "Website" )
{
$web = $data->select ( "Website" , "*" , array ( "WebsiteID" => intval ( $qstring[1] ) ) ) ;
$web = $web[0] ;
if ( ! empty ( $web ) )
{
$data->update ( "Website" , array ( "Views" => intval ( $web["Views"] ) + 1 ) , array ( "WebsiteID" => intval ( $web["WebsiteID"] ) ) ) ;
header ( "location:".$web["AffilateURL"] ) ;
exit();
}
else
{
exit ( "Website not found. " ) ;
}
}
elseif ( $tag == "Tag" )
{
$offer_id = $qstring[1] ;
$offer = $data->select ( "Tag_Offers" , "*" , array ( "Tag_OffersID" => intval ( $offer_id ) ) ) ;
$offer = $offer[0] ;
if ( ! empty ( $offer ) )
{
header ( "location:".$offer["LandingPage"] ) ;
exit ( ) ;
}
else
{
exit ( "Offer not found" ) ;
}
}
elseif ( $tag == "WOffer" )
{
$offer_id = $qstring[1] ;
$offer = $data->select ( "Website_Offers" , "*" , array ( "Website_OffersID" => intval ( $offer_id ) ) ) ;
$offer = $offer[0] ;
if ( ! empty ( $offer ) )
{
header ( "location:".$offer["LandingPage"] ) ;
exit ( ) ;
}
else
{
exit ( "Offer not found" ) ;
}
}
else
{
$coupon_id = $qstring[1] ;
$coupon = $data->select ( "Coupon" , "*" , array ( "CouponID" => intval ( $qstring[1] ) ) ) ;
$coupon = $coupon[0] ;
if ( ! empty ( $coupon ) )
{
$web = $data->select ( "Website" , "*" , array ( "WebsiteID" => intval ( $coupon["WebsiteID"] ) ) ) ;
$web = $web[0] ;
if ( ! empty ( $web ) )
{
$data->update ( "Website" , array ( "Views" => intval ( $web["Views"] ) + 1 ) , array ( "WebsiteID" => intval ( $coupon["WebsiteID"] ) ) ) ;
header ( "location:".$web["AffilateURL"] ) ;
exit();
}
else
{
exit ( "Website not found." ) ;
}
}
else
{
exit ( "Coupon not found." ) ;
}
}
?>
Additional information: I am using Wamp
Try adding a protocol (“http://”) before the address.