Come creare un bottone che permetta il download in base ad un id di mysql

romeocharly

Utente Attivo
11 Feb 2016
69
1
8
Buonasera grazie per l'attenzione,
è il mio primo messaggio, e probabilmente mi sto cimentando in qualcosa di molto più grosso di me.

Ho acquistato un software che però si presenta in versione DEMO. Inutile dire che il supporto non rispponde.
Si deve modificare index.php con uno script prelevato da social-traffic-pop.css. Vedrò di andare con ordine.

Il file readme.txt del software viral refer 2.0 dice:

Codice:
///////////////////////////////////////////
///////////////////////////////////////////

VIRAL REFER 2.0

///////////////////////////////////////////
///////////////////////////////////////////

Requirements:
- PHP 5+
- MYSQL 

//////////////////////////////////////////

MYSQL CODE

CREATE TABLE IF NOT EXISTS `users` (
  `id` int(11) NOT NULL auto_increment,
  `ip` text NOT NULL,
  `referrer` int(11) NOT NULL,
  `referrals` int(11) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

CREATE TABLE IF NOT EXISTS `prizes` (
  `id` int(11) NOT NULL auto_increment,
  `thumb` text NOT NULL,
  `name` text NOT NULL,
  `desc` text NOT NULL,
  `prize` text NOT NULL,
  `cost` int(11) NOT NULL,
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;

//////////////////////////////////////////


---------HOW TO INSTALL VIRAL REFER 2.0------------

1º Upload all files to your web hosting server
2º Go to your panel and create a Database and user in mysql
3º Now go to the folder "inc" and edit "config.php"
4º Then go to phpmyadmin and go up to your database and upload MYSQL CODE
5º The SOCIAL TRAFFIC POP is disabled by default. To activate go until the file "social-traffic-pop.css" and follow the steps
6º Now your site is set up and working properly! Go to http://yourwebsite.com/cpadmin and create their gifts and good luck !

If you have any questions please send us an email to support@viralrefer.com

Ho cambiato i parametri necessari nel file config.php, per potere accedere al db mysql. E creato le tabelle. provato funziona, carica i dati.

Il file social-traffic-pop.css contiene:

Codice:
/*
Post this script in <head> of index.php and active de social traffic pop

<script>

$(document).ready(function(){		
				
	$().socialTrafficPop({
		timeout: 15,
		title: "Viral Refer 2.0 - Demo",
		message: 'Share our website with your friends using the buttons below!',
		google_url: "http://www.viralrefer.com/demo/",
		fb_url: "http://www.viralrefer.com/demo/",
		closeable: false,
		advancedClose: false,
		opacity: '0.45',
		twitter_method: "tweet",
		tweet_url: 'http://www.viralrefer.com/demo/index.php?ref=1',
		tweet_text: 'Viral Refer 2.0 - Share your referral link with your friends and win amazing rewards!'
	});
	
});


</script>

*/
#stp-bg{
	display:none;
	position:fixed;
	_position:absolute; /* hack for IE 6*/
	height:100%;
	width:100%;
	top:0;
	left:0;
	background:#000000; 
	z-index:998;
}

#stp-main{
	position:fixed;
	top:220px;
	_position:absolute; /* hack for IE 6*/
	display:none;
	width:450px;
	border:7px solid #2f2f2f;
	background:#fff;
	z-index:999;
	-moz-border-radius: 9px;
	-webkit-border-radius: 9px;
	margin:0pt;
	padding:0pt;
	color:#333333;
	text-align:left;
	font-family:arial,sans-serif !important;
	font-size:13px;
}

#stp-title{
	font-family:"Lucida Sans Unicode", "Lucida Grande", sans-serif !important;
	font-size:18px;
	padding:13px 0 13px 0px;
	text-align: center;
}

