adding updated code
This commit is contained in:
41
sys0-code/api/update_settings.php
Normal file
41
sys0-code/api/update_settings.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
include "../config/config.php";
|
||||
session_start();
|
||||
if(isset($_GET["telegram_id"])){
|
||||
$telegram_id=htmlspecialchars($_GET["telegram_id"]);
|
||||
$id=$_SESSION["id"];
|
||||
$sql="update users set telegram_id=? where id=?";
|
||||
$stmt = mysqli_prepare($link, $sql);
|
||||
mysqli_stmt_bind_param($stmt, "si", $telegram_id,$id);
|
||||
mysqli_stmt_execute($stmt);
|
||||
$_SESSION["telegram_id"]=$telegram_id;
|
||||
}
|
||||
if(isset($_GET["notification_telegram"])){
|
||||
if($_GET["notification_telegram"]=="true"){
|
||||
$sql="update users set notification_telegram=1 where id=?";
|
||||
$_SESSION["notification_telegram"]=1;
|
||||
}
|
||||
else{
|
||||
$sql="update users set notification_telegram=0 where id=?";
|
||||
$_SESSION["notification_telegram"]=0;
|
||||
}
|
||||
$id=$_SESSION["id"];
|
||||
$stmt = mysqli_prepare($link, $sql);
|
||||
mysqli_stmt_bind_param($stmt, "i" ,$id);
|
||||
mysqli_stmt_execute($stmt);
|
||||
}
|
||||
if(isset($_GET["notification_mail"])){
|
||||
if($_GET["notification_mail"]=="true"){
|
||||
$sql="update users set notification_mail=1 where id=?";
|
||||
$_SESSION["notification_mail"]=1;
|
||||
}
|
||||
else{
|
||||
$sql="update users set notification_mail=0 where id=?";
|
||||
$_SESSION["notification_mail"]=0;
|
||||
}
|
||||
$id=$_SESSION["id"];
|
||||
$stmt = mysqli_prepare($link, $sql);
|
||||
mysqli_stmt_bind_param($stmt, "i" ,$id);
|
||||
mysqli_stmt_execute($stmt);
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user