-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathactivation.php
43 lines (36 loc) · 996 Bytes
/
activation.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
<?php
$DB_DSN = 'localhost';
$DB_USER = 'root';
$DB_PASSWORD = '';
$DB_NAME = 'matcha2';
//connect to the newly created database
try {
$conn = new PDO("mysql:host=$DB_DSN;dbname=$DB_NAME", $DB_USER, $DB_PASSWORD);
// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}
catch(PDOException $e)
{
echo "Connection failed: " . $e->getMessage();
}
///insert record into views + 1popularity
try{
$sql = $conn->prepare(" INSERT IGNORE INTO viewstats (user1,user2) VALUES (:userID,:viewersID)");
$sql->bindParam(':userID', $_GET['uid']);
$sql->bindParam(':viewersID', $_SESSION['id']);
$sql->execute();
}catch(Exception $e)
{
echo 'Error: ' . $e->getMessage();
}
if(isset($_GET['activate']) && !empty($_GET['activate'])){
$has = $_GET['activate'];
try{
$sql = $conn->prepare("UPDATE users SET isActive = 1 WHERE token='$has'");
$sql->execute();
}catch(Exception $e)
{
echo 'Error: ' . $e->getMessage();
}
}
?>