#stp-close{
	float:right;
	font-size:14px;
	font-weight:bold;
	font-family:Verdana, Geneva, sans-serif;
	color:#777777 !important;
	margin:0 13px 0 0;
	border-bottom:0px !important;
	text-decoration:none !important;
}

#stp-close:hover{
	text-decoration:none !important;
}

#stp-msg{
	background:#4074CF;
	padding:10px 15px;
	color:#ffffff;
	font-family:Arial, Helvetica, sans-serif !important;
	font-weight:bold;
	line-height:20px;
	text-align: center;
}

#stp-buttons{
	margin:25px 0px 25px 0;
	padding:0 0 0 15px;
}

#stp-bottom{
	padding:15px 10px;
	background:#EFEFEF;
	color:#95989F;
	border-top:1px solid #DDE0E8;
}

#stp-counter{
	font-size:11px !important;
	text-align:right;
	font-weight:bold;
}

#stp-power{
	font-size:10px !important;
	color:#95989F;
	font-weight:normal;
	text-decoration:none;
}

#stp-power:hover{
	text-decoration:underline;
}

.stp-button{
	float:left;
	width:120px;
}

.step-clear{
	clear:both !important;
}

e devo inserire la prima parte, cioè lo script, nel file index.php; che ho modificato con i dati del mio sito in costruzione:

Codice:
<?php
session_start();
require_once("inc/funcs.php");
$ip = $_SERVER['REMOTE_ADDR'];
if(get_user($ip) == false){
	add_user($db,$ip, $_GET['ref']);
	$_SESSION['ip'] = $ip;
}
$user = mysql_fetch_object(mysql_query("SELECT * FROM `$db`.`users` WHERE `ip`='". $ip ."'"));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head><script>

$(document).ready(function(){		
				
	$().socialTrafficPop({
		timeout: 15,
		title: "Viral Refer 2.0 - Demo",
		message: 'Share our website with your friends using the buttons below!',
		google_url: "http://www.ebookwebproject.com/viralrefer/",
		fb_url: "http://www.ebookwebproject.com/viralrefer/",
		closeable: false,
		advancedClose: false,
		opacity: '0.45',
		twitter_method: "tweet",
		tweet_url: 'http://www.ebookwebproject.com/viralrefer/index.php?ref=1',
		tweet_text: 'Viral Refer 2.0 - Share your referral link with your friends and win amazing rewards!'
	});
	
});


</script>
	<meta charset="UTF-8">
	<title>Viral Refer 2.0 - Demo</title>
	<link rel="icon" type="image/x-icon" href="http://www.viralrefer.com/demo/images/favicon.ico" />	
	<link rel="stylesheet" href="fonts/TitilliumText/stylesheet.css" />
	<meta name="Description" content="Share your Link with your friends and unlock your Gift" /> 
	<meta property=og:title content="Get a Free Gifts Now!" />
    <meta property=og:type content=website />
	<meta property=og:description content="Win free gifts now, try it now. Powered by ViralRefer.com" />
	<meta property=og:image content="http://i.imgur.com/rLBu0wP.png" />
	<link rel="stylesheet" href="css/style.css" />
     <meta name="keywords" content="survey, online, referral, rewards, win, prize, gift, card, games">
   
				        <link href="social-traffic-pop.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>
<script src="jquery.stp.min.js" type="text/javascript"></script>
<script type="text/javascript">var switchTo5x=true;</script>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">stLight.options({publisher: "6c98ad43-5976-445e-baf4-532cc9d13687", doNotHash: false, doNotCopy: false, hashAddressBar: false});</script>

<link type="text/css" href="foobar/jquery.foobar.2.1.css" rel="Stylesheet" />
  <style type="text/css">
    #social_target { margin-left:20px; }
    ul.socialbuttons { height: 32px; padding: 0 !important; margin:0 !important; }
    ul.socialbuttons li { padding:6px !important; float: left; list-style: none !important; }  
  </style>
  <script type="text/javascript" src="scripts/jquery-1.7.1.min.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
