-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpinvisitcounter.php
More file actions
40 lines (39 loc) · 823 Bytes
/
pinvisitcounter.php
File metadata and controls
40 lines (39 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
session_start();
$con = mysqli_connect("localhost","root","");
if (!$con)
{
die('Could not connect: ' . mysqli_error($con));
}
mysqli_select_db($con,"visbookmark");
if(!isset($_SESSION['name'])){
header("Location: login.php");
exit();
die();
}
$pinid = $_GET['pinid'];
$sql = "select * from bookmarks where bookmarkid = '$pinid'";
$result=mysqli_query($con,$sql);
if (!$result)
{
die(mysqli_error($con));
}
$count2=mysqli_num_rows($result);
if($count2 > 0)
{
$row = mysqli_fetch_array($result);
$vcount = $row['visitcount'];
$vcount= $vcount + 1;
$sql2 = "update bookmarks SET visitcount='$vcount' where bookmarkid = '$pinid'";
$result=mysqli_query($con,$sql2);
if (!$result)
{
die(mysqli_error($con));
}
header("Location: ".$row['link']);
}
else
{
header("location: newuitest.php");
}
?>