Hello All,
I want to confirm that the user is registered member before he is redirected to download link. How do i read URL stored in DB and redirect user to this URL in PHP, if there is no product with that id it will show message product not found
User will click on link like
www.url.com/download.php?do=12 where 12 no is product id, Now @ download.php it will check wheter the user has logged in or not, if not he will be redirected to login page, else it will read download URL from db and redirect to that link.
i tried to rite following code but it is no functioning properly.
[PHP]
<?php
include("config.php");
include("head.php");
if(!isset($_COOKIE['userId'])) echo '<script>window.location="login.php"</script>';
$id=$_GET['Id'];
$sql=mysql_query("SELECT * FROM affiliate_planpages WHERE ppageId='".$id."' AND status='u'")or die(mysql_error());
$fetch=mysql_fetch_array($sql);
if(isset($_GET['do']))
{
$Do=$_GET['do'];
$sql12=mysql_query("SELECT * FROM affiliate_product WHERE productId='".$Do."'")or die(mysql_error());
$fetch=mysql_fetch_array($sql12);
echo '<script>window.location="$fetch[dlink]"</script>';
}
else
{
echo "<strong>Product Not Found</strong> ";
}
include("foot.php"); ?>
[/PHP]
the database structure is as follows
[PHP]CREATE TABLE `affiliate_product` (
`productId` int(10) NOT NULL auto_increment,
`title` varchar(200) NOT NULL default '',
`dlink` varchar(200) NOT NULL default '',
`imgurl` varchar(200) NOT NULL default '',
`price` varchar(200) NOT NULL default '',
`description` text NOT NULL,
`pr` varchar(100) NOT NULL default '',
PRIMARY KEY (`productId`)
) AUTO_INCREMENT=1 ;[/PHP]
Also is there any way by which end user never comes to know the actual URL, i.e even during download progress the URL shown will be www.url.com/download.php?do=12
Thanxs in advance,
Best Regards,
Ritesh Jain