function copyToClipboard(element) {
  var $temp = $("<input>");
  $("body").append($temp);
  $temp.val($(element).text()).select();
  document.execCommand("copy");
  $temp.remove();
}
</script>
<script>
function myFunction() {
    alert("Your Referral Link was copied to clipboard!\n#Tip: Share your Refferal Link in your Facebook, Twitter.. To get EXTRA Points!!");
}
</script>
</head>
<body>

	<div class="right">
	<div class="menudrop">
	    <h3><a href="#"><img src="images/arrow.png" alt="menu"></a></h3>
	    <ul>
		 <li><a href="#containersocial">**FREE POINTS**</a></li>
	      <li><a href="privacy.php">Privacy Policy</a></li>
	      <li><a href="tos.php">Terms</a></li>
	    </ul>
	</div>
	</div>
			<center><h1 id="title"><a href="index.php"><span style="color:#069">«</span>Viral Refer 2.0<span style="color:#069">»</span></a><br />
			<span style="font-weight: 300; font-size: 14px; color: #27C1F4;">Share your Link and unlock your Rewards !</span></h1></center>			
	<br class="clear" />
	<div id="container">
	
			<div id="ref_container">
				<div style="float: left">
						<div class="dropbutton" style=" height: 40px;">
								<div class="black" style=" border-radius: 4px 0 0 4px;height: 32px;">
									<img style="margin-top: 1px;" src="http://i.imgur.com/dKP6K52.png" width="25px" height="25px" title="Your Points">
								</div>
								<div class="black" style=" height: 40px; border-radius: 0 4px 4px 0;">
									<a style="cursor: pointer; color: rgb(165, 204, 0);font-size: 23px!important;line-height: 42px!important;"><b><font size="6"><?php echo $user->referrals;?></font></b> Points</a>
									&nbsp;&nbsp;
									
								</div>
								<a href="javascript:history.go(0)"><img style="position: absolute; right: -30px;top: 10px;" src="http://i.imgur.com/e8L99Pn.png" width="25px" height="25px"></a>

						</div>
						
				</div>
				<p><font size="4">Your Referral Link:</font>  <input title="copy & paste" readonly="readonly" type="text" value="<?php echo $site_url; ?>?ref=<?php echo $user->id;?>" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#copy"><img style="position: absolute; right: 5px;top: 5px;" onclick="copyToClipboard('#p1'); myFunction();" src="http://i.imgur.com/krE6Lmt.gif"></a></p>
				<p style="display: none;" id="p1"><?php echo $site_url; ?>?ref=<?php echo $user->id;?></p>
				
				
			</div>
	</div>

	<div id="container">

				<h2>Welcome To Viral Refer 2.0 ** DEMO VERSION **</h2>				
				<p class="left_15">Share your unique <b>REFERRAL LINK</b> with your friends and you will receive <b>1 POINT FOR EACH VISITOR</b>. Yes, it's that simple!</br>
				<br>::::::<b>Get this Script here with <b><u>SPECIAL DISCOUNT<b></u>: <font size="5" color="#F5F507"><a href="http://viralrefer.com">VIRALREFER.COM</a></font>:::::</br>
	
			    
	</div>
	
	<div id="container">
		<div class="drop_top">
	<?php
		for($i = 1; $i <= 50; $i++){
			if((list($id,$thumb,$name,$desc,$prize,$cost) = get_prize($i)) == true){
				echo "<div class=\"grid_1\" id=\"drop-rewards\"><div class=\"reward_image\"><h5>$cost pts</h5><img src=\"$thumb\" width=\"180\" height=\"180\"></div><div class=\"reward_text\"><p style=\"float: left\">$name</p></div>";
				if($user->referrals >= $cost){
					echo '
						<div class="dropbutton">
								<div class="black">
									<img src="images/unlock.png">
								</div>
								<div class="black">
									<a style="color: #cf9" href="verify.php?prizeid=' . $id . '">Redeem</a>
								</div>
						</div>';
				}else{
					echo '
						<div class="dropbutton">
								<div class="black">
									<img src="images/lock.png" title="not enough points">
								</div>
								<div class="black">
									<a title="not enough points" style="cursor: pointer; color: #ff5555">Locked</a>
								</div>
						</div>';
				}
				echo '</div>';
			}
		}
	?>
		</div>
	<br class="clear" />
		
		
		
		
		
	</div>
	<div id="containersocial">
	<h2>#TIPS: GET FREE EXTRA POINTS</h2>
