Last active
May 12, 2017 13:39
-
-
Save mskian/82f728e1fb9058423d96df2d49504f26 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include("db.php"); | |
$str=mysqli_real_escape_string($con,$_GET["str"]); | |
//select user | |
$sql_query="SELECT * FROM referral WHERE str='$str'"; | |
$result_set=mysqli_query($con,$sql_query) or die('error'); | |
$user_ref=mysqli_fetch_array($result_set); | |
$user=$user_ref['user']; | |
if(!isset($_COOKIE['referral'])) { | |
//cookie for visitor | |
setcookie("referral", $str, time() + (86400 * 7), "/"); // 86400 = 1 day // 86400 * 7 for 7 Days | |
//page view Counts | |
$sql = "UPDATE referral SET clicks=clicks+1 WHERE str='$str'"; | |
$result_set=mysqli_query($con,$sql); | |
} | |
?> | |
<?php | |
if($user_ref == false) | |
{ | |
echo 'Sorry, the user does not exist.'; | |
} | |
else | |
{ | |
?> | |
<h2>Welcome to Allwebtuts Blog</h2> | |
<div class="clearfix"> </div> | |
<p><?php echo $user; ?> Loves Allwebtuts what about you??</p> | |
<p>Read Our Latest Posts</p> | |
<div class="clearfix"> </div> | |
<?php | |
} | |
?> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment