-
Notifications
You must be signed in to change notification settings - Fork 0
/
active.php
42 lines (36 loc) · 1.2 KB
/
active.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
<?php
include "functions/session.php";
include "functions/functions.php";
include "functions/conf.php";
?>
<?php
if (isset($_GET['id']) ) {
$user_id = $_GET['id'];
$query_select = "SELECT id_user FROM tbl_users WHERE id_user=".$user_id." AND active_user=1";
//$result_select = mysql_query($query_select) or die(mysql_error());
$result_select = $connection->query($query_select);
$i_select=0;
//while($row = mysql_fetch_array($result_select)){
while($row = $result_select->fetch_array()){
$i_select++;
}
if ($i_select>0)
{
//Deactivate
$query_deactivate = "UPDATE tbl_users SET active_user=0 WHERE id_user=".$user_id;
$result_deactivate = $connection->query($query_deactivate);
//if(mysql_query($query_deactivate))
if($result_deactivate)
echo json_encode(array('success'=>TRUE,'message'=>"Deactivate"));
}
else if($i_select<=0)
{
//Activate
$query_activate = "UPDATE tbl_users SET active_user=1 WHERE id_user=".$user_id;
$result_activate = $connection->query($query_activate);
//if(mysql_query($query_activate))
if($result_activate)
echo json_encode(array('success'=>TRUE,'message'=>"Activate"));
}
}
?>