<center>EARN <u>EXTRA POINTS</u> BY SHARE ON SOCIAL NETWORKS, <b>1 POINT FOR EACH SHARE!</b> </br></br>
<span class='st_facebook_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Facebook'></span>
<span class='st_twitter_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Tweet'></span>
<span class='st_linkedin_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='LinkedIn'></span>
<span class='st_tumblr_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Tumblr'></span>
<span class='st_reddit_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Reddit'></span>
<span class='st_orkut_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Orkut'></span>
<span class='st_netlog_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Netlog'></span>
<span class='st_myspace_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='MySpace'></span>
<span class='st_livejournal_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='LiveJournal'></span>
<span class='st_instapaper_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Instapaper'></span>
<span class='st_google_bmarks_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Bookmarks'></span>
<span class='st_pinterest_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Pinterest'></span>
<span class='st_google_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Google'></span>
<span class='st_formspring_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Formspring'></span>
<span class='st_email_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Email'></span>
<span class='st_digg_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Digg'></span>
<span class='st_delicious_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Delicious'></span>
<span class='st_diigo_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Diigo'></span>
<span class='st_blogger_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Blogger'></span></center>
</div>
	

<!--FOOTER-->
	<div id="container">	
<a href="index.php">HOME</a> | <a href="privacy.php">PRIVACY</a> | <a href="tos.php">TERMS</a>

<p style="float:right">&copy; 2015 | Powered by <a href="http://www.viralrefer.com">VIRALREFER.COM</a></p>
	</div>	
<!--FOOTER-->	
</body>

</html>

Non l'ho modificato del tutto, poichè ho paura di comprometterne il suo funzionamento; ma nell'ultimo codice, index.php sarebbe stato senza modifica:

Codice:
<?php
session_start();
require_once("inc/funcs.php");
$ip = $_SERVER['REMOTE_ADDR'];
if(get_user($ip) == false){
	add_user($db,$ip, $_GET['ref']);
	$_SESSION['ip'] = $ip;
}
$user = mysql_fetch_object(mysql_query("SELECT * FROM `$db`.`users` WHERE `ip`='". $ip ."'"));
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta charset="UTF-8">
	<title>Viral Refer 2.0 - Demo</title>
	<link rel="icon" type="image/x-icon" href="http://www.viralrefer.com/demo/images/favicon.ico" />	
	<link rel="stylesheet" href="fonts/TitilliumText/stylesheet.css" />
	<meta name="Description" content="Share your Link with your friends and unlock your Gift" /> 
	<meta property=og:title content="Get a Free Gifts Now!" />
    <meta property=og:type content=website />
	<meta property=og:description content="Win free gifts now, try it now. Powered by ViralRefer.com" />
	<meta property=og:image content="http://i.imgur.com/rLBu0wP.png" />
	<link rel="stylesheet" href="css/style.css" />
     <meta name="keywords" content="survey, online, referral, rewards, win, prize, gift, card, games">
   
				        <link href="social-traffic-pop.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
<script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script>
<script src="http://platform.twitter.com/widgets.js" type="text/javascript"></script>
<script src="jquery.stp.min.js" type="text/javascript"></script>
<script type="text/javascript">var switchTo5x=true;</script>
<script type="text/javascript" src="http://w.sharethis.com/button/buttons.js"></script>
<script type="text/javascript">stLight.options({publisher: "6c98ad43-5976-445e-baf4-532cc9d13687", doNotHash: false, doNotCopy: false, hashAddressBar: false});</script>

