-
Notifications
You must be signed in to change notification settings - Fork 0
/
like.php
53 lines (48 loc) · 1.29 KB
/
like.php
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
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
session_start();
if(!isset($_SESSION['loggedin']) || $_SESSION['loggedin'] !==true)
{
header("location: login.php");
}
?>
<?php
$con = mysqli_connect('localhost','root','');
if (!$con) {
die('Could not connect: ' . mysqli_error($con));
}
$cid=$_GET['cid'];
mysqli_select_db($con,"cryptrack");
$uid=$_SESSION['uid'];
$sql = "INSERT into likes (uid,cid) values (".$uid.",".$cid.")";
$con -> query($sql);
if($cid==1)
{
$like_query="UPDATE crypto SET likes=likes+1 where cID=1";
$con -> query($like_query);
header("location: info_bitcoin.php");
}
else if($cid==2)
{
$like_query="UPDATE crypto SET likes=likes+1 where cID=2";
$con -> query($like_query);
header("location: info_ethereum.php");
}
else if($cid==3)
{
$like_query="UPDATE crypto SET likes=likes+1 where cID=3";
$con -> query($like_query);
header("location: info_bnb.php");
}
else if($cid==4)
{
$like_query="UPDATE crypto SET likes=likes+1 where cID=4";
$con -> query($like_query);
header("location: info_doge.php");
}
else if($cid==5)
{
$like_query="UPDATE crypto SET likes=likes+1 where cID=5";
$con -> query($like_query);
header("location: info_tether.php");
}
?>