-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchange.php
More file actions
31 lines (25 loc) · 829 Bytes
/
Copy pathchange.php
File metadata and controls
31 lines (25 loc) · 829 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
<?php
/*
This page turns on/off the email check for the current user.
*/
session_start();
require('include/db.php');
/*Check if user logged it*/
if (!isset($_SESSION['validUser']))
{
echo "<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=login.php\">";
exit();
}
$user = $_SESSION['validUser'];
$data = mysqli_query($con, "SELECT * FROM users WHERE email='$user'") or die("Query failed: ".mysqli_error($con));
$row = mysqli_fetch_array($data);
if($row['check_mail']==1)
{
mysqli_query($con, "UPDATE users SET check_mail='0' WHERE email='$user'") or die("Query failed: ".mysqli_error($con));
}
else if($row['check_mail']==0)
{
mysqli_query($con, "UPDATE users SET check_mail='1' WHERE email='$user'") or die("Query failed: ".mysqli_error($con));
}
echo "<meta HTTP-EQUIV=\"REFRESH\" content=\"0; url=back.php\">";
?>