<link type="text/css" href="foobar/jquery.foobar.2.1.css" rel="Stylesheet" />
  <style type="text/css">
    #social_target { margin-left:20px; }
    ul.socialbuttons { height: 32px; padding: 0 !important; margin:0 !important; }
    ul.socialbuttons li { padding:6px !important; float: left; list-style: none !important; }  
  </style>
  <script type="text/javascript" src="scripts/jquery-1.7.1.min.js"></script>
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script>
function copyToClipboard(element) {
  var $temp = $("<input>");
  $("body").append($temp);
  $temp.val($(element).text()).select();
  document.execCommand("copy");
  $temp.remove();
}
</script>
<script>
function myFunction() {
    alert("Your Referral Link was copied to clipboard!\n#Tip: Share your Refferal Link in your Facebook, Twitter.. To get EXTRA Points!!");
}
</script>
</head>
<body>

	<div class="right">
	<div class="menudrop">
	    <h3><a href="#"><img src="images/arrow.png" alt="menu"></a></h3>
	    <ul>
		 <li><a href="#containersocial">**FREE POINTS**</a></li>
	      <li><a href="privacy.php">Privacy Policy</a></li>
	      <li><a href="tos.php">Terms</a></li>
	    </ul>
	</div>
	</div>
			<center><h1 id="title"><a href="index.php"><span style="color:#069">«</span>Viral Refer 2.0<span style="color:#069">»</span></a><br />
			<span style="font-weight: 300; font-size: 14px; color: #27C1F4;">Share your Link and unlock your Rewards !</span></h1></center>			
	<br class="clear" />
	<div id="container">
	
			<div id="ref_container">
				<div style="float: left">
						<div class="dropbutton" style=" height: 40px;">
								<div class="black" style=" border-radius: 4px 0 0 4px;height: 32px;">
									<img style="margin-top: 1px;" src="http://i.imgur.com/dKP6K52.png" width="25px" height="25px" title="Your Points">
								</div>
								<div class="black" style=" height: 40px; border-radius: 0 4px 4px 0;">
									<a style="cursor: pointer; color: rgb(165, 204, 0);font-size: 23px!important;line-height: 42px!important;"><b><font size="6"><?php echo $user->referrals;?></font></b> Points</a>
									&nbsp;&nbsp;
									
								</div>
								<a href="javascript:history.go(0)"><img style="position: absolute; right: -30px;top: 10px;" src="http://i.imgur.com/e8L99Pn.png" width="25px" height="25px"></a>

						</div>
						
				</div>
				<p><font size="4">Your Referral Link:</font>  <input title="copy & paste" readonly="readonly" type="text" value="<?php echo $site_url; ?>?ref=<?php echo $user->id;?>" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="#copy"><img style="position: absolute; right: 5px;top: 5px;" onclick="copyToClipboard('#p1'); myFunction();" src="http://i.imgur.com/krE6Lmt.gif"></a></p>
				<p style="display: none;" id="p1"><?php echo $site_url; ?>?ref=<?php echo $user->id;?></p>
				
				
			</div>
	</div>

	<div id="container">

				<h2>Welcome To Viral Refer 2.0 ** DEMO VERSION **</h2>				
				<p class="left_15">Share your unique <b>REFERRAL LINK</b> with your friends and you will receive <b>1 POINT FOR EACH VISITOR</b>. Yes, it's that simple!</br>
				<br>::::::<b>Get this Script here with <b><u>SPECIAL DISCOUNT<b></u>: <font size="5" color="#F5F507"><a href="http://viralrefer.com">VIRALREFER.COM</a></font>:::::</br>
	
			    
	</div>
	
	<div id="container">
		<div class="drop_top">
	<?php
		for($i = 1; $i <= 50; $i++){
			if((list($id,$thumb,$name,$desc,$prize,$cost) = get_prize($i)) == true){
				echo "<div class=\"grid_1\" id=\"drop-rewards\"><div class=\"reward_image\"><h5>$cost pts</h5><img src=\"$thumb\" width=\"180\" height=\"180\"></div><div class=\"reward_text\"><p style=\"float: left\">$name</p></div>";
				if($user->referrals >= $cost){
					echo '
						<div class="dropbutton">
								<div class="black">
									<img src="images/unlock.png">
								</div>
								<div class="black">
									<a style="color: #cf9" href="verify.php?prizeid=' . $id . '">Redeem</a>
								</div>
						</div>';
				}else{
					echo '
						<div class="dropbutton">
								<div class="black">
									<img src="images/lock.png" title="not enough points">
								</div>
								<div class="black">
									<a title="not enough points" style="cursor: pointer; color: #ff5555">Locked</a>
								</div>
						</div>';
				}
				echo '</div>';
			}
		}
	?>
		</div>
	<br class="clear" />
		
		
		
		
		
	</div>
	<div id="containersocial">
	<h2>#TIPS: GET FREE EXTRA POINTS</h2>
<center>EARN <u>EXTRA POINTS</u> BY SHARE ON SOCIAL NETWORKS, <b>1 POINT FOR EACH SHARE!</b> </br></br>
<span class='st_facebook_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Facebook'></span>
<span class='st_twitter_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Tweet'></span>
<span class='st_linkedin_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='LinkedIn'></span>
<span class='st_tumblr_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Tumblr'></span>
<span class='st_reddit_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Reddit'></span>
<span class='st_orkut_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Orkut'></span>
<span class='st_netlog_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Netlog'></span>
<span class='st_myspace_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='MySpace'></span>
<span class='st_livejournal_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='LiveJournal'></span>
<span class='st_instapaper_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Instapaper'></span>
<span class='st_google_bmarks_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Bookmarks'></span>
<span class='st_pinterest_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Pinterest'></span>
<span class='st_google_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Google'></span>
<span class='st_formspring_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Formspring'></span>
<span class='st_email_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Email'></span>
<span class='st_digg_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Digg'></span>
<span class='st_delicious_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Delicious'></span>
<span class='st_diigo_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Diigo'></span>
<span class='st_blogger_large' st_url='<?php echo $site_url; ?>?ref=<?php echo $user->id;?>' displayText='Blogger'></span></center>
</div>
	

<!--FOOTER-->
	<div id="container">	
<a href="index.php">HOME</a> | <a href="privacy.php">PRIVACY</a> | <a href="tos.php">TERMS</a>

<p style="float:right">&copy; 2015 | Powered by <a href="http://www.viralrefer.com">VIRALREFER.COM</a></p>
	</div>	
<!--FOOTER-->	
</body>

</html>

Arrivati al numero di punti necessario per scaricare l'ebook, mi compare la videata:

http://www.ebookwebproject.com/viralrefer/verify.php?prizeid=7#

dove #7# è l'id del prodotto da scaricare riportato nel db mysql.

Il codice del file verify.php è il seguente:

Codice:
<?php
session_start();
require_once("inc/funcs.php");
$ip = $_SERVER['REMOTE_ADDR'];
if(!isset($_GET['prizeid'])){
	header("Location: index.php");
	}else{
	$user = mysql_fetch_object(mysql_query("SELECT * FROM `$db`.`users` WHERE `ip`='". $ip ."'"));
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
	<meta charset="UTF-8">
<title>Viral Refer 2.0 - Demo</title>
<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
	<link rel="icon" type="image/x-icon" href="http://www.viralrefer.com/demo/images/favicon.ico" />	
	<link rel="stylesheet" href="fonts/TitilliumText/stylesheet.css" />
	<link rel="stylesheet" href="css/style.css" />
	<meta name="Description" content="Viral Refer 2.0 - Share your referral link with your friends and win amazing rewards!" /> 
        <meta name="keywords" content="survey, online, referral, rewards, win, prize, gift, card, games">
        <meta property="og:image" content="http://www.viralrefer.com/demo/images/thumb.png"/>
</head>
<body>
			<center><h1 id="title"><a href="index.php"><span style="color:#069">«</span>Viral Refer 2.0<span style="color:#069">»</span></a><br />
			<span style="font-weight: 300; font-size: 14px; color: #27C1F4;">Share Your Link And Get Rewards</span></h1></center>			
	<br class="clear" />
	<div id="container">
				<h2>Redeem Your Reward</h2>				
<?php
	$prizeid = mysql_real_escape_string($_GET['prizeid']);
	$_SESSION['prizeid'] = $prizeid;
	if((list($id,$thumb,$name,$desc,$prize,$cost) = get_prize($prizeid)) == true){	
		if($user->referrals >= $cost){
			$_SESSION['prize'] = $prizeid;
	echo  '<p class="enough">Click the Button Below To Verify & Confirm Your Price Request</p>

<!-----------------------MONEY PAGE CONTENT OR DOWNLOAD BUTTON/WIDGET--------------------------->
<script>
function myFunction()
{
alert("VIRAL REFER 2.0 NEWS: Congratulations, you´ve managed to unlock your reward! NOTE: This is only a DEMO version, you could be redirected to a CPA offer or use a WIDGET a PPD!");
}
</script>
			<center><a href="#" class="green-pastel button heavy icon forward" onclick="myFunction()" /><span>Redeem</span></a></center>

<!-----------------------END MONEY PAGE CONTENT OR DOWNLOAD BUTTON/WIDGET----------------------->

';
		}else{
			echo '<p class="enough">You do not have enough points to purchase this item!</p><br />

					<a href="index.php" class="red button heavy icon back"><span>Go Back</span></a>';
		}
	}else{
		echo '<p class="enough">Prize does not exist in our database. Please choose a different prize.</p>

					<a href="index.php" class="red button heavy icon back"><span>Go Back</span></a>';
	}
}

?>

	</div> <!--PUSH DIVISION-->		
	<br class="clear" />		
	</div>

<!--FOOTER-->
	<div id="container">	
<a href="index.php">HOME</a> | <a href="privacy.php">PRIVACY</a> | <a href="tos.php">TERMS</a>

<p style="float:right">&copy; 2013 <a href="http://www.viralrefer.com">VIRALREFER.COM</a></p>
	</div>	
<!--FOOTER-->

</body>
</html>

nel cui interno compare la porzione di codice in cui implementare il bottone od il widget per il download del prodotto.

Credo di avere descritto con cura la situazione, e qui mi chiedo:
- come si può, che codice usare per collegare l'id del prodotto che arriva dal database mysql con un file pdf/epub?
- come posso creare un bottone, e come, che mi permetta di scaricare il prodotto scelto, l'id collegato al file pdf, che mi permetta anche di aggiungere nome e email di chi effettua il download.
In modo da farne un potenziale cliente e tenerne traccia.
- come aggiungere al databse mysql i campi nome ed email? permettendo subito dopo di scaricare il file che si è sbloccato raggiungendo i punti.
Per praticità ho introdotto un prezzo 0 punti per fare le prove.
Il video appare così,

http://www.ebookwebproject.com/viralrefer/index.php

come l'ho appena attivato, ma non credo bene; poichè il software viene fornito bloccato/disabilitato nel traffico social pop. E con le modifiche dovrebbe funzionare a pieno.

Ringrazio anticipatamente chiunque abbia il tempo di darmi una mani; in questa impresa che forse per me è veramente titanica.

Grazie ancora e cordiali saluti.
 

Discussioni simili